Dripline-Cpp  v2.4.2
Dripline Implementation in C++
uuid.hh
Go to the documentation of this file.
1 /*
2  * uuid.hh
3  *
4  * Created on: Sep 16, 2015
5  * Author: N.S. Oblath
6  */
7 
8 #ifndef DRIPLINE_UUID_HH_
9 #define DRIPLINE_UUID_HH_
10 
11 #include "dripline_api.hh"
12 
13 #include <boost/uuid/uuid.hpp>
14 #include <boost/uuid/uuid_io.hpp> // to allow streaming of uuid_t
15 
16 #include <string>
17 
18 // In Windows there's a preprocessor macro called uuid_t that conflicts with this typdef
19 #ifdef uuid_t
20 #undef uuid_t
21 #endif
22 
23 namespace dripline
24 {
26  typedef boost::uuids::uuid uuid_t;
27 
32 
41  uuid_t DRIPLINE_API uuid_from_string( const std::string& a_id_str );
42  uuid_t DRIPLINE_API uuid_from_string( const char* a_id_str );
43 
53  uuid_t DRIPLINE_API uuid_from_string( const std::string& a_id_str, bool& a_valid_flag );
54  uuid_t DRIPLINE_API uuid_from_string( const char* a_id_str, bool& a_valid_flag );
55 
57  std::string DRIPLINE_API string_from_uuid( const uuid_t& a_id );
58 
59 } /* namespace dripline */
60 
61 #endif /* DRIPLINE_UUID_HH_ */
#define DRIPLINE_API
Definition: dripline_api.hh:34
uuid_t uuid_from_string(const std::string &a_id_str)
Definition: uuid.cc:31
std::string string_from_uuid(const uuid_t &a_id)
Generates a string representation of the provided UUID.
Definition: uuid.cc:92
boost::uuids::uuid uuid_t
Universally-unique-identifier type containing 16 hexadecimal characters.
Definition: uuid.hh:26
uuid_t generate_random_uuid()
Generates a UUID containing random numbers (RNG is a Mersenne Twister)
Definition: uuid.cc:19
uuid_t generate_nil_uuid()
Generates a UUID containing all 0s.
Definition: uuid.cc:26