00001 #ifndef tcsmonattr_H 00002 #define tcsmonattr_H 00003 /************************************************************************ 00004 * E.S.O. - VLT project 00005 * 00006 * "@(#) $Id: tcsmonattr.h,v 2.38 2003/07/12 21:26:16 vltsccm Exp $" 00007 * 00008 * who when what 00009 * -------- -------- ---------------------------------------------- 00010 * imunoz 06/10/99 created 00011 */ 00012 00013 /************************************************************************ 00014 * 00015 *---------------------------------------------------------------------- 00016 */ 00017 00018 #include "ccs.h" 00019 #include "db.h" 00020 #include <vector> 00021 #include <iostream> 00022 00023 00024 class node { 00025 public: 00026 00027 vltBYTES256 name; // attr name. 00028 vltBYTES256 fitsKw; // FTIS keyword. 00029 vltUINT16 period; // monitoring period in secs 00030 int gid; // Group id. 00031 // must match actual DB value in order to allow logging 00032 vltINT32 okValue; 00033 00034 // attr that don't come from the DB 00035 vltUINT32 size; 00036 dbTYPE type; 00037 dbVALUE value; 00038 dbDIRADDRESS dirAddr; 00039 00040 00041 node(void): 00042 okValue(0) 00043 { 00044 name[0]= fitsKw[0] = 0; 00045 period = gid = 0; 00046 size = 0; 00047 type = (dbATTRTYPE)-1; 00048 } 00049 00050 node (const node &n) : 00051 period(n.period), 00052 gid(n.gid), 00053 okValue(n.okValue), 00054 size(n.size), 00055 type(n.type), 00056 dirAddr(n.dirAddr) 00057 { 00058 if (&n == this) 00059 return; 00060 strncpy((char*)name, (const char*)n.name, 256); 00061 strncpy((char*)fitsKw, (const char*)n.fitsKw, 256); 00062 } 00063 00064 void print(void) 00065 { 00066 cout << "Name: " << name << " Period: " << period << endl; 00067 cout << "Fits: " << fitsKw << endl; 00068 } 00069 }; 00070 00071 00072 class nodeGroup : public node 00073 { 00074 public: 00075 vector<node*> nodes; 00076 // copy constructor 00077 nodeGroup(void) : node() 00078 {} 00079 nodeGroup( const nodeGroup &n) : node(n) 00080 { 00081 if (&n == this) // self copy, do nothing. 00082 return; 00083 nodes = n.nodes; 00084 00085 } 00086 ~nodeGroup() 00087 { 00088 vector<node*>::iterator i; 00089 00090 for (i=nodes.begin(); i != nodes.end(); ++i) 00091 delete *i; 00092 } 00093 }; 00094 #endif