26 #ifndef __BIASUUID_hh__
27 #define __BIASUUID_hh__
32 #include <Base/Debug/Error.hh>
33 #include <Base/Debug/Debug.hh>
35 #include <Base/Common/BIASpragmaStart.hh>
51 # include <uuid/uuid.h>
57 #ifndef DEFAULT_UUID_CONSECUTIVELY
58 # define DEFAULT_UUID_CONSECUTIVELY false
64 class BIASImageBase_EXPORT
UUID;
68 BIASImageBase_EXPORT std::ostream&
operator<<(std::ostream & os,
const UUID&
id);
71 BIASImageBase_EXPORT std::istream&
operator>>(std::istream & is,
UUID&
id);
112 explicit UUID(
const uuid_t &
id);
118 explicit UUID(
const std::string &sID);
123 explicit UUID(
const unsigned long & n);
139 static UUID GenerateUUID(
const bool & consecutively=
140 DEFAULT_UUID_CONSECUTIVELY);
142 static UUID GenerateUUID_Consecutive();
144 static UUID GenerateUUID_Global();
155 void AssignUUID(
const bool & consecutively=DEFAULT_UUID_CONSECUTIVELY);
157 void AssignUUID_Global();
159 void AssignUUID_Consecutive();
165 bool SetFromString(
const std::string &sID);
171 bool SetFromLong(
const unsigned long &n);
179 unsigned long GetLong()
const;
182 time_t GetUUIDCreationTime()
const;
185 timeval GetUUIDCreationTimeStruct()
const;
188 inline bool operator==(
const UUID&
id)
const;
192 {
return (!((*
this)==
id)); };
200 inline bool operator<=(
const UUID&
id)
const;
203 inline UUID& operator=(
const UUID&
id);
206 void GetString(std::string& sUUID)
const;
207 std::string GetString()
const;
210 inline bool IsValid()
const {
return IsValid_; };
218 const unsigned char *GetUUIDRaw()
const;
220 void SetUUIDRaw(
const unsigned char * rawid);
223 bool IsConsecutive()
const;
227 friend BIASImageBase_EXPORT std::ostream&
229 friend BIASImageBase_EXPORT std::istream&
264 {
return ! (a < b); }
278 GUID id1 = (GUID)
id.theID_;
279 GUID id2 = (GUID)this->theID_;
280 int result = UuidCompare(&id1, &id2, &status);
283 return (!uuid_compare(
id.theID_,theID_));
292 return (UuidCompare(&((GUID)
id.theID_),&((GUID)theID_),&dummy)<0);
294 return (uuid_compare(
id.theID_,theID_)<0);
303 return (UuidCompare(&((GUID)
id.theID_),&((GUID)theID_),&dummy)<=0);
305 return (uuid_compare(
id.theID_,theID_)<=0);
312 memcpy((
void*)&theID_,(
void*)&
id.theID_,
sizeof(uuid_t));
313 IsValid_ =
id.IsValid_;
return (*
this);
318 #include <Base/Common/BIASpragmaEnd.hh>
320 #endif // __BIASUUID_hh__
bool operator()(BIAS::UUID &a, BIAS::UUID &b)
static long g_uniqueCounter
global counter to create next unique consecutive program run-unique ID.
Helper class for ascending sort of sequential BIAS::UUID instances.
bool operator!=(const UUID &id) const
"not equal"-operator, uses result of operator==
static timeval LastGenerationTime_
when creating a uuid, current time is compared against the time saved during the last uuid generation...
bool operator<(const UUID &id) const
the operator< does not express temporal ordering, it does only compare the data areas of the two ids...
bool operator<(const BIAS::Polynom &p1, const BIAS::Polynom &p2)
std::ostream & operator<<(std::ostream &os, const Array2D< T > &arg)
class BIASImageBase_EXPORT UUID
forward declaration for stream operators
UUID & operator=(const UUID &id)
standard assignment operator
interface class for producing/storing Universally Unique IDentifiers
bool IsValid_
flag indicating whether this uuid has been assigned a value yet
void Invalidate()
sets the valid flag to false and clears data JW 09/2005: added clear in addition to just setting bool...
uuid_t theID_
the data fields of the uuid
bool operator==(const UUID &id) const
comparison operator only compares ids, no check of validities
bool operator<=(const UUID &id) const
operator<= does not express temporal ordering, it does only compare the data areas of the two ids !!!...
bool IsValid() const
checks whether this uuid is valid(true) or unitialized(false)
BIASCommon_EXPORT std::istream & operator>>(std::istream &is, BIAS::TimeStamp &ts)
Standard input operator for TimeStamps.