00001 #ifndef CDB_ID_HH
00002 #define CDB_ID_HH
00003
00004
00005
00006
00007 #include "CdbBase/CdbCommon.hh"
00008
00009 #include <iostream>
00010
00011 class CdbCompositeName;
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 class CdbId {
00022
00023 public:
00024
00025
00026
00027
00028 CdbId( unsigned short theOriginId = 0,
00029 unsigned short theLocalId = 0 ) :
00030 origin(theOriginId),
00031 local(theLocalId)
00032 { }
00033
00034
00035
00036
00037 CdbId( const CdbId& theId )
00038 {
00039 origin = theId.origin;
00040 local = theId.local;
00041 }
00042
00043
00044
00045
00046
00047
00048 ~CdbId( ) { }
00049
00050
00051
00052
00053 CdbId& operator=( const CdbId& theId )
00054 {
00055 if( this != &theId ) {
00056 origin = theId.origin;
00057 local = theId.local;
00058 }
00059 return *this;
00060 }
00061
00062
00063
00064
00065
00066
00067 bool operator==( const CdbId& theId ) const
00068 {
00069 return ( origin == theId.origin ) && ( local == theId.local );
00070 }
00071
00072
00073
00074
00075 bool operator!=( const CdbId& theId ) const
00076 {
00077 return ! operator==( theId );
00078 }
00079
00080
00081
00082
00083
00084
00085 bool operator<( const CdbId& theId ) const
00086 {
00087 return ( origin < theId.origin ) || (( origin == theId.origin ) && ( local < theId.local ));
00088 }
00089
00090 public:
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 static bool translate( CdbId& theId,
00103 const char* theString
00104 );
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116 static bool translate( CdbId& theId,
00117 const CdbCompositeName& theCompositeName
00118 );
00119
00120 public:
00121
00122 unsigned short origin;
00123 unsigned short local;
00124 };
00125
00126 inline
00127 std::ostream&
00128 operator<<( std::ostream& o,
00129 const CdbId& theId )
00130 {
00131 o << theId.origin << "::" << theId.local;
00132 return o;
00133 }
00134
00135 #endif // CDB_ID_HH