STYLE: debug: move debug declaration into Foam namespace

This commit is contained in:
mattijs
2012-12-11 09:33:20 +00:00
parent e8ccb8250d
commit 8e968f5647
58 changed files with 418 additions and 151 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,6 +30,10 @@ Description
#include "dictionary.H"
#include "IFstream.H"
#include "OSspecific.H"
#include "Ostream.H"
//#include "HashTable.H"
#include "demandDrivenData.H"
#include "simpleObjectRegistry.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,15 +58,34 @@ public:
~deleteControlDictPtr()
{
if (controlDictPtr_)
{
delete controlDictPtr_;
controlDictPtr_ = 0;
}
deleteDemandDrivenData(controlDictPtr_);
}
};
deleteControlDictPtr deleteControlDictPtr_;
// Debug switch read and write callback tables.
simpleObjectRegistry* debugObjectsPtr_(NULL);
simpleObjectRegistry* infoObjectsPtr_(NULL);
simpleObjectRegistry* optimisationObjectsPtr_(NULL);
class deleteDebugSwitchPtr
{
public:
deleteDebugSwitchPtr()
{}
~deleteDebugSwitchPtr()
{
deleteDemandDrivenData(debugObjectsPtr_);
deleteDemandDrivenData(infoObjectsPtr_);
deleteDemandDrivenData(optimisationObjectsPtr_);
}
};
deleteDebugSwitchPtr deleteDebugSwitchPtr_;
//! \endcond
@ -165,6 +188,61 @@ int Foam::debug::optimisationSwitch(const char* name, const int defaultValue)
}
void Foam::debug::addDebugObject(const char* name, simpleRegIOobject* obj)
{
debugObjects().insert(name, obj);
}
void Foam::debug::addInfoObject(const char* name, simpleRegIOobject* obj)
{
infoObjects().insert(name, obj);
}
void Foam::debug::addOptimisationObject
(
const char* name,
simpleRegIOobject* obj
)
{
optimisationObjects().insert(name, obj);
}
Foam::simpleObjectRegistry& Foam::debug::debugObjects()
{
if (!debugObjectsPtr_)
{
debugObjectsPtr_ = new simpleObjectRegistry(1000);
}
return *debugObjectsPtr_;
}
Foam::simpleObjectRegistry& Foam::debug::infoObjects()
{
if (!infoObjectsPtr_)
{
infoObjectsPtr_ = new simpleObjectRegistry(1000);
}
return *infoObjectsPtr_;
}
Foam::simpleObjectRegistry& Foam::debug::optimisationObjects()
{
if (!optimisationObjectsPtr_)
{
optimisationObjectsPtr_ = new simpleObjectRegistry(1000);
}
return *optimisationObjectsPtr_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //