Exemple #1
0
//----------------------------------------
CAliasesDictionary::CAliasesDictionary(const std::string& filename, const std::string &encoding)
{

  // Don't call CXmlDocument(filename, encoding) because overriden 'Load' will not be called

  Init();
  m_fullFileName = filename;

  try
  {
    Load(filename, encoding);
  }
  catch(CException& e)
  {
    DeleteRoot();
    throw e;
  }
  catch(std::exception& e)
  {
    DeleteRoot();
    throw e;
  }
  catch(...)
  {
    DeleteRoot();
    throw CException("Error in CAliasesDictionary ctor - Unexpected error while loading  the aliases dictionary - No Context and no message have been set for this error", BRATHL_ERROR);
  }


}
Exemple #2
0
// destructor                      
BTree::~BTree() {
    if (file_ != NULL) {
        char* header = new char[file_->block_length()];
        WriteRootToBuffer(header);
        file_->SetHeader(header);

        delete[] header;

        delete file_;
        file_ = NULL;
    }

    DeleteRoot();
}
Exemple #3
0
// -------------------------------------------------------------------------
// Init a new b-tree
void BTree::Init(char* file_name, int block_length) {

    file_ = new BlockFile(file_name, block_length);

    // -------------------------------------------------------------------------
    //  Init the first node: to store <blocklength> (page size of a node),
    //  <number> (number of nodes including both index node and leaf node),
    //  and <root> (address of root node)
    // -------------------------------------------------------------------------
    root_ptr_ = new BNode();
    root_ptr_->Init(0, this);

    root_block_ = root_ptr_->block();

    DeleteRoot();
}