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
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef ID_h
00041 #define ID_h
00042
00043 #include <iostream.h>
00044 #include <G3Globals.h>
00045
00065 class ID
00066 {
00067 public:
00069 ID();
00074 ID(int);
00075
00083 ID(int size, int arraySize);
00084
00093 ID(const ID &);
00094
00102 ~ID();
00103
00104
00106 int Size(void) const;
00112 void Zero(void);
00113
00114
00116 inline int &operator()(int x);
00122 inline int operator()(int x) const;
00123
00136 int &operator[](int);
00137
00138
00146 ID &operator=(const ID &V);
00147
00148
00150 int getLocation(int value) const;
00151
00153 int removeValue(int value);
00154
00156 friend ostream &operator<<(ostream &s, const ID &V);
00158 friend istream &operator>>(istream &s, ID &V);
00159
00161 friend #include <UDP_Socket.h>
00162 friend #include <TCP_Socket.h>
00163 friend #include <TCP_SocketNoDelay.h>
00164 friend #include <MPI_Channel.h>
00165
00166 private:
00167 static int ID_NOT_VALID_ENTRY;
00169 int sz;
00171 int *data;
00173 int arraySize;
00174 };
00175
00176
00178 inline int
00179 ID::Size(void) const {return sz;}
00180
00182 inline int &
00183 ID::operator()(int x)
00184 {
00185 #ifdef _G3DEBUG
00186
00187 if (x < 0 || x >= sz) {
00188 g3ErrorHandler->warning("ID::(loc) - loc %d outside range [0, %d]\n",x,sz-1);
00189 return ID_NOT_VALID_ENTRY;
00190 }
00191 #endif
00192
00193 return data[x];
00194 }
00195
00197 inline int
00198 ID::operator()(int x) const
00199 {
00200 #ifdef _G3DEBUG
00201
00202 if (x < 0 || x >= sz) {
00203 g3ErrorHandler->warning("ID::(loc) - loc %d outside range [0, %d]\n",x,sz-1);
00204 return ID_NOT_VALID_ENTRY;
00205 }
00206 #endif
00207
00208 return data[x];
00209 }
00210
00211 #endif
00212
00213