NCBI C++ ToolKit
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CConfigRegistry Class Reference

Search Toolkit Book for CConfigRegistry

#include "netservice_params.hpp"
(Private to src/connect/services.)

+ Inheritance diagram for CConfigRegistry:
+ Collaboration diagram for CConfigRegistry:

Public Member Functions

 CConfigRegistry (CConfig *config=nullptr)
 
void Reset (CConfig *config=nullptr)
 
- Public Member Functions inherited from IRegistry
bool Empty (TFlags flags=fAllLayers) const
 Verify if Registry is empty. More...
 
bool Modified (TFlags flags=fPersistent) const
 Verify if persistent values have been modified. More...
 
void SetModifiedFlag (bool modified, TFlags flags=fPersistent)
 Indicate whether any relevant values are out of sync with some external resource (typically a configuration file). More...
 
bool Write (CNcbiOstream &os, TFlags flags=0) const
 Write the registry content to output stream. More...
 
virtual const stringGet (const string &section, const string &name, TFlags flags=0) const
 Get the parameter value. More...
 
virtual bool HasEntry (const string &section, const string &name=kEmptyStr, TFlags flags=0) const
 
virtual string GetString (const string &section, const string &name, const string &default_value, TFlags flags=0) const
 Get the parameter string value. More...
 
string GetEncryptedString (const string &section, const string &name, TFlags flags=0, const string &password=kEmptyStr) const
 Get a value that was (potentially) stored encrypted. More...
 
virtual int GetInt (const string &section, const string &name, int default_value, TFlags flags=0, EErrAction err_action=eThrow) const
 Get integer value of specified parameter name. More...
 
virtual bool GetBool (const string &section, const string &name, bool default_value, TFlags flags=0, EErrAction err_action=eThrow) const
 Get boolean value of specified parameter name. More...
 
virtual double GetDouble (const string &section, const string &name, double default_value, TFlags flags=0, EErrAction err_action=eThrow) const
 Get double value of specified parameter name. More...
 
virtual const stringGetComment (const string &section=kEmptyStr, const string &name=kEmptyStr, TFlags flags=0) const
 Get comment of the registry entry "section:name". More...
 
virtual void EnumerateInSectionComments (const string &section, list< string > *comments, TFlags flags=fAllLayers) const
 Enumerate in-section comments. More...
 
virtual void EnumerateSections (list< string > *sections, TFlags flags=fAllLayers) const
 Enumerate section names. More...
 
virtual void EnumerateEntries (const string &section, list< string > *entries, TFlags flags=fAllLayers) const
 Enumerate parameter names for a specified section. More...
 
void ReadLock (void)
 Support for locking. More...
 
void WriteLock (void)
 
void Unlock (void)
 
string GetValue (const string &section, const string &name, const string &default_value, EErrAction=eReturn, TFlags flags=0) const
 Overloading of getters for generic programming. More...
 
int GetValue (const string &section, const string &name, int default_value, EErrAction err_action=eErrPost, TFlags flags=0) const
 
bool GetValue (const string &section, const string &name, bool default_value, EErrAction err_action=eErrPost, TFlags flags=0) const
 
double GetValue (const string &section, const string &name, double default_value, EErrAction err_action=eErrPost, TFlags flags=0) const
 
- Public Member Functions inherited from CObject
 CObject (void)
 Constructor. More...
 
 CObject (const CObject &src)
 Copy constructor. More...
 
virtual ~CObject (void)
 Destructor. More...
 
CObjectoperator= (const CObject &src) THROWS_NONE
 Assignment operator. More...
 
bool CanBeDeleted (void) const THROWS_NONE
 Check if object can be deleted. More...
 
bool IsAllocatedInPool (void) const THROWS_NONE
 Check if object is allocated in memory pool (not system heap) More...
 
bool Referenced (void) const THROWS_NONE
 Check if object is referenced. More...
 
bool ReferencedOnlyOnce (void) const THROWS_NONE
 Check if object is referenced only once. More...
 
void AddReference (void) const
 Add reference to object. More...
 
void RemoveReference (void) const
 Remove reference to object. More...
 
void ReleaseReference (void) const
 Remove reference without deleting object. More...
 
virtual void DoNotDeleteThisObject (void)
 Mark this object as not allocated in heap – do not delete this object. More...
 
virtual void DoDeleteThisObject (void)
 Mark this object as allocated in heap – object can be deleted. More...
 
void * operator new (size_t size)
 Define new operator for memory allocation. More...
 
void * operator new[] (size_t size)
 Define new[] operator for 'array' memory allocation. More...
 
void operator delete (void *ptr)
 Define delete operator for memory deallocation. More...
 
void operator delete[] (void *ptr)
 Define delete[] operator for memory deallocation. More...
 
void * operator new (size_t size, void *place)
 Define new operator. More...
 
void operator delete (void *ptr, void *place)
 Define delete operator. More...
 
void * operator new (size_t size, CObjectMemoryPool *place)
 Define new operator using memory pool. More...
 
void operator delete (void *ptr, CObjectMemoryPool *place)
 Define delete operator. More...
 
virtual void DebugDump (CDebugDumpContext ddc, unsigned int depth) const
 Define method for dumping debug information. More...
 
- Public Member Functions inherited from CDebugDumpable
 CDebugDumpable (void)
 
virtual ~CDebugDumpable (void)
 
void DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const
 
void DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const
 
void DumpToConsole (void) const
 

Private Member Functions

bool x_Empty (TFlags flags) const override
 Implementations of the fundamental operations above, to be run with the lock already acquired and some basic sanity checks performed. More...
 
const stringx_Get (const string &section, const string &name, TFlags flags) const override
 
bool x_HasEntry (const string &section, const string &name, TFlags flags) const override
 
const stringx_GetComment (const string &section, const string &name, TFlags flags) const override
 
void x_Enumerate (const string &section, list< string > &entries, TFlags flags) const override
 
CConfigGetSubConfig (const string &section) const
 

Private Attributes

CConfigm_Config
 
map< string, unique_ptr< CConfig > > m_SubConfigs
 

Additional Inherited Members

- Public Types inherited from IRegistry
enum  EFlags {
  fTransient = 0x1 , fPersistent = 0x100 , fOverride = 0x2 , fNoOverride = 0x200 ,
  fTruncate = 0x4 , fNoTruncate = 0x400 , fJustCore = 0x8 , fNotJustCore = 0x800 ,
  fIgnoreErrors = 0x10 , fInternalSpaces = 0x20 , fWithNcbirc = 0x40 , fCountCleared = 0x80 ,
  fSectionCase = 0x1000 , fEntryCase = 0x2000 , fSectionlessEntries = 0x4000 , fSections = 0x8000 ,
  fPlaintextAllowed = 0x10000 , fInSectionComments = 0x20000 , fInternalCheckedAndLocked = 0x40000 , fCoreLayers = fTransient | fPersistent | fJustCore ,
  fAllLayers = fTransient | fPersistent | fNotJustCore , fCaseFlags = fSectionCase | fEntryCase
}
 Flags controlling the behavior of registry methods. More...
 
enum  EErrAction { eThrow , eErrPost , eReturn }
 What to do if parameter value is present but cannot be converted into the requested type. More...
 
typedef int TFlags
 Binary OR of "EFlags". More...
 
- Public Types inherited from CObject
enum  EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern }
 Control filling of newly allocated memory. More...
 
typedef CObjectCounterLocker TLockerType
 Default locker type for CRef. More...
 
typedef atomic< Uint8TCounter
 Counter type is CAtomiCounter. More...
 
typedef Uint8 TCount
 Alias for value type of counter. More...
 
- Static Public Member Functions inherited from IRegistry
static bool IsNameSection (const string &str, TFlags flags)
 Check if "str" consists of alphanumeric and '_' only Treat the case of set fSectionlessEntries separately. More...
 
static bool IsNameEntry (const string &str, TFlags flags)
 
- Static Public Member Functions inherited from CObject
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (void)
 Define method to throw null pointer exception. More...
 
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (const type_info &type)
 
static EAllocFillMode GetAllocFillMode (void)
 
static void SetAllocFillMode (EAllocFillMode mode)
 
static void SetAllocFillMode (const string &value)
 Set mode from configuration parameter value. More...
 
- Static Public Member Functions inherited from CDebugDumpable
static void EnableDebugDump (bool on)
 
- Static Public Attributes inherited from IRegistry
static const char * sm_InSectionCommentName = "[]"
 Entry name for an in-section comment. More...
 
- Static Public Attributes inherited from CObject
static const TCount eCounterBitsCanBeDeleted = 1 << 0
 Define possible object states. More...
 
static const TCount eCounterBitsInPlainHeap = 1 << 1
 Heap signature was found. More...
 
static const TCount eCounterBitsPlaceMask
 Mask for 'in heap' state flags. More...
 
static const int eCounterStep = 1 << 2
 Skip over the "in heap" bits. More...
 
static const TCount eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2)
 Minimal value for valid objects (reference counter is zero) Must be a single bit value. More...
 
static const TCount eCounterStateMask
 Valid object, and object in heap. More...
 
- Protected Types inherited from IRegistry
enum  EMasks { fLayerFlags = fAllLayers | fJustCore , fTPFlags = fTransient | fPersistent }
 
typedef void(IRegistry::* FLockAction) (void)
 
- Protected Member Functions inherited from IRegistry
virtual bool x_Modified (TFlags) const
 
virtual void x_SetModifiedFlag (bool, TFlags)
 
virtual void x_ChildLockAction (FLockAction)
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 
- Static Protected Member Functions inherited from IRegistry
static void x_CheckFlags (const string &func, TFlags &flags, TFlags allowed)
 

Detailed Description

Definition at line 106 of file netservice_params.hpp.

Constructor & Destructor Documentation

◆ CConfigRegistry()

CConfigRegistry::CConfigRegistry ( CConfig config = nullptr)

Definition at line 61 of file netservice_params.cpp.

Member Function Documentation

◆ GetSubConfig()

CConfig * CConfigRegistry::GetSubConfig ( const string section) const
private

◆ Reset()

void CConfigRegistry::Reset ( CConfig config = nullptr)

Definition at line 66 of file netservice_params.cpp.

References map_checker< Container >::clear(), m_Config, and m_SubConfigs.

◆ x_Empty()

bool CConfigRegistry::x_Empty ( TFlags  flags) const
overrideprivatevirtual

Implementations of the fundamental operations above, to be run with the lock already acquired and some basic sanity checks performed.

Implements IRegistry.

Definition at line 72 of file netservice_params.cpp.

References NCBI_ALWAYS_TROUBLE.

◆ x_Enumerate()

void CConfigRegistry::x_Enumerate ( const string section,
list< string > &  entries,
TFlags  flags 
) const
overrideprivatevirtual

Implements IRegistry.

Definition at line 134 of file netservice_params.cpp.

References NCBI_ALWAYS_TROUBLE.

◆ x_Get()

const string & CConfigRegistry::x_Get ( const string section,
const string name,
TFlags  flags 
) const
overrideprivatevirtual

◆ x_GetComment()

const string & CConfigRegistry::x_GetComment ( const string section,
const string name,
TFlags  flags 
) const
overrideprivatevirtual

Implements IRegistry.

Definition at line 128 of file netservice_params.cpp.

References kEmptyStr, and NCBI_ALWAYS_TROUBLE.

◆ x_HasEntry()

bool CConfigRegistry::x_HasEntry ( const string section,
const string name,
TFlags  flags 
) const
overrideprivatevirtual

Member Data Documentation

◆ m_Config

CConfig* CConfigRegistry::m_Config
private

Definition at line 121 of file netservice_params.hpp.

Referenced by GetSubConfig(), Reset(), x_Get(), and x_HasEntry().

◆ m_SubConfigs

map<string, unique_ptr<CConfig> > CConfigRegistry::m_SubConfigs
mutableprivate

Definition at line 122 of file netservice_params.hpp.

Referenced by GetSubConfig(), and Reset().


The documentation for this class was generated from the following files:
Modified on Tue May 28 05:53:02 2024 by modify_doxy.py rev. 669887