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

CdbBdbObjectVisitorUserAction Class Reference

The base class for user defined actions. More...

#include <CdbBdbObjectVisitorUserAction.hh>

List of all members.

Public Types

enum  ActionType { ACTION_PROCEED, ACTION_STOP, ACTION_ERROR }
 These values will be used to indicate the user's response. More...

enum  { MAX_DATABASE = 0xFFFF }
 Total number of databases in a federation. More...


Public Member Functions

 CdbBdbObjectVisitorUserAction (const char *theSupressFile=0, const std::list< d_UShort > *theDatabasesToIgnore=0, bool verboseMode=false, bool debugMode=false)
 The constructor.

virtual ~CdbBdbObjectVisitorUserAction ()
 The destructor.

ActionType action (const ooHandle(ooObj)&theInputH, const CdbBdbObjectVisitorContext *theContext)
 Let a user to make a decision on what has to be done next.

virtual void print_statistics () const
 Print the internal counters and table onto the Standard Output.

unsigned long totalObjects () const
 Get the total number of objects visited.

unsigned long invalidObjects () const
 Get the number of invalid objects found.

unsigned int missedCounters (d_UShort theDatabaseId) const
 Get the number of times the specified database was found missing.

const std::map< d_UShort,
std::string > * 
missedDatabaseClients (d_UShort theDatabaseId) const
 Get clients of specified missing database.


Protected Member Functions

virtual ActionType userAction (const ooHandle(ooObj)&theInputH, const CdbBdbObjectVisitorContext *theContext)
 Let a user to make a decision on what has to be done next (ACTUAL USER ACTION).


Detailed Description

The base class for user defined actions.

This base class has to implemented by users willing to control the "visitor" navigation in complex graphs.

IMPLEMENTATION NOTES:

(1) This class violates CDB API convention on the inclusion of "CdbBase/CdbCommon.hh" header file to avoid STD namespace conflicts of the kind described above.

Definition at line 29 of file CdbBdbObjectVisitorUserAction.hh.


Member Enumeration Documentation

anonymous enum
 

Total number of databases in a federation.

This value defined the limits [0..MAX_DATABASE] for certain operations involving database iderntifiers.

Enumeration values:
MAX_DATABASE 

Definition at line 44 of file CdbBdbObjectVisitorUserAction.hh.

enum CdbBdbObjectVisitorUserAction::ActionType
 

These values will be used to indicate the user's response.

Enumeration values:
ACTION_PROCEED 
ACTION_STOP 
ACTION_ERROR 

Definition at line 35 of file CdbBdbObjectVisitorUserAction.hh.


Constructor & Destructor Documentation

CdbBdbObjectVisitorUserAction::CdbBdbObjectVisitorUserAction const char *    theSupressFile = 0,
const std::list< d_UShort > *    theDatabasesToIgnore = 0,
bool    verboseMode = false,
bool    debugMode = false
 

The constructor.

An optional file with a list of "known" patterns to be ignored/suppressed may be passed to the constructor. The file (if present) would be analysed and loaded into intyernal data structures. If something wrong happends during the file's translation then a run time assertion would happen.

It's also possible to specify a list of DBID-s to be avoided. These databases (if any) would not be checked for validity.

Definition at line 129 of file CdbBdbObjectVisitorUserAction.cc.

References MAX_DATABASE.

CdbBdbObjectVisitorUserAction::~CdbBdbObjectVisitorUserAction   [virtual]
 

The destructor.

Moe details...

Definition at line 185 of file CdbBdbObjectVisitorUserAction.cc.

References MAX_DATABASE.


Member Function Documentation

CdbBdbObjectVisitorUserAction::ActionType CdbBdbObjectVisitorUserAction::action const ooHandle(ooObj)&    theInputH,
const CdbBdbObjectVisitorContext   theContext
 

Let a user to make a decision on what has to be done next.

This wrapper method takes the "about-to-be-visited" link on the input. Ths link is evaluated by the method to report what's the next action should be.

The second parameter passed town to the operation is the current context description in which the link has to be evaluated.

Here is the explanation of possible responses:

ACTION_PROCEED : a caller has to proceed and visit this node.

ACTION_STOP : a caller should stop and not to propagate along this link.

ACTION_ERROR : an error has happened inside the method. Normally the caller should stop visiting any further links.

HOW IT WORKS:

  • first of all this method will verify if the passed object is valid and take the following actions if it's not:

-- check if the object's context matches one of the known patterns (if any). and if not then print diagnostic message (in verbose/debug modes) and update internal statistics for missing/corrupted databases. The action returned in this case would be ACTION_ERROR.

-- otherwise the internal statistics would not be updated (although an informational message in verbose mode saying that the problem of the missing objects has been ignored due to known pattern would be still printed.) and the method would return ACTION_STOP.

  • in the end if the passed object is valid then a user defined "userAction" application's object will be called to let a user to proceed with his/her decision in a specific context.

See also:
CdbBdbObjectVisitorUserAction::userAction()

class CdbBdbObjectVisitorContext

Definition at line 196 of file CdbBdbObjectVisitorUserAction.cc.

References ACTION_ERROR, ACTION_STOP, and userAction().

unsigned long CdbBdbObjectVisitorUserAction::invalidObjects   const [inline]
 

Get the number of invalid objects found.

Definition at line 129 of file CdbBdbObjectVisitorUserAction.hh.

unsigned int CdbBdbObjectVisitorUserAction::missedCounters d_UShort    theDatabaseId const
 

Get the number of times the specified database was found missing.

The number returned by this method would be either 0 or a positive number. Returning 0 does not mean that specified databases exsists, it just means that the databases has not been found missing (noone attempted to use it).

The database identifier must be a in the valid range [0..64k]. Otherwise a run time assertion would occure.

Definition at line 311 of file CdbBdbObjectVisitorUserAction.cc.

References MAX_DATABASE.

const std::map< d_UShort, std::string > * CdbBdbObjectVisitorUserAction::missedDatabaseClients d_UShort    theDatabaseId const
 

Get clients of specified missing database.

The result of this procedure would be either a 0 pointer or a const pointer onto a map with DBID-s and system names of clients. The map object itself would be located at a a user action object.

WARNING: This method does not return the ownership of teh map object.

The database identifier must be a in the valid range [0..64k]. Otherwise a run time assertion would occure.

Definition at line 321 of file CdbBdbObjectVisitorUserAction.cc.

References MAX_DATABASE.

void CdbBdbObjectVisitorUserAction::print_statistics   const [virtual]
 

Print the internal counters and table onto the Standard Output.

This method will print all statistics information accumulated by the current user object onto the Standard Output. This includes a list of missing databases and their clients.

This method can be overriden by a subclass to add up extra information accumulated by the subclass.

Definition at line 270 of file CdbBdbObjectVisitorUserAction.cc.

References MAX_DATABASE.

unsigned long CdbBdbObjectVisitorUserAction::totalObjects   const [inline]
 

Get the total number of objects visited.

Definition at line 125 of file CdbBdbObjectVisitorUserAction.hh.

CdbBdbObjectVisitorUserAction::ActionType CdbBdbObjectVisitorUserAction::userAction const ooHandle(ooObj)&    theInputH,
const CdbBdbObjectVisitorContext   theContext
[protected, virtual]
 

Let a user to make a decision on what has to be done next (ACTUAL USER ACTION).

This method gets called only for valid objects.

IMPLEMENTATION NOTE: In its default implementation this method would always return ACTION_PROCEED. This behaviour can be overriten by specific subclasses.

See also:
CdbBdbObjectVisitorUserAction::action()

class CdbBdbObjectVisitorContext

Definition at line 331 of file CdbBdbObjectVisitorUserAction.cc.

References ACTION_PROCEED.

Referenced by action().


The documentation for this class was generated from the following files:
Generated on Mon Dec 5 18:22:18 2005 for CDB by doxygen1.3-rc3