Open the hdbBinRepos instance. This is a matter of opening an input and an output stream for both index the data files. Note the output streams are opened with ios::app as they will only ever append. Arguments: None
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hdbBinRepos::Open | (void) |
Declared in file: hzDatabase.h
Defined in file : hdbBinRepos.cpp
Function Logic:
Function body:
hzEcode hdbBinRepos::Open (void)
{
// Open the hdbBinRepos instance.
//
// This is a matter of opening an input and an output stream for both index the data files. Note the output streams are opened with ios::app as they will only ever append.
//
// Arguments: None
//
// Returns: E_NOINIT If the repository has not been initialized
// E_SEQUENCE If the repository is already open
// E_OPENFAIL If either the index or data file cannot be opened for either reading or writing
// E_OK If the operation was successful
_hzfunc("hdbBinRepos::Open") ;
if (m_nInitState == 0) hzexit(E_NOINIT, "Cannot open an uninitialized datacron") ;
if (m_nInitState == 2) hzexit(E_SEQUENCE, "Datacron %s is already open", *m_Name) ;
m_WrI.open(*m_FileIndx, std::ios::app) ;
if (m_WrI.fail())
return hzerr(E_OPENFAIL, "Cannot open index file for writing: Repos %s", *m_FileIndx) ;
threadLog("Opened index file for writing: Repos %s\n", *m_FileIndx) ;
m_WrD.open(*m_FileData, std::ios::app) ;
if (m_WrD.fail())
return hzerr(E_OPENFAIL, "Could not open file (%s) for writing", *m_FileData) ;
threadLog("Opened data file for writing: Repos %s\n", *m_FileData) ;
m_RdI.open(*m_FileIndx) ;
if (m_RdI.fail())
return hzerr(E_OPENFAIL, "Could not open index file (%s) for reading", *m_FileIndx) ;
threadLog("Opened index file for reading: Repos %s\n", *m_FileIndx) ;
m_RdD.open(*m_FileData) ;
if (m_RdD.fail())
return hzerr(E_OPENFAIL, "Could not open data file (%s) for reading", *m_FileData) ;
threadLog("Opened index file for reading: Repos %s\n", *m_FileData) ;
threadLog("OPENED %s\n", *m_Name) ;
m_nInitState = 2;
return E_OK ;
}