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

Search Toolkit Book for CEnvironmentRegistry

CEnvironmentRegistry –. More...

#include <corelib/env_reg.hpp>

+ Inheritance diagram for CEnvironmentRegistry:
+ Collaboration diagram for CEnvironmentRegistry:

Public Types

enum  EPriority { ePriority_Min = kMin_Int , ePriority_Default = 0 , ePriority_Max = kMax_Int }
 
typedef int TPriority
 Not restricted to ePriority_*. More...
 
- Public Types inherited from IRWRegistry
enum  EOperation { eClear , eRead , eSet }
 Categories of modifying operations. More...
 
- 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...
 

Public Member Functions

 CEnvironmentRegistry (TFlags flags=0)
 Constructors. More...
 
 CEnvironmentRegistry (CNcbiEnvironment &env, EOwnership own=eNoOwnership, TFlags flags=0)
 
 ~CEnvironmentRegistry ()
 Destructor. More...
 
void AddMapper (const IEnvRegMapper &mapper, TPriority prio=ePriority_Default)
 
void RemoveMapper (const IEnvRegMapper &mapper)
 
- Public Member Functions inherited from IRWRegistry
void Clear (TFlags flags=fAllLayers)
 Reset the registry content. More...
 
IRWRegistryRead (CNcbiIstream &is, TFlags flags=0, const string &path=kEmptyStr)
 Read and parse the stream "is", and merge its content with current Registry entries. More...
 
bool Set (const string &section, const string &name, const string &value, TFlags flags=0, const string &comment=kEmptyStr)
 Set the configuration parameter value. More...
 
bool Unset (const string &section, const string &name, TFlags flags=0)
 Fully unset the configuration parameter value, so that HasEntry returns false. More...
 
bool SetComment (const string &comment, const string &section=kEmptyStr, const string &name=kEmptyStr, TFlags flags=0)
 Set comment "comment" for the registry entry "section:name". More...
 
bool SetValue (const string &section, const string &name, const string &value, TFlags flags=0, const string &comment=kEmptyStr)
 Overloading of setters for generic programming. More...
 
bool SetValue (const string &section, const string &name, int value, TFlags flags=0, const string &comment=kEmptyStr)
 
bool SetValue (const string &section, const string &name, bool value, TFlags flags=0, const string &comment=kEmptyStr)
 
bool SetValue (const string &section, const string &name, double value, TFlags flags=0, const string &comment=kEmptyStr)
 
- 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
 

Protected Member Functions

bool x_Empty (TFlags flags) const
 Implementations of the fundamental operations above, to be run with the lock already acquired and some basic sanity checks performed. More...
 
bool x_Modified (TFlags flags) const
 
void x_SetModifiedFlag (bool modified, TFlags flags)
 
const stringx_Get (const string &section, const string &name, TFlags flags) const
 
const stringx_Get (const string &section, const string &name, TFlags flags, bool &found) const
 
bool x_HasEntry (const string &section, const string &name, TFlags flags) const
 
const stringx_GetComment (const string &section, const string &name, TFlags flags) const
 
void x_Enumerate (const string &section, list< string > &entries, TFlags flags) const
 
void x_ChildLockAction (FLockAction action)
 
void x_Clear (TFlags flags)
 Called locked, like the virtual methods inherited from IRegistry. More...
 
bool x_Set (const string &section, const string &name, const string &value, TFlags flags, const string &comment)
 
bool x_Unset (const string &section, const string &name, TFlags flags)
 
bool x_SetComment (const string &comment, const string &section, const string &name, TFlags flags)
 
- Protected Member Functions inherited from IRWRegistry
virtual IRWRegistryx_Read (CNcbiIstream &is, TFlags flags, const string &path)
 Most implementations should not override this, but CNcbiRegistry must, to handle some special cases properly. More...
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 

Private Types

typedef multimap< TPriority, CConstRef< IEnvRegMapper > > TPriorityMap
 

Private Member Functions

 CEnvironmentRegistry (const CEnvironmentRegistry &)
 Copying prohibited. More...
 

Private Attributes

AutoPtr< CNcbiEnvironmentm_Env
 
TPriorityMap m_PriorityMap
 
bool m_Modified
 only tracks mods made through this. More...
 
TFlags m_Flags
 

Additional Inherited Members

- Static Public Member Functions inherited from IRWRegistry
static TFlags AssessImpact (TFlags flags, EOperation op)
 Indicate which portions of the registry the given operation would affect. 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)
 
- Static Protected Member Functions inherited from IRWRegistry
static bool MaybeSet (string &target, const string &value, TFlags flags)
 
- Static Protected Member Functions inherited from IRegistry
static void x_CheckFlags (const string &func, TFlags &flags, TFlags allowed)
 

Detailed Description

CEnvironmentRegistry –.

Adapts CNcbiEnvironment to act like a registry. Leaves all caching of values to CNcbiEnvironment, and does not support comments. Always transient, though making it the persistent side of a CTwoLayerRegistry can mask that.

Uses customizable mappers between environment variable names and registry section/name pairs; see below for details.

Definition at line 86 of file env_reg.hpp.


The documentation for this class was generated from the following files:
Modified on Tue May 21 10:59:45 2024 by modify_doxy.py rev. 669887