00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _VATTRR
00028 #define _VATTRR 1
00029
00030 #include "Basics.H"
00031 #include "VMemPool.H"
00032 #include "VestaSource.H"
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #define VATTR_FLAGS 0
00051 #define VATTR_NEXT 1
00052 #define VATTR_TIMESTAMP 5
00053 #define VATTR_NAME 9
00054 #define VATTR_MINSIZE 11 // if name = value = ""
00055
00056 class VestaAttribsRep {
00057 public:
00058 Bit8 rep[VATTR_MINSIZE];
00059 inline bool visited() throw()
00060 { return (bool) ((rep[0] & 2) != 0); };
00061 inline void setVisited(bool newval) throw()
00062 { rep[0] = (rep[0] & 0xfd) | ((int)newval << 1); };
00063 inline VestaSource::attribOp op() throw()
00064 { return (VestaSource::attribOp) ((rep[VATTR_FLAGS] >> 2) & 3); };
00065 inline void setOp(VestaSource::attribOp op) throw()
00066 { rep[VATTR_FLAGS] = (rep[VATTR_FLAGS] & 0xf3) | (((int) op) << 2); };
00067 inline Bit32 next() throw()
00068 { Bit32 val; memcpy(&val, &rep[VATTR_NEXT], 4); return val; };
00069 inline void setNext(Bit32 newval) throw()
00070 { memcpy(&rep[VATTR_NEXT], &newval, 4); };
00071 inline time_t timestamp() throw()
00072 { Bit32 val; memcpy(&val, &rep[VATTR_TIMESTAMP], 4);
00073 return (time_t) val; };
00074 inline const char* name() throw()
00075 { return (const char*) &rep[VATTR_NAME]; };
00076 inline const char* value(int namelen) throw()
00077 { return (const char*) &rep[VATTR_NAME + namelen + 1]; };
00078 inline const char* value() throw()
00079 { return (const char*) &rep[VATTR_NAME + strlen(name()) + 1]; };
00080
00081
00082
00083 static VestaAttribsRep*
00084 create(VestaSource::attribOp op, const char* name,
00085 const char* value, time_t timestamp) throw();
00086
00087
00088 void mark() throw();
00089 static void markCallback(void* closure, VMemPool::typeCode type) throw();
00090 static bool sweepCallback(void* closure, VMemPool::typeCode type,
00091 void* addr, Bit32& size) throw();
00092 static void rebuildCallback(void* closure, VMemPool::typeCode type,
00093 void* addr, Bit32& size) throw();
00094
00095
00096 Bit32 checkpoint(Bit32& nextSP, std::fstream& ckpt) throw();
00097 };
00098
00099 #endif