CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends

edm::eventsetup::DataKey Class Reference

#include <DataKey.h>

List of all members.

Public Types

enum  DoNotCopyMemory { kDoNotCopyMemory }

Public Member Functions

 DataKey ()
 DataKey (const TypeTag &iType, const IdTags &iId)
 DataKey (const DataKey &iRHS)
 DataKey (const TypeTag &iType, const IdTags &iId, DoNotCopyMemory)
const NameTagname () const
bool operator< (const DataKey &iRHS) const
DataKeyoperator= (const 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_
TypeTag type_

Friends

void swap (DataKey &, DataKey &)

Detailed Description

Definition at line 30 of file DataKey.h.


Member Enumeration Documentation

Enumerator:
kDoNotCopyMemory 

Definition at line 35 of file DataKey.h.


Constructor & Destructor Documentation

DataKey::DataKey ( )

Definition at line 36 of file DataKey.cc.

                : type_(), name_(), ownMemory_(false)
{
}
edm::eventsetup::DataKey::DataKey ( const TypeTag iType,
const IdTags iId 
) [inline]

Definition at line 38 of file DataKey.h.

References makeCopyOfMemory().

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

Definition at line 46 of file DataKey.h.

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

Definition at line 53 of file DataKey.h.

References makeCopyOfMemory().

                                   : 
         type_(iRHS.type_),
         name_(iRHS.name_),
         ownMemory_() {
           makeCopyOfMemory();
         }
edm::eventsetup::DataKey::~DataKey ( ) [inline]

Definition at line 62 of file DataKey.h.

References releaseMemory().


Member Function Documentation

void DataKey::deleteMemory ( ) [private]

Definition at line 116 of file DataKey.cc.

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

Referenced by releaseMemory().

{
   if(kBlank[0] != name().value()[0]) {
      delete [] const_cast<char*>(name().value());
   }
}
void DataKey::makeCopyOfMemory ( ) [private]

Definition at line 94 of file DataKey.cc.

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

Referenced by DataKey().

{
   //empty string is the most common case, so handle it special
   
   char* pName = const_cast<char*>(kBlank);
   //NOTE: if in the future additional tags are added then 
   // I should make sure that pName gets deleted in the case
   // where an exception is thrown
   ArrayHolder pNameHolder;
   if(kBlank[0] != name().value()[0]) {
      size_t const nBytes = std::strlen(name().value()) + 1;
      pName = new char[nBytes];
      ArrayHolder t(pName);
      pNameHolder.swap(t);
      std::strncpy(pName, name().value(), nBytes);
   }
   name_ = NameTag(pName);
   ownMemory_ = true;
   pNameHolder.release();
}
template<class T >
static TypeTag edm::eventsetup::DataKey::makeTypeTag ( ) [inline, static]

Definition at line 73 of file DataKey.h.

                                      {
            return heterocontainer::HCTypeTag::make<T>();
         }
const NameTag& edm::eventsetup::DataKey::name ( void  ) const [inline]
bool DataKey::operator< ( const DataKey iRHS) const

Definition at line 134 of file DataKey.cc.

References name_, and type_.

{
   return (type_ < iRHS.type_) ||
   ((type_ == iRHS.type_) && (name_ < iRHS.name_));
/*
   if(type_ < iRHS.type_) {
      return true;
   } else if (type_ == iRHS.type_) {
      if(name_ < iRHS.name_) {
         return true;
   }
   return false;
      */
}
DataKey & DataKey::operator= ( const DataKey rhs)

Definition at line 52 of file DataKey.cc.

References swap, and groupFilesInBlocks::temp.

{
   //An exception safe implementation is
   DataKey temp(rhs);
   swap(temp);

   return *this;
}
bool DataKey::operator== ( const DataKey iRHS) const

Definition at line 127 of file DataKey.cc.

References name_, and type_.

{
   return ((type_ == iRHS.type_) &&
            (name_ == iRHS.name_));
}
void edm::eventsetup::DataKey::releaseMemory ( ) [inline, private]

Definition at line 81 of file DataKey.h.

References deleteMemory(), and ownMemory_.

Referenced by ~DataKey().

                           {
         if(ownMemory_) {
            deleteMemory();
            ownMemory_ = false;
         }
      }
void DataKey::swap ( DataKey iOther) [private]

Definition at line 65 of file DataKey.cc.

References name_, ownMemory_, swap, and type_.

{
   std::swap(ownMemory_, iOther.ownMemory_);
   // unqualified swap is used for user defined classes.
   // The using directive is needed so that std::swap will be used if there is no other matching swap.
   using std::swap;
   swap(type_, iOther.type_);
   swap(name_, iOther.name_);
}
const TypeTag& edm::eventsetup::DataKey::type ( ) const [inline]

Friends And Related Function Documentation

void swap ( DataKey a,
DataKey b 
) [friend]

Definition at line 99 of file DataKey.h.

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

    {
      a.swap(b);
    }

Member Data Documentation

Definition at line 92 of file DataKey.h.

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

Definition at line 93 of file DataKey.h.

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

Definition at line 91 of file DataKey.h.

Referenced by operator<(), operator==(), swap(), and type().