summaryrefslogtreecommitdiff
path: root/src/libnml/nml/nmlmsg.hh
blob: 64e6e0ec1c76821f05ab8aae35686d0e57867b11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/********************************************************************
* Description: nmlmsg.hh
*
*   Derived from a work by Fred Proctor & Will Shackleford
*
* Author:
* License: LGPL Version 2
* System: Linux
*    
* Copyright (c) 2004 All rights reserved.
*
* Last change: 
********************************************************************/

#ifndef NMLMSG_HH
#define NMLMSG_HH

#ifdef __cplusplus
extern "C" {
#endif

#include <stddef.h>		/* size_t */

#ifdef __cplusplus
};
#endif

/* Definitions from other Header files. */

class CMS;			/* Use only partial definition to avoid */
				/* depending on cms.hh */

#include "nml_type.hh"

/* Class NMLmsg */
/* Base class for all types that can be written to NML. */
/* The constructor is protected so that to users cannot send messages */
/*  without deriving their own classes from NMLmsg.  */
/* Derived classes should pass the type and size to the NMLmsg constructor. */
/*  and define their own update function. */
class NMLmsg {
  protected:
    NMLmsg(NMLTYPE t, long s);
      NMLmsg(NMLTYPE t, size_t s);

    /* This second constructor never clears the message regardless of what is
       in nmlmsg. The value of noclear is irrelevent but adding it changes
       which constructor is called. */
      NMLmsg(NMLTYPE t, long s, int noclear);

  public:
    void clear();

    static int automatically_clear;	/* controls whether NMLmsgs are set
					   to zero in the constructor. */
    NMLTYPE type;		/* Each derived type should have a unique id */
    long size;			/* The size is used so that the entire buffer 
				   is not copied unneccesarily. */

    void update(CMS *);
};

// This is just a symbol passed to the RCS Java Tools (CodeGen, RCS-Design, RCS-Diagnostis)
#define NML_DYNAMIC_LENGTH_ARRAY

#define DECLARE_NML_DYNAMIC_LENGTH_ARRAY(type, name, size) int name##_length; type name[size];

#endif /* !defined(NMLMSG_HH) */