Jpp  19.1.0
the software that should make you happy
Functions
JUUID.cc File Reference

Example program to test UUID. More...

#include <string>
#include <iostream>
#include <sstream>
#include <iomanip>
#include "JLang/JUUID.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to test UUID.

Author
mdejong

Definition in file JUUID.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 18 of file JUUID.cc.

19 {
20  using namespace std;
21  using namespace JPP;
22 
23  int debug;
24 
25  try {
26 
27  JParser<> zap("Example program to test UUID.");
28 
29  zap['d'] = make_field(debug) = 3;
30 
31  zap(argc, argv);
32  }
33  catch(const exception& error) {
34  FATAL(error.what() << endl);
35  }
36 
37 
38  JUUID id1;
39 
40  ASSERT(!id1.is_valid(), "Test invalidity of UUID.");
41 
42  id1();
43 
44  ASSERT(id1.is_valid(), "Test validity of UUID.");
45 
46  JUUID id2(id1);
47 
48  ASSERT(id1 == id2, "Test inequality of UUIDs.");
49 
50  stringstream io;
51 
52  io << id1;
53 
54  JUUID id3;
55 
56  ASSERT(id1 != id3, "Test inequality of UUIDs.");
57 
58  io >> id3;
59 
60  ASSERT(id1 == id3, "Test inequality of UUIDs.");
61 
62  id3.clear();
63 
64  ASSERT(!id3.is_valid(), "Test invalidity of UUID.");
65 
66  return 0;
67 }
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
Utility class to parse command line options.
Definition: JParser.hh:1698
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
Simple wrapper for UUID.
Definition: JUUID.hh:24
bool is_valid() const
Check validity.
Definition: JUUID.hh:91
void clear()
Clear UUID.
Definition: JUUID.hh:100