DABC (Data Acquisition Backbone Core)  2.9.9
Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends
dabc::ConfigBase Class Reference

Base class to read configuration from xml file. More...

#include <dabc/ConfigBase.h>

Inheritance diagram for dabc::ConfigBase:
dabc::Configuration

Public Member Functions

void AddCmdVariable (const char *name, const char *value)
 Add variable from command line. More...
 
 ConfigBase (const char *fname=0)
 
std::string ContextName (unsigned id)
 returns name of specified context More...
 
int GetVersion () const
 
bool IsOk () const
 
bool NodeActive (unsigned id)
 returns configured (initial) state of the node More...
 
std::string NodeName (unsigned id)
 returns nodename of specified context More...
 
int NodePort (unsigned id)
 returns communication port of specified context More...
 
unsigned NumNodes ()
 returns number of nodes in xml file More...
 
std::string ResolveEnv (const std::string &arg, int id=-1)
 Replaces entries like ${name} be variable value. More...
 
std::string SshArgs (unsigned id=0, const char *skind="run", const char *topcfgfile=0, const char *topworkdir=0)
 method used by run.sh script to produce command line More...
 
 ~ConfigBase ()
 

Protected Types

enum  ESshArgsKinds {
  kindTest , kindCopy , kindStart , kindRun ,
  kindStop , kindKill , kindGetlog , kindDellog
}
 

Protected Member Functions

std::string Find1 (XMLNodePointer_t node, const std::string &dflt, const char *sub1, const char *sub2=0, const char *sub3=0)
 Search first entry for item sub1/sub2/sub3 in specified node First tries full path, than found sub1 and path sub2/sub3. More...
 
XMLNodePointer_t FindChild (XMLNodePointer_t node, const char *name)
 
XMLNodePointer_t FindContext (unsigned id)
 
XMLNodePointer_t FindItemMatch (XMLNodePointer_t &lastmatch, XMLNodePointer_t node, const char *sub1=0, const char *sub2=0, const char *sub3=0)
 
XMLNodePointer_t FindMatch (XMLNodePointer_t lastmatch, XMLNodePointer_t node, const char *sub1=0, const char *sub2=0, const char *sub3=0)
 
std::string FindN (XMLNodePointer_t node, XMLNodePointer_t &prev, const char *sub1, const char *sub2=0, const char *sub3=0)
 
const char * GetAttr (XMLNodePointer_t node, const char *attr, const char *defvalue=0)
 
std::string GetAttrValue (XMLNodePointer_t node, const char *name)
 
std::string GetEnv (const char *name)
 
int GetIntAttr (XMLNodePointer_t node, const char *attr, int defvalue=0)
 
std::string GetNodeValue (XMLNodePointer_t node)
 
bool NodeMaskMatch (XMLNodePointer_t node, XMLNodePointer_t mask)
 
XMLNodePointer_t RootNode ()
 
XMLNodePointer_t Variables ()
 

Static Protected Member Functions

static bool IsContextNode (XMLNodePointer_t node)
 Identifies, if node can be identified as valid context - no any wildcards in names. More...
 
static bool IsNodeName (XMLNodePointer_t node, const char *name)
 
static bool IsWildcard (const char *str)
 

Protected Attributes

std::string envContext
 
std::string envDABCNODEID
 
std::string envDABCNUMNODES
 
std::string envDABCSYS
 
std::string envDABCUSERDIR
 
std::string envDABCWORKDIR
 
std::string envHost
 
XMLNodePointer_t fCmdVariables
 
XMLDocPointer_t fDoc
 
XMLNodePointer_t fVariables
 
int fVersion
 

Friends

class ConfigIO
 

Detailed Description

Base class to read configuration from xml file.

Use also in dabc_xml executable to extract basic information from xml files. For instance, number of nodes or context port number

Definition at line 104 of file ConfigBase.h.

Member Enumeration Documentation

◆ ESshArgsKinds

Enumerator
kindTest 
kindCopy 
kindStart 
kindRun 
kindStop 
kindKill 
kindGetlog 
kindDellog 

Definition at line 109 of file ConfigBase.h.

Constructor & Destructor Documentation

◆ ConfigBase()

dabc::ConfigBase::ConfigBase ( const char *  fname = 0)

Definition at line 94 of file ConfigBase.cxx.

◆ ~ConfigBase()

dabc::ConfigBase::~ConfigBase ( )

Definition at line 121 of file ConfigBase.cxx.

Member Function Documentation

◆ RootNode()

dabc::XMLNodePointer_t dabc::ConfigBase::RootNode ( )
protected

Definition at line 398 of file ConfigBase.cxx.

◆ Variables()

dabc::XMLNodePointer_t dabc::ConfigBase::Variables ( )
protected

Definition at line 131 of file ConfigBase.cxx.

◆ NodeMaskMatch()

bool dabc::ConfigBase::NodeMaskMatch ( XMLNodePointer_t  node,
XMLNodePointer_t  mask 
)
protected

Definition at line 218 of file ConfigBase.cxx.

◆ FindItemMatch()

dabc::XMLNodePointer_t dabc::ConfigBase::FindItemMatch ( XMLNodePointer_t lastmatch,
XMLNodePointer_t  node,
const char *  sub1 = 0,
const char *  sub2 = 0,
const char *  sub3 = 0 
)
protected

Definition at line 192 of file ConfigBase.cxx.

◆ FindMatch()

dabc::XMLNodePointer_t dabc::ConfigBase::FindMatch ( XMLNodePointer_t  lastmatch,
XMLNodePointer_t  node,
const char *  sub1 = 0,
const char *  sub2 = 0,
const char *  sub3 = 0 
)
protected

Definition at line 253 of file ConfigBase.cxx.

◆ Find1()

std::string dabc::ConfigBase::Find1 ( XMLNodePointer_t  node,
const std::string &  dflt,
const char *  sub1,
const char *  sub2 = 0,
const char *  sub3 = 0 
)
protected

Search first entry for item sub1/sub2/sub3 in specified node First tries full path, than found sub1 and path sub2/sub3.

Definition at line 304 of file ConfigBase.cxx.

◆ FindN()

std::string dabc::ConfigBase::FindN ( XMLNodePointer_t  node,
XMLNodePointer_t prev,
const char *  sub1,
const char *  sub2 = 0,
const char *  sub3 = 0 
)
protected

Definition at line 322 of file ConfigBase.cxx.

◆ GetEnv()

std::string dabc::ConfigBase::GetEnv ( const char *  name)
protected

Definition at line 523 of file ConfigBase.cxx.

◆ IsNodeName()

bool dabc::ConfigBase::IsNodeName ( XMLNodePointer_t  node,
const char *  name 
)
staticprotected

Definition at line 160 of file ConfigBase.cxx.

◆ GetAttr()

const char * dabc::ConfigBase::GetAttr ( XMLNodePointer_t  node,
const char *  attr,
const char *  defvalue = 0 
)
protected

Definition at line 169 of file ConfigBase.cxx.

◆ GetIntAttr()

int dabc::ConfigBase::GetIntAttr ( XMLNodePointer_t  node,
const char *  attr,
int  defvalue = 0 
)
protected

Definition at line 175 of file ConfigBase.cxx.

◆ GetNodeValue()

std::string dabc::ConfigBase::GetNodeValue ( XMLNodePointer_t  node)
protected

Definition at line 284 of file ConfigBase.cxx.

◆ GetAttrValue()

std::string dabc::ConfigBase::GetAttrValue ( XMLNodePointer_t  node,
const char *  name 
)
protected

Definition at line 292 of file ConfigBase.cxx.

◆ FindChild()

dabc::XMLNodePointer_t dabc::ConfigBase::FindChild ( XMLNodePointer_t  node,
const char *  name 
)
protected

Definition at line 181 of file ConfigBase.cxx.

◆ FindContext()

dabc::XMLNodePointer_t dabc::ConfigBase::FindContext ( unsigned  id)
protected

Definition at line 421 of file ConfigBase.cxx.

◆ IsWildcard()

bool dabc::ConfigBase::IsWildcard ( const char *  str)
staticprotected

Definition at line 391 of file ConfigBase.cxx.

◆ IsContextNode()

bool dabc::ConfigBase::IsContextNode ( XMLNodePointer_t  node)
staticprotected

Identifies, if node can be identified as valid context - no any wildcards in names.

Definition at line 404 of file ConfigBase.cxx.

◆ IsOk()

bool dabc::ConfigBase::IsOk ( ) const
inline

Definition at line 177 of file ConfigBase.h.

◆ GetVersion()

int dabc::ConfigBase::GetVersion ( ) const
inline

Definition at line 179 of file ConfigBase.h.

◆ NumNodes()

unsigned dabc::ConfigBase::NumNodes ( )

returns number of nodes in xml file

Definition at line 334 of file ConfigBase.cxx.

◆ NodeName()

std::string dabc::ConfigBase::NodeName ( unsigned  id)

returns nodename of specified context

Definition at line 349 of file ConfigBase.cxx.

◆ NodePort()

int dabc::ConfigBase::NodePort ( unsigned  id)

returns communication port of specified context

Definition at line 358 of file ConfigBase.cxx.

◆ NodeActive()

bool dabc::ConfigBase::NodeActive ( unsigned  id)

returns configured (initial) state of the node

Definition at line 371 of file ConfigBase.cxx.

◆ ContextName()

std::string dabc::ConfigBase::ContextName ( unsigned  id)

returns name of specified context

Definition at line 379 of file ConfigBase.cxx.

◆ SshArgs()

std::string dabc::ConfigBase::SshArgs ( unsigned  id = 0,
const char *  skind = "run",
const char *  topcfgfile = 0,
const char *  topworkdir = 0 
)

method used by run.sh script to produce command line

Definition at line 529 of file ConfigBase.cxx.

◆ ResolveEnv()

std::string dabc::ConfigBase::ResolveEnv ( const std::string &  arg,
int  id = -1 
)

Replaces entries like ${name} be variable value.

Definition at line 440 of file ConfigBase.cxx.

◆ AddCmdVariable()

void dabc::ConfigBase::AddCmdVariable ( const char *  name,
const char *  value 
)

Add variable from command line.

Definition at line 151 of file ConfigBase.cxx.

Friends And Related Function Documentation

◆ ConfigIO

friend class ConfigIO
friend

Definition at line 106 of file ConfigBase.h.

Field Documentation

◆ fDoc

XMLDocPointer_t dabc::ConfigBase::fDoc
protected

Definition at line 111 of file ConfigBase.h.

◆ fVersion

int dabc::ConfigBase::fVersion
protected

Definition at line 112 of file ConfigBase.h.

◆ fCmdVariables

XMLNodePointer_t dabc::ConfigBase::fCmdVariables
protected

Definition at line 113 of file ConfigBase.h.

◆ fVariables

XMLNodePointer_t dabc::ConfigBase::fVariables
protected

Definition at line 114 of file ConfigBase.h.

◆ envDABCSYS

std::string dabc::ConfigBase::envDABCSYS
protected

Definition at line 117 of file ConfigBase.h.

◆ envDABCUSERDIR

std::string dabc::ConfigBase::envDABCUSERDIR
protected

Definition at line 118 of file ConfigBase.h.

◆ envDABCWORKDIR

std::string dabc::ConfigBase::envDABCWORKDIR
protected

Definition at line 119 of file ConfigBase.h.

◆ envDABCNODEID

std::string dabc::ConfigBase::envDABCNODEID
protected

Definition at line 120 of file ConfigBase.h.

◆ envDABCNUMNODES

std::string dabc::ConfigBase::envDABCNUMNODES
protected

Definition at line 121 of file ConfigBase.h.

◆ envHost

std::string dabc::ConfigBase::envHost
protected

Definition at line 122 of file ConfigBase.h.

◆ envContext

std::string dabc::ConfigBase::envContext
protected

Definition at line 123 of file ConfigBase.h.


The documentation for this class was generated from the following files: