/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Private Attributes
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.

{
  m_data[0]=0;
  m_data[1]=0;
  m_data[2]=0;
  m_data[3]=0;
}
DayaBay::JobId::JobId ( const std::string &  uuid)

Create JobId based on UUID string.

Definition at line 17 of file JobId.cc.

{
  this->set(uuid);
}
DayaBay::JobId::~JobId ( ) [virtual]

Destructor.

Definition at line 22 of file JobId.cc.

{}
DayaBay::JobId::JobId ( const DayaBay::JobId jobId)

Copy Constructor.

Definition at line 24 of file JobId.cc.

{
  // Copy constructor
  m_data[0] = jobId.m_data[0];
  m_data[1] = jobId.m_data[1];
  m_data[2] = jobId.m_data[2];
  m_data[3] = jobId.m_data[3];
}

Member Function Documentation

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

Assignment Operator.

Assignment Operator

Definition at line 33 of file JobId.cc.

{
  m_data[0] = jobId.m_data[0];
  m_data[1] = jobId.m_data[1];
  m_data[2] = jobId.m_data[2];
  m_data[3] = jobId.m_data[3];
  return *this;
}
void DayaBay::JobId::set ( const std::string &  uuid)

Set JobId based on UUID string.

Definition at line 56 of file JobId.cc.

{
  // Convert job ID string to data vector
  // Currently expects a UUID-structured string
  m_data[0]=0;
  m_data[1]=0;
  m_data[2]=0;
  m_data[3]=0;
  if(uuid.size()!=36 || uuid[8]!='-' || uuid[13]!='-'
     || uuid[18]!='-' || uuid[23]!='-'){
    // Invalid uuid
    return;
  }
  std::string a,b,c,d;
  a = std::string(&uuid[0],8);
  b = std::string(&uuid[9],4);
  b.append(&uuid[14],4);
  c = std::string(&uuid[19],4);
  c.append(&uuid[24],4);
  d = std::string(&uuid[28],8);
  char buffer[16];
  char hexTokens[] = "0123456789ABCDEFabcdef";
  if(strtok(strcpy(buffer,&a[0]),hexTokens)!=NULL
     || strtok(strcpy(buffer,&b[0]),hexTokens)!=NULL
     || strtok(strcpy(buffer,&c[0]),hexTokens)!=NULL
     || strtok(strcpy(buffer,&d[0]),hexTokens)!=NULL){
    // Invalid uuid
    return;
  }
  m_data[0] = strtoul(&a[0],NULL,16);
  m_data[1] = strtoul(&b[0],NULL,16);
  m_data[2] = strtoul(&c[0],NULL,16);
  m_data[3] = strtoul(&d[0],NULL,16);
}
std::string DayaBay::JobId::uuid ( ) const

Get UUID formatted Job ID.

Definition at line 91 of file JobId.cc.

{
  // Return a string UUID representation of the job ID
  std::ostringstream jobIdHex;
  jobIdHex 
      << std::hex << std::setw(8) << std::setfill('0') 
      << m_data[0]
      << std::hex << std::setw(8) << std::setfill('0') 
      << m_data[1] 
      << std::hex << std::setw(8) << std::setfill('0') 
      << m_data[2] 
      << std::hex << std::setw(8) << std::setfill('0') 
      << m_data[3];
  std::string jobIdStr = jobIdHex.str();
  jobIdStr.insert(8,"-");
  jobIdStr.insert(13,"-");
  jobIdStr.insert(18,"-");
  jobIdStr.insert(23,"-");
  return jobIdStr;
}
bool DayaBay::JobId::operator== ( const DayaBay::JobId rhs) const

Comparison Operators.

Definition at line 43 of file JobId.cc.

{ 
  return (m_data[0] == rhs.m_data[0]
          && m_data[1] == rhs.m_data[1]
          && m_data[2] == rhs.m_data[2]
          && m_data[3] == rhs.m_data[3]);
}
bool DayaBay::JobId::operator!= ( const DayaBay::JobId rhs) const

Definition at line 51 of file JobId.cc.

{
  return !(*this == rhs);
}

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 Fri May 16 2014 09:56:20 for Conventions by doxygen 1.7.4