CMS 3D CMS Logo

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

#include <Container.h>

Public Member Functions

const std::string & className ()
 
 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< T > fetch (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)
 
ContainerIterator iterator ()
 
const std::string & mappingVersion ()
 
const std::string & name ()
 
Containeroperator= (const Container &rhs)
 
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 43 of file Container.h.

Constructor & Destructor Documentation

ora::Container::Container ( Handle< DatabaseContainer > &  dbContainer)

Definition at line 43 of file Container.cc.

43  :
44  m_dbContainer( dbContainer ){
45 }
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
ora::Container::Container ( const Container rhs)

Definition at line 47 of file Container.cc.

47  :
48  m_dbContainer( rhs.m_dbContainer ){
49 }
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
ora::Container::~Container ( )
virtual

Definition at line 51 of file Container.cc.

51  {
52 }

Member Function Documentation

const std::string & ora::Container::className ( )

Definition at line 67 of file Container.cc.

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

67  {
68  return m_dbContainer->className();
69 }
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
void ora::Container::erase ( int  itemId)

Definition at line 133 of file Container.cc.

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

133  {
134  m_dbContainer->erase(itemId );
135 }
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
void ora::Container::extendSchema ( const std::type_info &  typeInfo)

Definition at line 84 of file Container.cc.

References ora::ClassUtils::lookupDictionary().

84  {
86  m_dbContainer->extendSchema( type );
87 }
type
Definition: HCALResponse.h:22
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
Reflex::Type lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
Definition: ClassUtils.cc:84
template<typename T >
void ora::Container::extendSchema ( )
inline

Definition at line 111 of file Container.h.

111  {
112  extendSchema( typeid(T) );
113 }
void extendSchema()
Definition: Container.h:111
template<typename T >
boost::shared_ptr< T > ora::Container::fetch ( int  itemId)
inline

Definition at line 117 of file Container.h.

Referenced by ora::Database::fetch(), and cond::DbSession::getTypedObject().

117  {
118  return boost::static_pointer_cast<T>( fetchItemAsType( itemId, typeid(T) ));
119 }
boost::shared_ptr< void > fetchItemAsType(int itemId, const std::type_info &asTypeInfo)
Definition: Container.cc:93
ora::Object ora::Container::fetchItem ( int  itemId)

Definition at line 89 of file Container.cc.

Referenced by ora::Database::fetchItem(), and cond::DbSession::getObject().

89  {
90  return Object( m_dbContainer->fetchItem(itemId), m_dbContainer->type() );
91 }
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
boost::shared_ptr< void > ora::Container::fetchItemAsType ( int  itemId,
const std::type_info &  asTypeInfo 
)
private

Definition at line 93 of file Container.cc.

References ora::ClassUtils::lookupDictionary().

94  {
95  Reflex::Type asType = ClassUtils::lookupDictionary( asTypeInfo );
96  void* ptr = m_dbContainer->fetchItemAsType(itemId, asType );
97  if(!ptr) return boost::shared_ptr<void>();
98  return boost::shared_ptr<void>( ptr, RflxDeleter( m_dbContainer->type() ) );
99 }
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
Reflex::Type lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
Definition: ClassUtils.cc:84
void ora::Container::flush ( )

Definition at line 137 of file Container.cc.

Referenced by cond::IOVService::deleteAll(), cond::DbSession::deleteObject(), and cond::DbSession::updateObject().

137  {
138  m_dbContainer->flush();
139 }
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
bool ora::Container::getNames ( std::vector< std::string > &  destination)

Definition at line 146 of file Container.cc.

146  {
147  return m_dbContainer->getNames( destination );
148 }
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
int ora::Container::id ( void  )

Definition at line 59 of file Container.cc.

Referenced by ora::Database::insert(), ora::Database::insertItem(), and cond::DbSession::storeObject().

59  {
60  return m_dbContainer->id();
61 }
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
template<typename T >
int ora::Container::insert ( const T &  data)
inline

Definition at line 123 of file Container.h.

Referenced by BeautifulSoup.PageElement::append(), and ora::Database::insert().

123  {
124  return insertItem( &data, typeid( data ) );
125 }
int insertItem(const Object &data)
Definition: Container.cc:101
int ora::Container::insertItem ( const Object data)

Definition at line 101 of file Container.cc.

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

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

101  {
102  const Reflex::Type& objType = data.type();
103  if(!objType){
104  throwException("Object class has not been found in the dictionary.",
105  "Container::insertItem");
106  }
107  return m_dbContainer->insertItem( data.address(), objType );
108 }
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
int ora::Container::insertItem ( const void *  data,
const std::type_info &  typeInfo 
)
private

Definition at line 110 of file Container.cc.

References ora::ClassUtils::lookupDictionary().

111  {
113  return m_dbContainer->insertItem( data, type );
114 }
type
Definition: HCALResponse.h:22
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
Reflex::Type lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
Definition: ClassUtils.cc:84
ora::ContainerIterator ora::Container::iterator ( )

Definition at line 79 of file Container.cc.

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

79  {
80  Handle<IteratorBuffer> buff = m_dbContainer->iteratorBuffer();
81  return ContainerIterator( buff );
82 }
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
const std::string & ora::Container::mappingVersion ( )

Definition at line 71 of file Container.cc.

71  {
72  return m_dbContainer->mappingVersion();
73 }
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
const std::string & ora::Container::name ( )

Definition at line 63 of file Container.cc.

Referenced by BeautifulSoup.Tag::_invert(), cond::MetaData::getToken(), and python.Vispa.Views.PropertyView.Property::valueChanged().

63  {
64  return m_dbContainer->name();
65 }
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
ora::Container & ora::Container::operator= ( const Container rhs)

Definition at line 54 of file Container.cc.

References m_dbContainer.

54  {
55  if(this != &rhs ) m_dbContainer = rhs.m_dbContainer;
56  return *this;
57 }
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
void ora::Container::setItemName ( const std::string &  name,
int  itemId 
)

Definition at line 141 of file Container.cc.

Referenced by cond::MetaData::addMapping().

142  {
143  m_dbContainer->setItemName( name, itemId );
144 }
const std::string & name()
Definition: Container.cc:63
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
size_t ora::Container::size ( void  )

Definition at line 75 of file Container.cc.

75  {
76  return m_dbContainer->size();
77 }
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
template<typename T >
void ora::Container::update ( int  itemId,
const T &  data 
)
inline

Definition at line 129 of file Container.h.

Referenced by python.seqvaluedict.seqdict::__setslice__(), python.Vispa.Gui.VispaWidget.VispaWidget::autosize(), python.Vispa.Views.LineDecayView.LineDecayContainer::createObject(), python.Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), python.Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), python.seqvaluedict.seqdict::extend(), python.Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), python.Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), python.Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), python.Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), python.Vispa.Gui.FindDialog.FindDialog::reset(), python.Vispa.Gui.PortConnection.PointToPointConnection::select(), python.Vispa.Gui.VispaWidget.VispaWidget::select(), python.Vispa.Views.LineDecayView.LineDecayContainer::select(), python.Vispa.Gui.VispaWidget.VispaWidget::setText(), python.Vispa.Gui.VispaWidget.VispaWidget::setTitle(), python.Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), python.Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), ora::Database::update(), python.Vispa.Gui.PortConnection.PointToPointConnection::updateConnection(), and cond::DbSession::updateObject().

129  {
130  return updateItem( itemId, &data, typeid( data ) );
131 }
void updateItem(int itemId, const Object &data)
Definition: Container.cc:116
void ora::Container::updateItem ( int  itemId,
const Object data 
)

Definition at line 116 of file Container.cc.

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

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

117  {
118  const Reflex::Type& objType = data.type();
119  if(!objType){
120  throwException("Object class has not been found in the dictionary.",
121  "Container::updateItem");
122  }
123  return m_dbContainer->updateItem( itemId, data.address(), objType );
124 }
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
void ora::Container::updateItem ( int  itemId,
const void *  data,
const std::type_info &  typeInfo 
)
private

Definition at line 126 of file Container.cc.

References ora::ClassUtils::lookupDictionary().

128  {
130  m_dbContainer->updateItem( itemId, data, type );
131 }
type
Definition: HCALResponse.h:22
Handle< DatabaseContainer > m_dbContainer
Definition: Container.h:98
Reflex::Type lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
Definition: ClassUtils.cc:84

Member Data Documentation

Handle<DatabaseContainer> ora::Container::m_dbContainer
private

Definition at line 98 of file Container.h.

Referenced by operator=().