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

CdbBdbPrintObjectTree.hh

Go to the documentation of this file.
00001 #ifndef CDBBDB_PRINT_OBJECT_TREE_HH
00002 #define CDBBDB_PRINT_OBJECT_TREE_HH
00003 
00004 // File and Version Information:
00005 //      $Id: CdbBdbPrintObjectTree.hh,v 1.2 2004/10/21 20:35:51 gapon Exp $
00006 
00007 #include "CdbBase/CdbCommon.hh"
00008 
00009 #include <oo.h>     // ooRef(ooObj), ooHandle(ooObj)
00010 
00011 // Forward declarations
00012 
00013 class CdbBdbPrintObjectTreeUserAction;
00014 class CdbBdbPrintObjectTreeImpl;
00015 
00016 /// This class provides "print object tree" facility for persistent objects.
00017 /**
00018   * This facility uses the Objectivity/DB Active Schema API to navigate accross
00019   * an arbitrary graph of objects by visiting and printing OID-s of each node
00020   * in the graph. Specified (if any) user defined action will be called for each node.
00021   * Each node is visited just once. But it (the object) still would be printed.
00022   * A user defined action object provides a feedback wether the operation should
00023   * propagate beyond a visited node or it should stop at this node or it should break
00024   * visiting due to a error.
00025   * 
00026   * IMPLEMENTATION NOTES:
00027   *
00028   *   (1) This class uses PIMPL idiom to protect end users
00029   *       of the class from being exposed to the buggy header
00030   *       files of the Objectivity/DB Active Schema API.
00031   *
00032   *   (2) This class violates CDB API convention on the inclusion
00033   *       of "CdbBase/CdbCommon.hh" header file to avoid STD namespace
00034   *       conflicts of the kind described above.
00035   *
00036   * ATTENTION:
00037   *
00038   *   - This group of classes has nothing in common with the famous "Visitor"
00039   *     pattern ("Go4").
00040   */
00041 class CdbBdbPrintObjectTree {
00042 
00043 private:
00044 
00045   /// Default constructor (NOT IMPLEMENTED)
00046   /**
00047     * There is no way to get the consistent object's context without user defined
00048     * parameters passed through the normal constructor.
00049     */
00050     CdbBdbPrintObjectTree( );
00051 
00052 public:
00053 
00054   /// Normal constructor
00055   /**
00056     * Sets the initial context for the profiling. This context can be reused
00057     * accross multiple calls to the profiling method itself.
00058     *
00059     * A non-zero pointer onto a user defined action is required.
00060     *
00061     * The ownership to a user action does not get transferred
00062     * into the current object. We may need non-const pointer to let a user
00063     * to maintain the context of user action between calls.
00064     *
00065     * Note, a user action object can be overriden by passing another user action
00066     * object by calling a special "setUserAction" method.
00067     */
00068     CdbBdbPrintObjectTree( CdbBdbPrintObjectTreeUserAction* theUserAction,
00069                                                        bool verboseMode = false,
00070                                                        bool debugMode   = false );
00071 
00072   /// Destructor
00073   /**
00074     * More details...
00075     */
00076     virtual ~CdbBdbPrintObjectTree( );
00077 
00078   /// Visit the specified object
00079   /**
00080     * The operation will return "true" in case of success, it will return "false"
00081     * in case of any errors.
00082     */
00083     bool print( const ooHandle(ooObj)& theInputH );
00084 
00085   /// Set user action
00086   /**
00087     * If 0 pointer is passed then the current user action will be reset
00088     * and it will not be called anymore.
00089     *
00090     * The method will return a pointer onto the previous action (if any).
00091     *
00092     * @see class CdbBdbPrintObjectTreeUserAction
00093     */
00094     CdbBdbPrintObjectTreeUserAction* setUserAction( CdbBdbPrintObjectTreeUserAction* theUserAction );
00095 
00096 private:
00097 
00098   // Here is my implementation
00099 
00100     CdbBdbPrintObjectTreeImpl* _myImpl;
00101 };
00102 
00103 #endif  // CDBBDB_PRINT_OBJECT_TREE_HH

Generated on Mon Dec 5 18:22:00 2005 for CDB by doxygen1.3-rc3