| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

DayaBay::JobId Class Reference

Uniquely identify an execution of a NuWa job. More...

#include <JobId.h>

List of all members.


Public Member Functions

 JobId ()
 Create default (null ID).
 JobId (const std::string &uuid)
 Create JobId based on UUID string.
virtual ~JobId ()
 Destructor.
 JobId (const DayaBay::JobId &jobId)
 Copy Constructor.
DayaBay::JobIdoperator= (const DayaBay::JobId &jobId)
 Assignment Operator.
void set (const std::string &uuid)
 Set JobId based on UUID string.
std::string uuid () const
 Get UUID formatted Job ID.
bool operator== (const DayaBay::JobId &rhs) const
 Comparison Operators.
bool operator!= (const DayaBay::JobId &rhs) const

Private Attributes

unsigned int m_data [4]
 Unique ID data.

Detailed Description

Uniquely identify an execution of a NuWa job.

Definition at line 15 of file JobId.h.


Constructor & Destructor Documentation

DayaBay::JobId::JobId (  ) 

Create default (null ID).

Definition at line 9 of file JobId.cc.

00010 {
00011   m_data[0]=0;
00012   m_data[1]=0;
00013   m_data[2]=0;
00014   m_data[3]=0;
00015 }

DayaBay::JobId::JobId ( const std::string &  uuid  ) 

Create JobId based on UUID string.

Definition at line 17 of file JobId.cc.

00018 {
00019   this->set(uuid);
00020 }

DayaBay::JobId::~JobId (  )  [virtual]

Destructor.

Definition at line 22 of file JobId.cc.

00022 {}

DayaBay::JobId::JobId ( const DayaBay::JobId jobId  ) 

Copy Constructor.

Definition at line 24 of file JobId.cc.

00025 {
00026   // Copy constructor
00027   m_data[0] = jobId.m_data[0];
00028   m_data[1] = jobId.m_data[1];
00029   m_data[2] = jobId.m_data[2];
00030   m_data[3] = jobId.m_data[3];
00031 }


Member Function Documentation

DayaBay::JobId & DayaBay::JobId::operator= ( const DayaBay::JobId jobId  ) 

Assignment Operator.

Assignment Operator

Definition at line 33 of file JobId.cc.

00034 {
00036   m_data[0] = jobId.m_data[0];
00037   m_data[1] = jobId.m_data[1];
00038   m_data[2] = jobId.m_data[2];
00039   m_data[3] = jobId.m_data[3];
00040   return *this;
00041 }

void DayaBay::JobId::set ( const std::string &  uuid  ) 

Set JobId based on UUID string.

Definition at line 56 of file JobId.cc.

00057 {
00058   // Convert job ID string to data vector
00059   // Currently expects a UUID-structured string
00060   m_data[0]=0;
00061   m_data[1]=0;
00062   m_data[2]=0;
00063   m_data[3]=0;
00064   if(uuid.size()!=36 || uuid[8]!='-' || uuid[13]!='-'
00065      || uuid[18]!='-' || uuid[23]!='-'){
00066     // Invalid uuid
00067     return;
00068   }
00069   std::string a,b,c,d;
00070   a = std::string(&uuid[0],8);
00071   b = std::string(&uuid[9],4);
00072   b.append(&uuid[14],4);
00073   c = std::string(&uuid[19],4);
00074   c.append(&uuid[24],4);
00075   d = std::string(&uuid[28],8);
00076   char buffer[16];
00077   char hexTokens[] = "0123456789ABCDEFabcdef";
00078   if(strtok(strcpy(buffer,&a[0]),hexTokens)!=NULL
00079      || strtok(strcpy(buffer,&b[0]),hexTokens)!=NULL
00080      || strtok(strcpy(buffer,&c[0]),hexTokens)!=NULL
00081      || strtok(strcpy(buffer,&d[0]),hexTokens)!=NULL){
00082     // Invalid uuid
00083     return;
00084   }
00085   m_data[0] = strtoul(&a[0],NULL,16);
00086   m_data[1] = strtoul(&b[0],NULL,16);
00087   m_data[2] = strtoul(&c[0],NULL,16);
00088   m_data[3] = strtoul(&d[0],NULL,16);
00089 }

std::string DayaBay::JobId::uuid (  )  const

Get UUID formatted Job ID.

Definition at line 91 of file JobId.cc.

00092 {
00093   // Return a string UUID representation of the job ID
00094   std::ostringstream jobIdHex;
00095   jobIdHex 
00096       << std::hex << std::setw(8) << std::setfill('0') 
00097       << m_data[0]
00098       << std::hex << std::setw(8) << std::setfill('0') 
00099       << m_data[1] 
00100       << std::hex << std::setw(8) << std::setfill('0') 
00101       << m_data[2] 
00102       << std::hex << std::setw(8) << std::setfill('0') 
00103       << m_data[3];
00104   std::string jobIdStr = jobIdHex.str();
00105   jobIdStr.insert(8,"-");
00106   jobIdStr.insert(13,"-");
00107   jobIdStr.insert(18,"-");
00108   jobIdStr.insert(23,"-");
00109   return jobIdStr;
00110 }

bool DayaBay::JobId::operator== ( const DayaBay::JobId rhs  )  const

Comparison Operators.

Definition at line 43 of file JobId.cc.

00044 { 
00045   return (m_data[0] == rhs.m_data[0]
00046           && m_data[1] == rhs.m_data[1]
00047           && m_data[2] == rhs.m_data[2]
00048           && m_data[3] == rhs.m_data[3]);
00049 }

bool DayaBay::JobId::operator!= ( const DayaBay::JobId rhs  )  const

Definition at line 51 of file JobId.cc.

00052 {
00053   return !(*this == rhs);
00054 }


Member Data Documentation

unsigned int DayaBay::JobId::m_data[4] [private]

Unique ID data.

Definition at line 44 of file JobId.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:14:49 2011 for Conventions by doxygen 1.4.7