CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ora::Container Class Reference

#include <Container.h>

List of all members.

Public Member Functions

const std::string & className ()
 Container ()
 Container (Handle< DatabaseContainer > &dbContainer)
 Container (const Container &rhs)
void erase (int itemId)
void extendSchema (const std::type_info &typeInfo)
template<typename T >
void extendSchema ()
template<typename T >
boost::shared_ptr< Tfetch (int itemId)
Object fetchItem (int itemId)
void flush ()
bool getNames (std::vector< std::string > &destination)
int id ()
template<typename T >
int insert (const T &data)
int insertItem (const Object &data)
bool isLocked ()
ContainerIterator iterator ()
bool lock ()
const std::string & mappingVersion ()
const std::string & name ()
Containeroperator= (const Container &rhs)
void setAccessPermission (const std::string &principal, bool forWrite)
void setItemName (const std::string &name, int itemId)
size_t size ()
template<typename T >
void update (int itemId, const T &data)
void updateItem (int itemId, const Object &data)
virtual ~Container ()

Private Member Functions

boost::shared_ptr< void > fetchItemAsType (int itemId, const std::type_info &asTypeInfo)
int insertItem (const void *data, const std::type_info &typeInfo)
void updateItem (int itemId, const void *data, const std::type_info &typeInfo)

Private Attributes

Handle< DatabaseContainerm_dbContainer

Detailed Description

Definition at line 47 of file Container.h.


Constructor & Destructor Documentation

ora::Container::Container ( )

Definition at line 47 of file Container.cc.

                       :
  m_dbContainer(){
}
ora::Container::Container ( Handle< DatabaseContainer > &  dbContainer) [explicit]

Definition at line 51 of file Container.cc.

                                                               :
  m_dbContainer( dbContainer ){
}
ora::Container::Container ( const Container rhs)

Definition at line 55 of file Container.cc.

                                             :
  m_dbContainer( rhs.m_dbContainer ){
}
ora::Container::~Container ( ) [virtual]

Definition at line 59 of file Container.cc.

                        {
}

Member Function Documentation

const std::string & ora::Container::className ( )
void ora::Container::erase ( int  itemId)

Definition at line 154 of file Container.cc.

Referenced by cond::IOVService::deleteAll(), and ora::Database::erase().

                                    {
  m_dbContainer->erase(itemId );
}
template<typename T >
void ora::Container::extendSchema ( ) [inline]

Definition at line 121 of file Container.h.

                               {
  extendSchema( typeid(T) );
}
void ora::Container::extendSchema ( const std::type_info &  typeInfo)

Definition at line 92 of file Container.cc.

References ora::ClassUtils::lookupDictionary().

                                                             {
  Reflex::Type type = ClassUtils::lookupDictionary( typeInfo );
  m_dbContainer->extendSchema( type );
}
template<typename T >
boost::shared_ptr< T > ora::Container::fetch ( int  itemId) [inline]

Definition at line 127 of file Container.h.

Referenced by ora::Database::fetch().

                                                 {
  return boost::static_pointer_cast<T>( fetchItemAsType( itemId, typeid(T) ));
}
ora::Object ora::Container::fetchItem ( int  itemId)

Definition at line 102 of file Container.cc.

Referenced by ora::Database::fetchItem().

                                           {
  return Object( m_dbContainer->fetchItem(itemId), m_dbContainer->type() );
}
boost::shared_ptr< void > ora::Container::fetchItemAsType ( int  itemId,
const std::type_info &  asTypeInfo 
) [private]

Definition at line 106 of file Container.cc.

References ora::ClassUtils::lookupDictionary().

                                                                                       {
  Reflex::Type asType = ClassUtils::lookupDictionary( asTypeInfo );
  void* ptr = m_dbContainer->fetchItemAsType(itemId, asType );
  if(!ptr) return boost::shared_ptr<void>();
  return boost::shared_ptr<void>( ptr, RflxDeleter( m_dbContainer->type() ) );
}
void ora::Container::flush ( )

Definition at line 158 of file Container.cc.

Referenced by cond::IOVService::deleteAll().

                        {
  m_dbContainer->flush();
}
bool ora::Container::getNames ( std::vector< std::string > &  destination)

Definition at line 167 of file Container.cc.

                                                              {
  return m_dbContainer->getNames( destination );
}
int ora::Container::id ( void  )

Definition at line 67 of file Container.cc.

Referenced by ora::Database::insert(), ora::Database::insertItem(), and cond::PoolTokenParser::parse().

                    {
  return m_dbContainer->id();
}
template<typename T >
int ora::Container::insert ( const T data) [inline]

Definition at line 133 of file Container.h.

Referenced by ora::Database::insert().

                                       {
  return insertItem( &data, typeid( data ) );
}
int ora::Container::insertItem ( const void *  data,
const std::type_info &  typeInfo 
) [private]

Definition at line 131 of file Container.cc.

References ora::ClassUtils::lookupDictionary().

                                                                       {
  Reflex::Type type = ClassUtils::lookupDictionary( typeInfo );
  return m_dbContainer->insertItem( data, type );
}
int ora::Container::insertItem ( const Object data)

Definition at line 122 of file Container.cc.

References ora::Object::address(), ora::throwException(), and ora::Object::type().

Referenced by ora::Database::insertItem().

                                                {
  const Reflex::Type& objType = data.type();
  if(!objType){
    throwException("Object class has not been found in the dictionary.",
                   "Container::insertItem");
  }
  return m_dbContainer->insertItem( data.address(), objType );
}
bool ora::Container::isLocked ( )

Definition at line 118 of file Container.cc.

                           {
  return m_dbContainer->isLocked();
}
ora::ContainerIterator ora::Container::iterator ( )

Definition at line 87 of file Container.cc.

Referenced by cond::IOVService::deleteAll().

                                           {
  Handle<IteratorBuffer> buff = m_dbContainer->iteratorBuffer();
  return ContainerIterator( buff );
}
bool ora::Container::lock ( )

Definition at line 114 of file Container.cc.

                       {
  return m_dbContainer->lock();
}
const std::string & ora::Container::mappingVersion ( )

Definition at line 79 of file Container.cc.

                                             {
  return m_dbContainer->mappingVersion();
}
const std::string & ora::Container::name ( )

Definition at line 71 of file Container.cc.

Referenced by cond::DbSession::importObject(), and cond::PoolTokenWriter::write().

                                   {
  return m_dbContainer->name();
}
ora::Container & ora::Container::operator= ( const Container rhs)

Definition at line 62 of file Container.cc.

References m_dbContainer.

                                                           {
  if(this != &rhs ) m_dbContainer = rhs.m_dbContainer;
  return *this;  
}
void ora::Container::setAccessPermission ( const std::string &  principal,
bool  forWrite 
)

Definition at line 97 of file Container.cc.

Referenced by cond::IOVSchemaUtility::createIOVContainerIfNecessary(), and cond::IOVSchemaUtility::createPayloadContainer().

                                                         {
  m_dbContainer->setAccessPermission( principal, forWrite );
}
void ora::Container::setItemName ( const std::string &  name,
int  itemId 
)

Definition at line 162 of file Container.cc.

                                              {
  m_dbContainer->setItemName( name, itemId );
}
size_t ora::Container::size ( void  )

Definition at line 83 of file Container.cc.

                         {
  return m_dbContainer->size();
}
template<typename T >
void ora::Container::update ( int  itemId,
const T data 
) [inline]

Definition at line 139 of file Container.h.

Referenced by ora::Database::update().

                                                    {
  return updateItem( itemId, &data, typeid( data ) );
}
void ora::Container::updateItem ( int  itemId,
const Object data 
)

Definition at line 137 of file Container.cc.

References ora::Object::address(), ora::throwException(), and ora::Object::type().

Referenced by ora::Database::updateItem().

                                                     {
  const Reflex::Type& objType = data.type();
  if(!objType){
    throwException("Object class has not been found in the dictionary.",
                   "Container::updateItem");
  }
  return m_dbContainer->updateItem( itemId, data.address(), objType );
}
void ora::Container::updateItem ( int  itemId,
const void *  data,
const std::type_info &  typeInfo 
) [private]

Definition at line 147 of file Container.cc.

References ora::ClassUtils::lookupDictionary().

                                                               {
  Reflex::Type type = ClassUtils::lookupDictionary( typeInfo );
  m_dbContainer->updateItem( itemId, data, type );
}

Member Data Documentation

Definition at line 110 of file Container.h.

Referenced by operator=().