TimestampConverter Module¶
Module Contents¶
-
typedef boost::uuids::uuid tracktable::uuid_type¶
A convenience typedef for uuids in tracktable.
-
class UUIDGenerator¶
Serves as a common base for all generators of random uuids.
With a common base, the global uuid generator may be changed to different implementations, including different random number generation mechanisms.
This class is necessary because the boost random uuid generators do not have any common hierarchy. This class provides a common hierarchy around the
generate()method.This base class also provides a basic mutex to allow threadsafe generation.
Subclassed by tracktable::BoostRandomUUIDGenerator< UniformRandomNumberGenerator >, tracktable::BoostRandomUUIDGeneratorPure
Public Types
-
typedef boost::shared_ptr<UUIDGenerator> pointer¶
A convenience typedef for a smart pointer to a generator.
Public Functions
-
inline UUIDGenerator()¶
Instantiate an uninitialized UUID generator.
-
inline virtual ~UUIDGenerator()¶
Destructor for the UUID Generator.
Protected Functions
-
inline void lock_mutex()¶
Lock the mutex for generator.
-
inline void unlock_mutex()¶
Unlock the mutex for generator.
Private Members
-
pthread_mutex_t mutex¶
Mutexes used to ensure
generate_uuid()is threadsafe.
-
bool mutex_initialized¶
-
typedef boost::shared_ptr<UUIDGenerator> pointer¶
-
template<typename UniformRandomNumberGenerator = boost::random::mt19937>
class BoostRandomUUIDGenerator : public tracktable::UUIDGenerator¶ Wraps a boost uuid random generator to act as a RandomUUIDGenerator.
The boost random number generator is templated to use various random number generation mechanisms. The default boost implementation is the mt19937 which is also the default template type of this class.
However, any random number generator suitable for the boost classes can be used with this thin wrapper template.
To create an instance of this class, use the various static
create()methods that mimic the available boost random generator constructors.Public Types
-
typedef boost::uuids::basic_random_generator<UniformRandomNumberGenerator> random_generator_type¶
Public Functions
-
inline virtual ~BoostRandomUUIDGenerator()¶
Destructor for the Boost Random UUID Generator.
Public Static Functions
-
static inline UUIDGenerator::pointer create()¶
Static method to create an instance using the default uniform random number generator type.
Example setting a new default uuid generator with mt19937:
::tracktable::set_automatic_uuid_generator(::tracktable::BoostRandomUUIDGenerator<boost::random::mt19937>::create());
- Returns:
Pointer to the new Boost random UUID generator
-
static inline UUIDGenerator::pointer create(UniformRandomNumberGenerator &gen)¶
Static method to create an instance using a supplied uniform random number generator type.
- Returns:
Pointer to the new Boost random UUID generator
-
static inline UUIDGenerator::pointer create(UniformRandomNumberGenerator *pGen)¶
Static method to create an instance using a supplied uniform random number generator type.
- Returns:
Pointer to the new Boost random UUID generator
Private Functions
-
inline BoostRandomUUIDGenerator()¶
Instantiate a Boost random UUID generator Use BoostRandomUUIDGenerator<URNG type>::create()
-
inline BoostRandomUUIDGenerator(UniformRandomNumberGenerator &gen)¶
Instantiate a Boost random UUID generator Use BoostRandomUUIDGenerator<URNG type>::create(URNG type &)
-
inline BoostRandomUUIDGenerator(UniformRandomNumberGenerator *pGen)¶
Instantiate a Boost random UUID generator Use BoostRandomUUIDGenerator<URNG type>::create(URNG type *)
Private Members
-
random_generator_type *_generator¶
-
typedef boost::uuids::basic_random_generator<UniformRandomNumberGenerator> random_generator_type¶
-
class BoostRandomUUIDGeneratorPure : public tracktable::UUIDGenerator¶
Wraps a boost uuid pure generator to act as a RandomUUIDGenerator.
The boost uuid pure generator is a lighter weight generator with less entropy, but as stated in the boost documentation it “will satisfy the
majority of use cases.”
Public Types
-
typedef boost::uuids::random_generator random_generator_type¶
Public Functions
-
inline virtual ~BoostRandomUUIDGeneratorPure()¶
Destructor for the UUID Generator.
Public Static Functions
-
static inline UUIDGenerator::pointer create()¶
Static method to create an instance using the default uniform random number generator type.
Example setting a new default uuid generator:
::tracktable::set_automatic_uuid_generator(::tracktable::BoostRandomUUIDGeneratorPure::create());
- Returns:
Pointer to the new pure Boost random UUID generator
Private Functions
-
inline BoostRandomUUIDGeneratorPure()¶
Instantiate a boost random uuid pure generator.
Private Members
-
random_generator_type *_generator¶
-
typedef boost::uuids::random_generator random_generator_type¶
-
UUIDGenerator::pointer tracktable::automatic_uuid_generator()¶
Get the current global automatic uuid generator.
A global automatic uuid generator is used to avoid the cost of continuously instantiating a new generator, which could have a significant impact
This could be used to generate uuids using the same mechanisms as the current global generator.
-
void tracktable::set_automatic_uuid_generator(UUIDGenerator::pointer new_random_generator)¶
Set the global automatic uuid generator.
Allows the global uuid generator to be changed from the default generator to any generator implementing the
generate()method ofUUIDGenerator.The default generator is a boost random uuid generator using mt19937 for random number generation.
The
BoostRandomUUIDGeneratortemplate can be used to quickly create generators employing other random number generation approaches.