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 Attributes
ora::DeleteBuffer Class Reference

Public Member Functions

 DeleteBuffer (ContainerSchema &contSchema)
 
size_t flush ()
 
void registerForDelete (int oid)
 
 ~DeleteBuffer ()
 

Private Attributes

std::vector< int > m_buffer
 
ContainerSchemam_contSchema
 

Detailed Description

Definition at line 194 of file DatabaseContainer.cc.

Constructor & Destructor Documentation

ora::DeleteBuffer::DeleteBuffer ( ContainerSchema contSchema)
inlineexplicit

Definition at line 196 of file DatabaseContainer.cc.

196  :
197  m_buffer(),
198  m_contSchema( contSchema ){
199  }
ContainerSchema & m_contSchema
std::vector< int > m_buffer
ora::DeleteBuffer::~DeleteBuffer ( )
inline

Definition at line 201 of file DatabaseContainer.cc.

201  {
202  }

Member Function Documentation

size_t ora::DeleteBuffer::flush ( )
inline

Definition at line 209 of file DatabaseContainer.cc.

References ora::RelationalDeleter::build(), ora::RelationalDeleter::erase(), m_buffer, m_contSchema, ora::ContainerSchema::mapping(), ora::ContainerSchema::mappingForDependentClasses(), ora::ContainerSchema::storageSchema(), and ora::MappingTree::topElement().

209  {
210  size_t nobj = 0;
211  if( m_buffer.size()) {
212  RelationalBuffer operationBuffer( m_contSchema.storageSchema() );
213  RelationalDeleter mainDeleter( m_contSchema.mapping().topElement() );
214  mainDeleter.build( operationBuffer );
215  std::vector<MappingElement> dependentMappings;
216  m_contSchema.mappingForDependentClasses( dependentMappings );
217  RelationalDeleter depDeleter( dependentMappings );
218  depDeleter.build( operationBuffer );
219  dependentMappings.clear();
220 
221  for( std::vector<int>::const_iterator iD = m_buffer.begin();
222  iD != m_buffer.end(); ++iD ){
223  depDeleter.erase( *iD );
224  mainDeleter.erase( *iD );
225  if( operationBuffer.flush() ) nobj++;
226  }
227  m_buffer.clear();
228  }
229  return nobj;
230  }
ContainerSchema & m_contSchema
bool mappingForDependentClasses(std::vector< MappingElement > &destination)
const MappingElement & topElement() const
Definition: MappingTree.h:143
std::vector< int > m_buffer
coral::ISchema & storageSchema()
MappingTree & mapping(bool writeEnabled=false)
void ora::DeleteBuffer::registerForDelete ( int  oid)
inline

Definition at line 205 of file DatabaseContainer.cc.

References m_buffer.

205  {
206  m_buffer.push_back( oid );
207  }
std::vector< int > m_buffer

Member Data Documentation

std::vector<int> ora::DeleteBuffer::m_buffer
private

Definition at line 233 of file DatabaseContainer.cc.

Referenced by flush(), and registerForDelete().

ContainerSchema& ora::DeleteBuffer::m_contSchema
private

Definition at line 234 of file DatabaseContainer.cc.

Referenced by flush().