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 199 of file DatabaseContainer.cc.

Constructor & Destructor Documentation

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

Definition at line 201 of file DatabaseContainer.cc.

201  :
202  m_buffer(),
203  m_contSchema( contSchema ){
204  }
ContainerSchema & m_contSchema
std::vector< int > m_buffer
ora::DeleteBuffer::~DeleteBuffer ( )
inline

Definition at line 206 of file DatabaseContainer.cc.

206  {
207  }

Member Function Documentation

size_t ora::DeleteBuffer::flush ( )
inline

Definition at line 214 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().

214  {
215  size_t nobj = 0;
216  if( m_buffer.size()) {
217  RelationalBuffer operationBuffer( m_contSchema.storageSchema() );
218  RelationalDeleter mainDeleter( m_contSchema.mapping().topElement() );
219  mainDeleter.build( operationBuffer );
220  std::vector<MappingElement> dependentMappings;
221  m_contSchema.mappingForDependentClasses( dependentMappings );
222  RelationalDeleter depDeleter( dependentMappings );
223  depDeleter.build( operationBuffer );
224  dependentMappings.clear();
225 
226  for( std::vector<int>::const_iterator iD = m_buffer.begin();
227  iD != m_buffer.end(); ++iD ){
228  depDeleter.erase( *iD );
229  mainDeleter.erase( *iD );
230  if( operationBuffer.flush() ) nobj++;
231  }
232  m_buffer.clear();
233  }
234  return nobj;
235  }
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 210 of file DatabaseContainer.cc.

References m_buffer.

210  {
211  m_buffer.push_back( oid );
212  }
std::vector< int > m_buffer

Member Data Documentation

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

Definition at line 238 of file DatabaseContainer.cc.

Referenced by flush(), and registerForDelete().

ContainerSchema& ora::DeleteBuffer::m_contSchema
private

Definition at line 239 of file DatabaseContainer.cc.

Referenced by flush().