CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
ora::OId Class Reference

#include <OId.h>

Public Member Functions

int containerId () const
 
bool fromString (const std::string &s)
 
bool isInvalid () const
 
int itemId () const
 
 OId ()
 
 OId (const std::pair< int, int > &oidPair)
 
 OId (int contId, int itemId)
 
 OId (const OId &rhs)
 
bool operator!= (const OId &rhs) const
 
OIdoperator= (const OId &rhs)
 
bool operator== (const OId &rhs) const
 
void reset ()
 
void toOutputStream (std::ostream &os) const
 
std::pair< int, int > toPair () const
 
std::string toString () const
 

Static Public Member Functions

static bool isOId (const std::string &input)
 

Private Attributes

int m_containerId
 
int m_itemId
 

Detailed Description

Definition at line 8 of file OId.h.

Constructor & Destructor Documentation

ora::OId::OId ( )

Definition at line 14 of file OId.cc.

14  :
15  m_containerId(-1),
16  m_itemId(-1){
17 }
int m_containerId
Definition: OId.h:46
int m_itemId
Definition: OId.h:47
ora::OId::OId ( const std::pair< int, int > &  oidPair)
explicit

Definition at line 19 of file OId.cc.

19  :
20  m_containerId( oidPair.first ),
21  m_itemId( oidPair.second ){
22 }
int m_containerId
Definition: OId.h:46
int m_itemId
Definition: OId.h:47
ora::OId::OId ( int  contId,
int  itemId 
)

Definition at line 24 of file OId.cc.

24  :
25  m_containerId( contId),
26  m_itemId( itemId ){
27 }
int m_containerId
Definition: OId.h:46
int m_itemId
Definition: OId.h:47
int itemId() const
Definition: OId.cc:54
ora::OId::OId ( const OId rhs)

Definition at line 29 of file OId.cc.

29  :
30  m_containerId( rhs.m_containerId),
31  m_itemId( rhs.m_itemId ){
32 }
int m_containerId
Definition: OId.h:46
int m_itemId
Definition: OId.h:47

Member Function Documentation

int ora::OId::containerId ( ) const
bool ora::OId::fromString ( const std::string &  s)

Definition at line 64 of file OId.cc.

References OIDFMT, and OIDSIZ.

Referenced by cond::MetaData::addMapping(), cond::PoolTokenParser::className(), cond::DbSession::classNameForItem(), cond::DbSession::deleteObject(), cond::DbSession::getObject(), cond::DbSession::getTypedObject(), cond::IOVImportIterator::importMoreElements(), cond::DbSession::importObject(), cond::IOVElement::IOVElement(), isOId(), and cond::DbSession::updateObject().

64  {
65  if(source.size()>OIDSIZ) return false; // constraint relaxed...
66  const char* ptr = source.c_str();
67  if( ::sscanf( ptr, OIDFMT, &m_containerId, &m_itemId )==2 ) return true;
68  return false;
69 }
int m_containerId
Definition: OId.h:46
static const size_t OIDSIZ
Definition: OId.cc:7
static const char * OIDFMT
Definition: OId.cc:6
int m_itemId
Definition: OId.h:47
bool ora::OId::isInvalid ( ) const

Definition at line 80 of file OId.cc.

Referenced by cond::DbSession::classNameForItem(), and cond::IOVElement::swapOId().

80  {
81  return (m_containerId == -1 || m_itemId == -1);
82 }
int m_containerId
Definition: OId.h:46
int m_itemId
Definition: OId.h:47
bool ora::OId::isOId ( const std::string &  input)
static

Definition at line 9 of file OId.cc.

References fromString(), and tmp.

9  {
10  ora::OId tmp;
11  return tmp.fromString( input );
12 }
Definition: OId.h:8
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
bool fromString(const std::string &s)
Definition: OId.cc:64
int ora::OId::itemId ( ) const
bool ora::OId::operator!= ( const OId rhs) const

Definition at line 46 of file OId.cc.

References operator==().

46  {
47  return !operator==(rhs);
48 }
bool operator==(const OId &rhs) const
Definition: OId.cc:40
ora::OId & ora::OId::operator= ( const OId rhs)

Definition at line 34 of file OId.cc.

References m_containerId, and m_itemId.

34  {
35  m_containerId = rhs.m_containerId;
36  m_itemId = rhs.m_itemId;
37  return *this;
38 }
int m_containerId
Definition: OId.h:46
int m_itemId
Definition: OId.h:47
bool ora::OId::operator== ( const OId rhs) const

Definition at line 40 of file OId.cc.

References m_containerId, and m_itemId.

40  {
41  if(m_containerId != rhs.m_containerId ) return false;
42  if(m_itemId != rhs.m_itemId ) return false;
43  return true;
44 }
int m_containerId
Definition: OId.h:46
int m_itemId
Definition: OId.h:47
void ora::OId::reset ( void  )

Definition at line 75 of file OId.cc.

Referenced by MatrixReader.MatrixReader::__init__(), and MatrixReader.MatrixReader::showRaw().

75  {
76  m_containerId = -1;
77  m_itemId = -1;
78 }
int m_containerId
Definition: OId.h:46
int m_itemId
Definition: OId.h:47
void ora::OId::toOutputStream ( std::ostream &  os) const

Definition at line 71 of file OId.cc.

References toString().

Referenced by operator<<().

71  {
72  os << this->toString();
73 }
std::string toString() const
Definition: OId.cc:58
std::pair< int, int > ora::OId::toPair ( ) const

Definition at line 84 of file OId.cc.

84  {
85  return std::make_pair( m_containerId, m_itemId );
86 }
int m_containerId
Definition: OId.h:46
int m_itemId
Definition: OId.h:47
std::string ora::OId::toString ( ) const

Definition at line 58 of file OId.cc.

References OIDFMT, OIDSIZ, and runonSM::text.

Referenced by cond::MetaData::getToken(), cond::DbSession::storeObject(), and cond::IOVElement::token().

58  {
59  char text[OIDSIZ];
60  ::snprintf(text, OIDSIZ, OIDFMT, m_containerId, m_itemId );
61  return std::string(text);
62 }
int m_containerId
Definition: OId.h:46
static const size_t OIDSIZ
Definition: OId.cc:7
tuple text
Definition: runonSM.py:42
static const char * OIDFMT
Definition: OId.cc:6
int m_itemId
Definition: OId.h:47

Member Data Documentation

int ora::OId::m_containerId
private

Definition at line 46 of file OId.h.

Referenced by operator=(), and operator==().

int ora::OId::m_itemId
private

Definition at line 47 of file OId.h.

Referenced by operator=(), and operator==().