Jpp
 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 JUUID &object)
 Copy constructor. More...
 
const JUUIDoperator() ()
 Randomizde this UUID. More...
 
bool is_valid () const
 Clear UUID. More...
 
void clear ()
 Check validity. 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 of uuid_t without trailing '\0' 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()
Check validity.
Definition: JUUID.hh:89
JLANG::JUUID::JUUID ( const JUUID object)
inline

Copy constructor.

Parameters
objectUUID

Definition at line 43 of file JUUID.hh.

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

Member Function Documentation

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

Randomizde this UUID.

Returns
this UUID

Definition at line 54 of file JUUID.hh.

55  {
56  uuid_generate_random(this->uuid);
57 
58  return *this;
59  }
uuid_t uuid
Definition: JUUID.hh:161
static const JUUID& JLANG::JUUID::rndm ( )
inlinestatic

Generate random UUID.

Returns
UUID

Definition at line 67 of file JUUID.hh.

68  {
69  static JUUID id;
70 
71  return id();
72  }
Simple wrapper for UUID.
Definition: JUUID.hh:22
bool JLANG::JUUID::is_valid ( ) const
inline

Clear UUID.

Returns
true if valid; else false

Definition at line 80 of file JUUID.hh.

81  {
82  return uuid_is_null(this->uuid) == 0;
83  }
uuid_t uuid
Definition: JUUID.hh:161
void JLANG::JUUID::clear ( )
inline

Check validity.

Definition at line 89 of file JUUID.hh.

90  {
91  return uuid_clear(this->uuid);
92  }
uuid_t uuid
Definition: JUUID.hh:161
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 101 of file JUUID.hh.

102  {
103  return uuid_compare(this->uuid, object.uuid) < 0;
104  }
uuid_t uuid
Definition: JUUID.hh:161
static JUUID JLANG::JUUID::valueOf ( const std::string &  buffer)
inlinestatic

Extract UUID.

Parameters
bufferUUID
Returns
UUID

Definition at line 113 of file JUUID.hh.

114  {
115  JUUID object;
116 
117  uuid_parse(buffer.c_str(), object.uuid);
118 
119  return object;
120  }
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 130 of file JUUID.hh.

131  {
132  char buffer[BUFFER_SIZE + 1];
133 
134  if (in.read(buffer, BUFFER_SIZE)) {
135 
136  buffer[BUFFER_SIZE] = '\0';
137 
138  uuid_parse(buffer, object.uuid);
139  }
140 
141  return in;
142  }
static const int BUFFER_SIZE
number of characters of uuid_t without trailing &#39;\0&#39;
Definition: JUUID.hh:26
uuid_t uuid
Definition: JUUID.hh:161
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 source JAcoustics sh $DETECTOR_ID typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:36
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 152 of file JUUID.hh.

153  {
154  char buffer[BUFFER_SIZE + 1];
155 
156  uuid_unparse_lower(object.uuid, buffer);
157 
158  return out.write(buffer, BUFFER_SIZE);
159  }
static const int BUFFER_SIZE
number of characters of uuid_t without trailing &#39;\0&#39;
Definition: JUUID.hh:26
uuid_t uuid
Definition: JUUID.hh:161

Member Data Documentation

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

number of characters of uuid_t without trailing '\0'

Definition at line 26 of file JUUID.hh.

uuid_t JLANG::JUUID::uuid

Definition at line 161 of file JUUID.hh.


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