CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::DeleteBuffer Class Reference

List of all members.

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) [inline, explicit]

Definition at line 196 of file DatabaseContainer.cc.

                                                          :
        m_buffer(),
        m_contSchema( contSchema ){
      }
ora::DeleteBuffer::~DeleteBuffer ( ) [inline]

Definition at line 201 of file DatabaseContainer.cc.

                     {
      }

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().

                    {
        size_t nobj = 0;
        if( m_buffer.size()) {
          RelationalBuffer operationBuffer( m_contSchema.storageSchema() );
          RelationalDeleter mainDeleter( m_contSchema.mapping().topElement() );
          mainDeleter.build( operationBuffer );
          std::vector<MappingElement> dependentMappings;
          m_contSchema.mappingForDependentClasses( dependentMappings );
          RelationalDeleter depDeleter(  dependentMappings );
          depDeleter.build( operationBuffer );
          dependentMappings.clear();                             
          
          for( std::vector<int>::const_iterator iD = m_buffer.begin();
               iD != m_buffer.end(); ++iD ){
            depDeleter.erase( *iD );
            mainDeleter.erase( *iD );
            if( operationBuffer.flush() ) nobj++;
          }
          m_buffer.clear();
        }
        return nobj;
      }
void ora::DeleteBuffer::registerForDelete ( int  oid) [inline]

Definition at line 205 of file DatabaseContainer.cc.

References m_buffer.

                                       {
        m_buffer.push_back( oid );
      }

Member Data Documentation

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

Definition at line 233 of file DatabaseContainer.cc.

Referenced by flush(), and registerForDelete().

Definition at line 234 of file DatabaseContainer.cc.

Referenced by flush().