Class IdFactory¶
Defined in File IdFactory.h
Class Documentation¶
-
class
IdFactory
¶ A polymorphic functor base class for generating record IDs for a table.
The IDs produced by an IdFactory need not be sequential, but they must be unique, both with respect to the IDs it generates itself and those passed to it via the notify() member function. Valid IDs must be nonzero, as zero is used to indicate null in some contexts.
Public Functions
-
virtual void
notify
(RecordId id) = 0¶ Notify the IdFactory that the given ID has been used and must not be returned by operator().
-
IdFactory
()¶
-
virtual
~IdFactory
()¶
Public Static Functions
-
static std::shared_ptr<IdFactory>
makeSimple
()¶ Return a simple IdFactory that simply counts from 1.
This is used when an empty pointer is passed to the BaseTable constructor.
-
static std::shared_ptr<IdFactory>
makeSource
(RecordId expId, int reserved)¶ Return an IdFactory that includes another, fixed ID in the higher-order bits.
The final record ID will be:
(upper << reserved) | sequence
- Parameters
[in] expId
: ID to include in the upper bits via a bitwise OR.[in] reserved
: How many bits to reserve for the part of the ID that is unique.
-
static int
computeReservedFromMaxBits
(int maxBits)¶ Return the number to pass as the ‘reserved’ argument to makeSource for an exposure ID with the given maximum number of bits.
- Parameters
[in] maxBits
: The maximum number of bits an exposure ID can have.
-
virtual void