Jpp  18.2.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
JLANG::JUUID Struct Reference

Simple wrapper for UUID. More...

#include <JUUID.hh>

Inheritance diagram for JLANG::JUUID:
JLANG::JComparable< JUUID >

Public Member Functions

 JUUID ()
 Default constructor. More...
 
 JUUID (const uuid_t &object)
 Copy constructor. More...
 
 JUUID (const JUUID &object)
 Copy constructor. More...
 
const JUUIDoperator() ()
 Randomizde this UUID. More...
 
bool is_valid () const
 Check validity. More...
 
void clear ()
 Clear UUID. More...
 
bool less (const JUUID &object) const
 Less than method. More...
 

Static Public Member Functions

static const JUUIDrndm ()
 Generate random UUID. More...
 
static JUUID valueOf (const std::string &buffer)
 Extract UUID. More...
 

Public Attributes

uuid_t uuid
 

Static Public Attributes

static const int BUFFER_SIZE = 36
 number of characters for I/O of uuid_t without trailing '\0', see e.g. man uuid_parse More...
 

Friends

std::istream & operator>> (std::istream &in, JUUID &object)
 Read object identifier from input. More...
 
std::ostream & operator<< (std::ostream &out, const JUUID &object)
 Write object identifier to output. More...
 

Detailed Description

Simple wrapper for UUID.

Definition at line 22 of file JUUID.hh.

Constructor & Destructor Documentation

JLANG::JUUID::JUUID ( )
inline

Default constructor.

Definition at line 32 of file JUUID.hh.

33  {
34  clear();
35  }
void clear()
Clear UUID.
Definition: JUUID.hh:100
JLANG::JUUID::JUUID ( const uuid_t &  object)
inline

Copy constructor.

Parameters
objectUUID

Definition at line 43 of file JUUID.hh.

44  {
45  uuid_copy(this->uuid, object);
46  }
uuid_t uuid
Definition: JUUID.hh:172
JLANG::JUUID::JUUID ( const JUUID object)
inline

Copy constructor.

Parameters
objectUUID

Definition at line 54 of file JUUID.hh.

55  {
56  uuid_copy(this->uuid, object.uuid);
57  }
uuid_t uuid
Definition: JUUID.hh:172

Member Function Documentation

const JUUID& JLANG::JUUID::operator() ( )
inline

Randomizde this UUID.

Returns
this UUID

Definition at line 65 of file JUUID.hh.

66  {
67  uuid_generate_random(this->uuid);
68 
69  return *this;
70  }
uuid_t uuid
Definition: JUUID.hh:172
static const JUUID& JLANG::JUUID::rndm ( )
inlinestatic

Generate random UUID.

Returns
UUID

Definition at line 78 of file JUUID.hh.

79  {
80  static JUUID id;
81 
82  return id();
83  }
Simple wrapper for UUID.
Definition: JUUID.hh:22
bool JLANG::JUUID::is_valid ( ) const
inline

Check validity.

Returns
true if valid; else false

Definition at line 91 of file JUUID.hh.

92  {
93  return uuid_is_null(this->uuid) == 0;
94  }
uuid_t uuid
Definition: JUUID.hh:172
void JLANG::JUUID::clear ( )
inline

Clear UUID.

Definition at line 100 of file JUUID.hh.

101  {
102  return uuid_clear(this->uuid);
103  }
uuid_t uuid
Definition: JUUID.hh:172
bool JLANG::JUUID::less ( const JUUID object) const
inline

Less than method.

Parameters
objectUUID
Returns
true if this UUID less than given UUID; else false

Definition at line 112 of file JUUID.hh.

113  {
114  return uuid_compare(this->uuid, object.uuid) < 0;
115  }
uuid_t uuid
Definition: JUUID.hh:172
static JUUID JLANG::JUUID::valueOf ( const std::string buffer)
inlinestatic

Extract UUID.

Parameters
bufferUUID
Returns
UUID

Definition at line 124 of file JUUID.hh.

125  {
126  JUUID object;
127 
128  uuid_parse(buffer.c_str(), object.uuid);
129 
130  return object;
131  }
Simple wrapper for UUID.
Definition: JUUID.hh:22

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JUUID object 
)
friend

Read object identifier from input.

Parameters
ininput stream
objectobject identifier
Returns
input stream

Definition at line 141 of file JUUID.hh.

142  {
143  char buffer[BUFFER_SIZE + 1];
144 
145  if (in.read(buffer, BUFFER_SIZE)) {
146 
147  buffer[BUFFER_SIZE] = '\0';
148 
149  uuid_parse(buffer, object.uuid);
150  }
151 
152  return in;
153  }
static const int BUFFER_SIZE
number of characters for I/O of uuid_t without trailing &#39;\0&#39;, see e.g. man uuid_parse ...
Definition: JUUID.hh:26
uuid_t uuid
Definition: JUUID.hh:172
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
std::ostream& operator<< ( std::ostream &  out,
const JUUID object 
)
friend

Write object identifier to output.

Parameters
outoutput stream
objectobject identifier
Returns
output stream

Definition at line 163 of file JUUID.hh.

164  {
165  char buffer[BUFFER_SIZE + 1];
166 
167  uuid_unparse_lower(object.uuid, buffer);
168 
169  return out.write(buffer, BUFFER_SIZE);
170  }
static const int BUFFER_SIZE
number of characters for I/O of uuid_t without trailing &#39;\0&#39;, see e.g. man uuid_parse ...
Definition: JUUID.hh:26
uuid_t uuid
Definition: JUUID.hh:172

Member Data Documentation

const int JLANG::JUUID::BUFFER_SIZE = 36
static

number of characters for I/O of uuid_t without trailing '\0', see e.g. man uuid_parse

Definition at line 26 of file JUUID.hh.

uuid_t JLANG::JUUID::uuid

Definition at line 172 of file JUUID.hh.


The documentation for this struct was generated from the following file: