ObjectID.h
Classes
- ObjectID -- ObjectID: A unique identifier for distributed and other objects. (full description)
Interface
- Public Members
- ObjectID(Bool makeNull = False)
- ObjectID(Int sequence, Int pid, Int time, const String &hostname)
- ObjectID(const ObjectID &other)
- ObjectID &operator=(const ObjectID &other)
- Bool isNull() const
- Bool operator==(const ObjectID &other) const
- Bool operator!=(const ObjectID &other) const
- Bool fromString(String &error, const String &in)
- void toString(String &out) const
- Int sequence() const
- Int pid() const
- Int creationTime() const
- const String &hostName() const
- static String extractIDs (Block<ObjectID>& objectIDs, const String& command)
- Private Members
- static Int sequence_number()
Review Status
- Programs:
- Tests:
Prerequisite
Etymology
The ObjectID class name reflects its role as the single identifier for
distributed and other user-level objects.
Synopsis
The ObjectID class is used to give a unique identifier to ``high-level''
objects in the system. Internally the ObjectID consists of a sequence number
(unique within the creating process), a process id, a creation time, and a
host id. Pragmatically the ObjectID should be unique with no dangers of
collisions.
A special ``Null'' ObjectID is available.
Motivation
The fundamental purpose for an ObjectID is to provide a unique identifier
for persistent objects, or for objects that might be accessed outside the
creating processes address space.
To Do
- Nothing (hostid -> hostname on this date).
Member Description
ObjectID(Bool makeNull = False)
If makeNull is True, make the null ObjectID, otherwise create
a unique ObjectID.
ObjectID(Int sequence, Int pid, Int time, const String &hostname)
Create explicitly from the provided constituents.
ObjectID(const ObjectID &other)
ObjectID &operator=(const ObjectID &other)
Copy other. Note that if the ObjectID is embedded inside an
object, the enclosing object probably does not want to copy the ObjectID
since generally speaking the identity of the enclosing object should be
immutable.
Bool isNull() const
Is this ObjectID set?
Bool operator==(const ObjectID &other) const
Bool operator!=(const ObjectID &other) const
Compare two ObjectID's for (in)equality.
It is useful to interconvert between strings and ObjecID's, e.g. when
saving to FITS or writing to a table. The form of the string is:
sequence=123 host=hostname pid=pid time=time
with an optional comma between the fields.
However, in general user code should not depend on the exact form of
the string.
Note that out is zero'd before it is set.
It is useful to interconvert between strings and ObjecID's, e.g. when
saving to FITS or writing to a table. The form of the string is:
sequence=123 host=hostname pid=pid time=time
with an optional comma between the fields.
However, in general user code should not depend on the exact form of
the string.
Ordinarily the user does not need to get at the exact state of the,
ObjectID, however it is available for those times when it is necessary.
Extract objectID strings (as set by glish script substitute.g) from
a command, convert them to ObjectID objects, store those in the
Block, and replace the strings by their Block indices as
$OBJ#n#O where n is the index.
Make a unique sequence number, returns 0 on first call, 1 on next, ...