Bdb packages | Design docs | Source docs | Guidelines | Recent releases

Search | Site Map .

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

/BdbTrees/BdbDbRegistrator.hh

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------
00002 // File:
00003 //      BdbDbRegistrator.hh
00004 //
00005 // Description:
00006 //      Class BdbDbRegistrator
00007 //
00008 //      The class is responsible for registration of a (newly created) database
00009 //      in a BdbTreeNode structure, which is used by the data browser
00010 //
00011 //
00012 // Environment:
00013 //      Software developed for the BaBar Detector at the SLAC B-Factory
00014 //
00015 // Author List:
00016 //      Jacek Becla                Original Author
00017 //
00018 // Copyright Information:
00019 //      Copyright (C) 1997-98      Stanford Linear Accelerator Center
00020 //
00021 //------------------------------------------------------------------------------
00022 
00023 #ifndef BDBDBREGISTRATOR_HH
00024 #define BDBDBREGISTRATOR_HH
00025 
00026 
00027 #ifndef BDBD_HH
00028 #include "BdbUtil/Bdb.hh"
00029 #endif
00030 
00031 #ifndef BDBTREENODE_HH
00032 #include "BdbTrees/BdbTreeNode.hh"
00033 #endif
00034 
00035 #ifndef BDBDBREGISTRATORBASE_HH
00036 #include "BdbAccess/BdbDbRegistratorBase.hh"
00037 #endif
00038 
00039 
00040 class BdbDbRegistrator : public BdbDbRegistratorBase
00041 {
00042     enum TheAction { IDLE = 0, DO_REG = 1, DO_UNREG = -1 } ;
00043     
00044 // -----------------
00045 // Static Members --
00046 // -----------------
00047 public:
00048 
00049     static const char* const _rootName ;
00050     static const char* const _hostInfoRootName ;
00051     
00052     
00053 // ------------------
00054 // Private Members --
00055 // ------------------
00056 private:
00057 
00058     char* _dbName ;
00059     char* _dbHost ;
00060     char* _dbPath ;
00061 
00062     BdbTreeNode _theNode ;
00063     char*   _subNodeName ;
00064 
00065     ooTrans _transaction ;
00066 
00067     //BdbHandle(BdbPersObj) _dbSimulator ;
00068     
00069     TheAction theAction ;    // tweak: do not repeat all for unregistration
00070                              // do the same as for registration and perform 
00071                             // different action at the very end
00072     
00073 // --------------------
00074 // Private Functions --
00075 // --------------------
00076 private:
00077 
00078     BdbStatus inSeparateContextRegisterDb() ;
00079 
00080     BdbStatus domainBranch() ;
00081     BdbStatus hostBranch() ;
00082 
00083     BdbStatus moveToRootChild(const char* name) ;
00084     BdbStatus oneLevelDown() ;
00085     BdbStatus finalRegistration() ;
00086     char* prepareBaseDir(char*& buf) ;
00087 
00088 
00089     // Get Methods
00090     inline const char* dbName() const ;
00091     inline const char* dbHost() const ;
00092     inline const char* dbPath() const ;
00093 
00094     BdbStatus updateAndWait(BdbHandleAny& theObj) ;
00095 
00096     
00097 // -------------------
00098 // Public Interface --
00099 // -------------------
00100 public:
00101 
00102     // Constructor(s)
00103     BdbDbRegistrator() ;
00104     
00105     // Destructor
00106     virtual ~BdbDbRegistrator() ;
00107 
00108     virtual BdbStatus registerDb(const BdbDbInfo& dbInfo) ;
00109     virtual BdbStatus unregisterDb(const BdbDbInfo& dbInfo) ;
00110     static char* replaceChar(char* inString, char fromChar, char toChar) ;
00111 } ;
00112 
00113 
00114 // ------------------------------------------------------
00115 // --  I  N  L  I  N  E      F  U  N  C  T  I  O  N  S --
00116 // ------------------------------------------------------
00117 
00118 inline const char* BdbDbRegistrator::dbName() const  { return _dbName ; }
00119 inline const char* BdbDbRegistrator::dbHost() const  { return _dbHost ; }
00120 inline const char* BdbDbRegistrator::dbPath() const  { return _dbPath ; }
00121 
00122 
00123 #endif /* BDBDBREGISTRATOR_HH */

 


BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us

Page Owner: Jacek Becla
Last Update: October 04, 2002