Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

AnyConfig Namespace Reference

All the classes are defined in the AnyConfig namespace. More...


class  AnyConfig::AcAutoDelete
 A mini-class to auto-release AcConfiguration pointers. More...

class  AnyConfig::AcBufFileConfig
 A merge of the AcMemConfig and AcFileConfig classes. More...

class  AnyConfig::AcCfgSource
 Configuration source or configuration "pointer". More...

class  AnyConfig::AcConfiguration
 The base class for all configuration classes. More...

interface  AnyConfig::CorbaConfig
 The interface specification for the Corba configuration server. More...

class  AnyConfig::AcCorbaConfig
 This class implements a remote AcWriteAbleConfig using CORBA. More...

class  AnyConfig::CorbaConfig_impl
 The implementation of AnyConfig::CorbaConfig. More...

class  AnyConfig::AcEnvConfig
 Looks for sections and keys in the environment. More...

class  AnyConfig::AcException
 Exception meant for debugging. More...

class  AnyConfig::AcFileConfig
 Uses an .INI style file for the configuration. More...

class  AnyConfig::AcMemCfgItem
 Holds a name-value pair. More...

class  AnyConfig::AcMemCfgSection::MemCfgItemIterator
class  AnyConfig::AcMemCfgSection
 Holds a section (list of name-value pairs). More...

class  AnyConfig::AcMemConfig::MemCfgSectionIterator
class  AnyConfig::AcMemConfig
 Holds an in-memory configuration. More...

class  AnyConfig::AcMySQLConfig
 An AcWriteableConfig which uses a MySQL database as source. More...

class  AnyConfig::AcRegConfig
 Access the registry for configuration information. More...

struct  AnyConfig::CorbaConfig::AcSection
 A single section. More...

struct  AnyConfig::CorbaConfig::AcValuePair
 A simple key/value pair. More...

class  AnyConfig::AcWriteableConfig
 The base class for all configuration classes that allow updating. More...


typedef int HKEY
 Typedef to avoid compiler complains. More...


AcConfigurationloadRedundantConfig (AcConfiguration *pSource, FILE *pfReport=NULL)
 Redundant configuration handling. More...

void MasterConfig (int argn, char *argv[])
 MasterConfig starts another program after using AnyConfig to build its native configuration. More...

void AcCorbaInit (void *pOrb)
 Special function to use avoid creating an extra ORB. More...


bool acfThrowExceptions = false
 Normally AnyConfig does not throw exceptions. More...

Detailed Description

All the classes are defined in the AnyConfig namespace.

Typedef Documentation

typedef int AnyConfig::HKEY

Typedef to avoid compiler complains.

Function Documentation

void AnyConfig::AcCorbaInit ( void * pOrb )

Special function to use avoid creating an extra ORB.

pOrb   should refer to an initialized ORB.

void AnyConfig::MasterConfig ( int argc,
char * argv[] )

MasterConfig starts another program after using AnyConfig to build its native configuration.

MasterConfig needs 1 argument, the section of the default configuration to use. See AcConfiguration::findAnyConfig() on how it obtains the default configuration.
If the keyword ANYCFG_PRIMARY exists in this section of the default configuration, MasterConfig will invoke loadRedundantConfig() on it.
In what should be the program's best configuration, MasterConfig will look for the following keys in the specified section:

  • PROGRAM (required) The full path to the executable it should start.
  • CMDLINE (optional) This should be the parameters for the program as a single string. This string will not be scanned for substitutions.
  • CMD_xx (optional, xx=00 through 99) This should be a command line split in sub-parts with keyword substitution. See MasterConfig for more details.
  • ENV_xx (optional, xx=00 through 99) This should be a list of environment strings. See MasterConfig for more details.
  • VERBOSE (optional, boolean) If true will make MasterConfig very talkative.
The following options are NOT implemented at this time. They are only mentioned here because I figured that people might want them. The idea about Open Source is that you go ahead and implement them. And that if you get it working, you pass your additions on to the rest of us!
If anybody does implement these, feel free to modify the tag names or add some of your own, these are just here as a discussion item.

  • STARTDIR (optional) The directory to start the program in.
  • USESCRIPT (optional, 'xxx.cmd', 'xxx.bat' or '') MasterConfig will write a script to start the program. If STARTDIR is also given, it will write it there.
  • RESTART (optional, boolean) If given and True and USESCRIPT is defined, the script will loop if the program ever exits.
  • WRITEFILE (optional) If given should be a relative or absolute path to write a configuration file to.
argn   From the invocation of main (will not be altered by this function).
argv   From the invocation of main (will not be altered by this function).

AcConfiguration * AnyConfig::loadRedundantConfig ( AcConfiguration * pSource,
FILE * pfReport = NULL )

Redundant configuration handling.

This code supports some fall-back and fail-over configuration handling. The parent configuration must contain special keywords in the (specified) section for this to work:

The difference between FALLBACK and FAILOVER is that a FALLBACK configuration is considered to be identical to the PRIMARY one. In other words, it is considered a FALLBACK for the configuration itself, not the program's functionality.
FAILOVER, on the other hand, assumes that the failure of the PRIMARY configuration indicates the program should be started with some kind of 'emergency' configuration.

The following scenario is applied, depending on which of the above keywords are specified:

 if (primary_ok)
     if (copy2back_exists AND fallback_exists AND copy2back_ok) 
	       copy2back->copyTo (fallback)
     if (copy2fail_exists AND failover_exists AND copy2fail_ok) 
         copy2fail->copyTo (failover)
     return primary
 else if (secundary_exists AND secundary_ok)
     return secundary
 else if (failover_exists)
     if (fallback_exists AND fallback_ok)
         return fallback
         return failover
     if (fallback_exists AND fallback_ok)
         return fallback
         *** FAILED to load configuration ***

Remember that AnyConfig has no intrinsic knowledge of your environment or operating conditions! You must ultimately handle the various conditions yourself.

pSource   The parent configuration with the information needed to load a redundant configuration.
pfReport   If not NULL, loadRedundantConfig() will write to this file what it did. This is a textual report, meant for logging purposes.
The "best" accessible configuration. NULL if all the options failed.

Variable Documentation

bool AnyConfig::acfThrowExceptions = false

Normally AnyConfig does not throw exceptions.

If you need to figure out why things aren't working, however, you can set this flag.

Generated at Wed Nov 21 11:34:19 2001 for AnyConfig by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001