CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
edm::eventsetup::DataKey Class Reference

#include <DataKey.h>

Public Types

enum  DoNotCopyMemory { kDoNotCopyMemory }
 

Public Member Functions

 DataKey ()
 
 DataKey (const TypeTag &iType, const IdTags &iId)
 
 DataKey (const TypeTag &iType, const IdTags &iId, DoNotCopyMemory)
 
 DataKey (const DataKey &iRHS)
 
 DataKey (DataKey &&iRHS)
 
const NameTagname () const
 
bool operator!= (const DataKey &iRHS) const
 
bool operator< (const DataKey &iRHS) const
 
DataKeyoperator= (const DataKey &)
 
DataKeyoperator= (DataKey &&)
 
bool operator== (const DataKey &iRHS) const
 
const TypeTagtype () const
 
 ~DataKey ()
 

Static Public Member Functions

template<class T >
static TypeTag makeTypeTag ()
 

Private Member Functions

void deleteMemory ()
 
void makeCopyOfMemory ()
 
void releaseMemory ()
 
void swap (DataKey &)
 

Private Attributes

NameTag name_ {}
 
bool ownMemory_ {false}
 
TypeTag type_ {}
 

Friends

void swap (DataKey &, DataKey &)
 

Detailed Description

Definition at line 29 of file DataKey.h.

Member Enumeration Documentation

Enumerator
kDoNotCopyMemory 

Definition at line 33 of file DataKey.h.

Constructor & Destructor Documentation

DataKey::DataKey ( )
default
edm::eventsetup::DataKey::DataKey ( const TypeTag iType,
const IdTags iId 
)
inline

Definition at line 36 of file DataKey.h.

References makeCopyOfMemory().

36 : type_(iType), name_(iId), ownMemory_() { makeCopyOfMemory(); }
edm::eventsetup::DataKey::DataKey ( const TypeTag iType,
const IdTags iId,
DoNotCopyMemory   
)
inline

Definition at line 38 of file DataKey.h.

38 : type_(iType), name_(iId), ownMemory_(false) {}
edm::eventsetup::DataKey::DataKey ( const DataKey iRHS)
inline

Definition at line 40 of file DataKey.h.

References makeCopyOfMemory().

40 : type_(iRHS.type_), name_(iRHS.name_), ownMemory_() { makeCopyOfMemory(); }
edm::eventsetup::DataKey::DataKey ( DataKey &&  iRHS)
inline

Definition at line 42 of file DataKey.h.

42  : type_(iRHS.type_), name_(iRHS.name_), ownMemory_(iRHS.ownMemory_) {
43  iRHS.ownMemory_ = false;
44  }
edm::eventsetup::DataKey::~DataKey ( )
inline

Definition at line 49 of file DataKey.h.

References releaseMemory().

49 { releaseMemory(); }

Member Function Documentation

void DataKey::deleteMemory ( )
private

Definition at line 100 of file DataKey.cc.

References name(), edm::eventsetup::SimpleStringTag::value(), and relativeConstraints::value.

Referenced by releaseMemory().

100  {
101  if (kBlank[0] != name().value()[0]) {
102  delete[] const_cast<char*>(name().value());
103  }
104  }
const NameTag & name() const
Definition: DataKey.h:53
const char * value() const
Definition: DataKeyTags.h:39
void DataKey::makeCopyOfMemory ( )
private

Definition at line 80 of file DataKey.cc.

References name(), name_, ownMemory_, submitPVValidationJobs::t, edm::eventsetup::SimpleStringTag::value(), and relativeConstraints::value.

Referenced by DataKey().

80  {
81  //empty string is the most common case, so handle it special
82 
83  char* pName = const_cast<char*>(kBlank);
84  //NOTE: if in the future additional tags are added then
85  // I should make sure that pName gets deleted in the case
86  // where an exception is thrown
87  ArrayHolder pNameHolder;
88  if (kBlank[0] != name().value()[0]) {
89  size_t const nBytes = std::strlen(name().value()) + 1;
90  pName = new char[nBytes];
91  ArrayHolder t(pName);
92  pNameHolder.swap(t);
93  std::strncpy(pName, name().value(), nBytes);
94  }
95  name_ = NameTag(pName);
96  ownMemory_ = true;
97  pNameHolder.release();
98  }
const NameTag & name() const
Definition: DataKey.h:53
const char * value() const
Definition: DataKeyTags.h:39
template<class T >
static TypeTag edm::eventsetup::DataKey::makeTypeTag ( )
inlinestatic

Definition at line 61 of file DataKey.h.

61  {
62  return heterocontainer::HCTypeTag::make<T>();
63  }
const NameTag& edm::eventsetup::DataKey::name ( void  ) const
inline
bool edm::eventsetup::DataKey::operator!= ( const DataKey iRHS) const
inline

Definition at line 56 of file DataKey.h.

56 { return not(*this == iRHS); }
bool DataKey::operator< ( const DataKey iRHS) const

Definition at line 111 of file DataKey.cc.

References name_, and type_.

111  {
112  return (type_ < iRHS.type_) || ((type_ == iRHS.type_) && (name_ < iRHS.name_));
113  }
DataKey & DataKey::operator= ( const DataKey rhs)

Definition at line 32 of file DataKey.cc.

References swap, and groupFilesInBlocks::temp.

32  {
33  //An exception safe implementation is
34  DataKey temp(rhs);
35  swap(temp);
36 
37  return *this;
38  }
friend void swap(DataKey &, DataKey &)
Definition: DataKey.h:85
DataKey & DataKey::operator= ( DataKey &&  rhs)

Definition at line 40 of file DataKey.cc.

References eostools::move(), swap, and groupFilesInBlocks::temp.

40  {
41  //An exception safe implementation is
42  DataKey temp(std::move(rhs));
43  swap(temp);
44 
45  return *this;
46  }
def move
Definition: eostools.py:511
friend void swap(DataKey &, DataKey &)
Definition: DataKey.h:85
bool DataKey::operator== ( const DataKey iRHS) const

Definition at line 109 of file DataKey.cc.

References name_, and type_.

109 { return ((type_ == iRHS.type_) && (name_ == iRHS.name_)); }
void edm::eventsetup::DataKey::releaseMemory ( )
inlineprivate

Definition at line 69 of file DataKey.h.

References deleteMemory(), and ownMemory_.

Referenced by ~DataKey().

69  {
70  if (ownMemory_) {
71  deleteMemory();
72  ownMemory_ = false;
73  }
74  }
void DataKey::swap ( DataKey iOther)
private

Definition at line 51 of file DataKey.cc.

References name_, ownMemory_, swap, std::swap(), and type_.

51  {
52  std::swap(ownMemory_, iOther.ownMemory_);
53  // unqualified swap is used for user defined classes.
54  // The using directive is needed so that std::swap will be used if there is no other matching swap.
55  using std::swap;
56  swap(type_, iOther.type_);
57  swap(name_, iOther.name_);
58  }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
friend void swap(DataKey &, DataKey &)
Definition: DataKey.h:85
const TypeTag& edm::eventsetup::DataKey::type ( ) const
inline

Friends And Related Function Documentation

void swap ( DataKey a,
DataKey b 
)
friend

Definition at line 85 of file DataKey.h.

Referenced by operator=(), swap(), and edm::eventsetup::swap().

85 { a.swap(b); }

Member Data Documentation

NameTag edm::eventsetup::DataKey::name_ {}
private

Definition at line 80 of file DataKey.h.

Referenced by makeCopyOfMemory(), name(), operator<(), operator==(), and swap().

bool edm::eventsetup::DataKey::ownMemory_ {false}
private

Definition at line 81 of file DataKey.h.

Referenced by makeCopyOfMemory(), releaseMemory(), and swap().

TypeTag edm::eventsetup::DataKey::type_ {}
private