CNcbiRegistry Class Reference
[Application Registry]

Search Toolkit Book for CNcbiRegistry

#include <ncbireg.hpp>

Inheritance diagram for CNcbiRegistry:

Inheritance graph
[legend]
Collaboration diagram for CNcbiRegistry:

Collaboration graph
[legend]
List of all members.

Detailed Description

CNcbiRegistry --.

Define the Registry.

Load, access, modify and store runtime information (usually used to work with configuration files).

Definition at line 760 of file ncbireg.hpp.

Public Types

enum  ECompatFlags {
  eTransient = fTransient, ePersistent = fPersistent, eOverride = fOverride, eNoOverride = fNoOverride,
  eTruncate = fTruncate, eNoTruncate = fNoTruncate
}

Public Member Functions

 CNcbiRegistry (TFlags flags=0)
 Constructor.
 CNcbiRegistry (CNcbiIstream &is, TFlags flags=0)
 Constructor.
 ~CNcbiRegistry ()
bool IncludeNcbircIfAllowed (TFlags flags=fWithNcbirc)
 Attempt to load a systemwide configuration file (.ncbirc on Unix, ncbi.ini on Windows) as a low-priority registry, as long as the following conditions all hold:
  • fWithNcbirc is set in FLAGS.


Static Public Attributes

static const char * sm_EnvRegName = ".env"
 Predefined subregistries' names.
static const char * sm_FileRegName = ".file"
static const char * sm_OverrideRegName = ".overrides"
static const char * sm_SysRegName = ".ncbirc"

Protected Member Functions

void x_Clear (TFlags flags)
 Called locked, like the virtual methods inherited from IRegistry.
IRWRegistryx_Read (CNcbiIstream &is, TFlags flags)
 Most implementations should not override this, but CNcbiRegistry must, to handle some special cases properly.

Private Types

enum  EReservedPriority { ePriority_File = ePriority_Reserved, ePriority_Overrides, ePriority_Environment, ePriority_RuntimeOverrides }

Private Member Functions

void x_Init (void)

Private Attributes

CRef< CEnvironmentRegistrym_EnvRegistry
CRef< CTwoLayerRegistrym_FileRegistry
CRef< IRWRegistrym_OverrideRegistry
CRef< IRWRegistrym_SysRegistry
unsigned int m_RuntimeOverrideCount
TFlags m_Flags


Member Enumeration Documentation

enum CNcbiRegistry::ECompatFlags
 

Enumerator:
eTransient 
ePersistent 
eOverride 
eNoOverride 
eTruncate 
eNoTruncate 

Definition at line 763 of file ncbireg.hpp.

enum CNcbiRegistry::EReservedPriority [private]
 

Enumerator:
ePriority_File 
ePriority_Overrides 
ePriority_Environment 
ePriority_RuntimeOverrides 

Definition at line 820 of file ncbireg.hpp.


Constructor & Destructor Documentation

CNcbiRegistry::CNcbiRegistry TFlags  flags = 0  ) 
 

Constructor.

Definition at line 1357 of file ncbireg.cpp.

References x_Init().

CNcbiRegistry::CNcbiRegistry CNcbiIstream is,
TFlags  flags = 0
 

Constructor.

Parameters:
is Input stream to load the Registry from. NOTE: if the stream is a file, it must be opened in binary mode!
flags How parameters are stored. The default is to store all parameters as persistent unless the "eTransient" flag is set in which case the newly retrieved parameters are stored as transient.
See also:
Read()

Definition at line 1364 of file ncbireg.cpp.

References IRegistry::fCaseFlags, IRegistry::fInternalSpaces, IRegistry::fTransient, IRegistry::fWithNcbirc, IncludeNcbircIfAllowed(), m_FileRegistry, IRegistry::x_CheckFlags(), and x_Init().

CNcbiRegistry::~CNcbiRegistry  ) 
 

Definition at line 1375 of file ncbireg.cpp.


Member Function Documentation

bool CNcbiRegistry::IncludeNcbircIfAllowed TFlags  flags = fWithNcbirc  ) 
 

Attempt to load a systemwide configuration file (.ncbirc on Unix, ncbi.ini on Windows) as a low-priority registry, as long as the following conditions all hold:

  • fWithNcbirc is set in FLAGS.

  • The environment variable NCBI_DONT_USE_NCBIRC is NOT set.
  • The registry's existing contents do NOT contain a setting of [NCBI]DONT_USE_NCBIRC (case-insensitive).
    Parameters:
    flags Registry flags to be applied when reading the system configuration file. Must also contain fWithNcbirc (which will be filtered out before calling any other methods) for the call to have any effect.
    Returns:
    TRUE if the system configuration file was successfully read and parsed; FALSE otherwise.

Definition at line 1380 of file ncbireg.cpp.

References CRef< C, Locker >::Empty(), CMetaRegistry::eName_RcOrIni, ERR_POST_X, IRegistry::fWithNcbirc, CRef< C, Locker >::GetPointer(), IRegistry::HasEntry(), CMetaRegistry::Load(), m_SysRegistry, CMetaRegistry::SEntry::registry, and CRef< C, Locker >::Reset().

Referenced by CNcbiRegistry(), and x_Read().

void CNcbiRegistry::x_Clear TFlags  flags  )  [protected, virtual]
 

Called locked, like the virtual methods inherited from IRegistry.

Reimplemented from CCompoundRWRegistry.

Definition at line 1419 of file ncbireg.cpp.

References m_FileRegistry, and CCompoundRWRegistry::x_Clear().

void CNcbiRegistry::x_Init void   )  [inline, private]
 

Definition at line 1317 of file ncbireg.cpp.

References CCompoundRWRegistry::CCompoundRWRegistry(), CMetaRegistry::eName_AsIs, eNoOwnership, CCompoundRWRegistry::ePriority_Default, ePriority_Environment, ePriority_File, ePriority_Overrides, ERR_POST_ONCE, ERR_POST_X, IRegistry::fCaseFlags, CRef< C, Locker >::GetPointer(), CNcbiApplication::Instance(), CMetaRegistry::Load(), m_EnvRegistry, m_FileRegistry, m_Flags, m_OverrideRegistry, m_SysRegistry, CMetaRegistry::SEntry::registry, CRef< C, Locker >::Reset(), CNcbiApplication::SetEnvironment(), sm_EnvRegName, sm_FileRegName, sm_OverrideRegName, sm_SysRegName, and CCompoundRWRegistry::x_Add().

Referenced by CNcbiRegistry().

IRWRegistry * CNcbiRegistry::x_Read CNcbiIstream is,
TFlags  flags
[protected, virtual]
 

Most implementations should not override this, but CNcbiRegistry must, to handle some special cases properly.

Reimplemented from CCompoundRWRegistry.

Definition at line 1426 of file ncbireg.cpp.

References CRef< C, Locker >::Empty(), CConstRef< C, Locker >::Empty(), CCompoundRWRegistry::FindByName(), IncludeNcbircIfAllowed(), CCompoundRWRegistry::LoadBaseRegistries(), m_FileRegistry, and CCompoundRWRegistry::sm_MainRegName.


Member Data Documentation

CRef<CEnvironmentRegistry> CNcbiRegistry::m_EnvRegistry [private]
 

Definition at line 827 of file ncbireg.hpp.

Referenced by x_Init().

CRef<CTwoLayerRegistry> CNcbiRegistry::m_FileRegistry [private]
 

Definition at line 828 of file ncbireg.hpp.

Referenced by CNcbiRegistry(), x_Clear(), x_Init(), and x_Read().

TFlags CNcbiRegistry::m_Flags [private]
 

Reimplemented from CCompoundRWRegistry.

Definition at line 832 of file ncbireg.hpp.

Referenced by x_Init().

CRef<IRWRegistry> CNcbiRegistry::m_OverrideRegistry [private]
 

Definition at line 829 of file ncbireg.hpp.

Referenced by x_Init().

unsigned int CNcbiRegistry::m_RuntimeOverrideCount [private]
 

Definition at line 831 of file ncbireg.hpp.

CRef<IRWRegistry> CNcbiRegistry::m_SysRegistry [private]
 

Definition at line 830 of file ncbireg.hpp.

Referenced by IncludeNcbircIfAllowed(), and x_Init().

const char * CNcbiRegistry::sm_EnvRegName = ".env" [static]
 

Predefined subregistries' names.

Definition at line 808 of file ncbireg.hpp.

Referenced by x_Init().

const char * CNcbiRegistry::sm_FileRegName = ".file" [static]
 

Definition at line 809 of file ncbireg.hpp.

Referenced by CCompoundRWRegistry::LoadBaseRegistries(), and x_Init().

const char * CNcbiRegistry::sm_OverrideRegName = ".overrides" [static]
 

Definition at line 810 of file ncbireg.hpp.

Referenced by x_Init().

const char * CNcbiRegistry::sm_SysRegName = ".ncbirc" [static]
 

Definition at line 811 of file ncbireg.hpp.

Referenced by x_Init().


The documentation for this class was generated from the following files:
Generated on Wed Dec 9 08:03:04 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Wed Dec 09 08:19:31 2009 by modify_doxy.py rev. 173732