00001 /************************************************************************* 00002 * File: nmlmsg.hh * 00003 * Authors: Fred Proctor, Will Shackleford * 00004 * Purpose: C++ Header file for the Neutral Manufacturing Language (NML). * 00005 * Includes: * 00006 * 1. NMLmsg Class. * 00007 * 2. NMLTYPE typedef. * 00008 *************************************************************************/ 00009 00010 #ifndef NMLMSG_HH 00011 #define NMLMSG_HH 00012 00013 #include "rcs_defs.hh" /* RCS_EXPORT */ 00014 00015 /* Include Files */ 00016 #ifdef EXTERN_C_STD_HEADERS 00017 extern "C" 00018 { 00019 #endif 00020 00021 #ifndef UNDER_CE 00022 #include <stddef.h> /* size_t */ 00023 #endif 00024 00025 #ifdef EXTERN_C_STD_HEADERS 00026 }; 00027 #endif 00028 00029 /* Definitions from other Header files. */ 00030 00031 class RCS_EXPORT CMS; /* Use only partial definition to avoid */ 00032 /* depending on cms.hh */ 00033 00034 #ifndef NMLTYPE_TYPEDEFED 00035 #define NMLTYPE_TYPEDEFED 00036 typedef long NMLTYPE; /* Also defined in nml.hh */ 00037 #endif 00038 00039 00040 00041 /* Class NMLmsg */ 00042 /* Base class for all types that can be written to NML. */ 00043 /* The constructor is protected so that to users cannot send messages */ 00044 /* without deriving thier own classes from NMLmsg. */ 00045 /* Derived classes should pass the type and size to the NMLmsg constructor. */ 00046 /* and define their own update function. */ 00047 class RCS_EXPORT NMLmsg 00048 { 00049 protected: 00050 NMLmsg (NMLTYPE t, long s); 00051 #ifdef NML_OLD_COMPAT 00052 NMLmsg (NMLTYPE t, size_t s); 00053 #endif 00054 00055 00056 // This second constructor never clears the message regardless of what is 00057 // in nmlmsg. The value of noclear is irrelevent but adding it changes 00058 // which constructor is called. 00059 NMLmsg (NMLTYPE t, long s, int noclear); 00060 00061 public: 00062 void clear (); 00063 00064 static int automatically_clear; /* controls whether NMLmsgs are set to zero 00065 in the constructor. */ 00066 NMLTYPE type; /* Each derived type should have a unique id */ 00067 long size; /* The size is used so that the entire */ 00068 /* buffer is not copied unneccesarily. */ 00069 00070 void update (CMS *); 00071 }; 00072 00073 // This is just a symbol passed to the RCS Java Tools (CodeGen, RCS-Design, RCS-Diagnostis) 00074 #define NML_DYNAMIC_LENGTH_ARRAY 00075 00076 #define DECLARE_NML_DYNAMIC_LENGTH_ARRAY(type, name, size) int name##_length; type name[size]; 00077 00078 #endif /* !defined(NMLMSG_HH) */