00001 #ifndef multiid_h
00002 #define multiid_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "compoundkey.h"
00016 #include "string2.h"
00017 #include "fixedstring.h"
00018
00019
00022 mClass MultiID : public CompoundKey
00023 {
00024 public:
00025 MultiID(const FixedString& s)
00026 : CompoundKey(s) {}
00027 MultiID( const char* s=0 )
00028 : CompoundKey(s) {}
00029 MultiID( const MultiID& mid )
00030 : CompoundKey(mid) {}
00031 MultiID( int i )
00032 { add(i); }
00033
00034 MultiID& operator =( const MultiID& mi )
00035 { id_ = mi.id_; return *this; }
00036 MultiID& operator =( const CompoundKey& ck )
00037 { id_ = (const char*)ck; return *this; }
00038 MultiID& operator =( const FixedString& fs )
00039 { id_ = fs.str(); return *this; }
00040 MultiID& operator =( const char* s )
00041 { id_ = s; return *this; }
00042
00043 inline bool operator==( const MultiID& m ) const
00044 { return id_ == m.id_; }
00045 inline bool operator==( const char* s ) const
00046 { return id_ == s; }
00047
00048 inline int ID( int idx ) const
00049 { return toInt(key(idx).buf()); }
00050 inline void setID( int idx, int i )
00051 { setKey( idx, toString(i) ); }
00052 int leafID() const;
00053
00054 inline MultiID& add( int i )
00055 { *this += toString(i); return *this; }
00056
00057 };
00058
00059
00060 #endif