get rid of global functions :

getDataBase() -> DataBase::getDB()
This commit is contained in:
Christophe Alexandre 2008-06-13 15:58:55 +00:00
parent b7bd1e19a4
commit f47f6b92e5
5 changed files with 17 additions and 34 deletions

View File

@ -43,6 +43,12 @@
*/
// \{
/*! \function DataBase* DataBase::getDB ();
* This static function returns the current
* DataBase, if it has been created and not destroyed,
* else \NULL.
*/
/*! \function Technology* DataBase::getTechnology () const;
* \return the Technology if it exists, else \NULL.
*/
@ -51,18 +57,6 @@
* \return the root Library if it exists, else \NULL.
*/
// \}
/*! \addtogroup Generalities
* \{
*/
/*! \function DataBase* getDataBase ();
* This global generic function returns the current
* DataBase, if it has been created and not destroyed,
* else \NULL.
*/
// \}

View File

@ -20,7 +20,7 @@ namespace Hurricane {
// DataBase implementation
// ****************************************************************************************************
static DataBase* DATA_BASE = NULL;
DataBase* DataBase::_db = NULL;
DataBase::DataBase()
// *****************
@ -28,7 +28,7 @@ DataBase::DataBase()
_technology(NULL),
_rootLibrary(NULL)
{
if (DATA_BASE)
if (_db)
throw Error("Can't create " + _TName("DataBase") + " : already exists");
}
@ -47,7 +47,7 @@ void DataBase::_postCreate()
{
Inherit::_postCreate();
DATA_BASE = this;
_db = this;
}
void DataBase::_preDestroy()
@ -60,7 +60,7 @@ void DataBase::_preDestroy()
if (_technology) _technology->destroy();
UpdateSession::close();
DATA_BASE = NULL;
_db = NULL;
}
string DataBase::_getString() const
@ -83,14 +83,10 @@ Record* DataBase::_getRecord() const
return record;
}
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
DataBase* getDataBase()
// ********************
DataBase* DataBase::getDB()
// ************************
{
return DATA_BASE;
return _db;
}

View File

@ -34,6 +34,7 @@ class DataBase : public DBo {
// Attributes
// **********
private: static DataBase* _db;
private: Technology* _technology;
private: Library* _rootLibrary;
@ -65,18 +66,10 @@ class DataBase : public DBo {
public: Technology* getTechnology() const {return _technology;};
public: Library* getRootLibrary() const {return _rootLibrary;};
public: static DataBase* getDB();
};
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
DataBase* getDataBase();
} // End of Hurricane namespace.

View File

@ -63,7 +63,7 @@ namespace Hurricane {
}
gentry->setChecked ( false );
DataBase* database = getDataBase();
DataBase* database = DataBase::getDB();
if ( database ) {
Technology* technology = database->getTechnology();
if ( technology ) {

View File

@ -89,7 +89,7 @@ extern "C" {
DataBase* db = NULL;
HTRY
db = getDataBase ();
db = DataBase::getDB ();
if ( db == NULL )
PyErr_SetString ( HurricaneError, "DataBase has not been created yet" );
HCATCH