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  

/BdbClustering/BdbFSSupportClustH.hh

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------
00002 // File:
00003 //      BdbFSSupportClustH.hh
00004 //
00005 // Description:
00006 //
00007 //      
00008 //
00009 // Environment:
00010 //      Software developed for the BaBar Detector at the SLAC B-Factory
00011 //
00012 // Author List:
00013 //      Jacek Becla                 Original Author
00014 //      Igor A. Gapoenko            Modified to use DBFS interace of BdbDomain class
00015 //
00016 // Copyright Information:
00017 //      Copyright (C) 1997      Stanford Linear Accelerator Center
00018 //
00019 //------------------------------------------------------------------------------
00020 
00021 #ifndef BDBFSSUPPORTCLUSTH_HH
00022 #define BDBFSSUPPORTCLUSTH_HH
00023 
00024 #ifndef BDB_HH
00025 #include "BdbUtil/Bdb.hh"
00026 #endif
00027 
00028 class BdbFSMgr ;
00029 class BdbDomain ;
00030 class BdbErrorSignal;
00031 
00032 class BdbFSSupportClustH {
00033 
00034 private:
00035 
00036     BdbFSMgr*        _fsMgr ;       // object managing file system operations
00037     const BdbDomain* _domain ;
00038    
00039     d_Boolean _defFS ;              // default or catalog FS
00040 
00041     ooVString   _currentPath ;      // directory or database path
00042     ooVString   _currentDbName ;    // database name
00043 
00044     d_ULong _currentAuthLevel ;
00045     ooVString _currentAuthName;
00046     d_ULong _currentDomain ;
00047 
00048     d_Boolean _quietMode;
00049 
00050 protected:
00051 
00052     BdbErrorSignal* _es;
00053 
00054 protected:
00055 
00056   // Set Methods
00057     inline void setDefFS(d_Boolean value) ;
00058     void refreshCurrentAuthLevel() ;
00059     void refreshCurrentAuthName();
00060     void refreshCurrentDomain() ;
00061     inline void strcpyPath(const char* str) ;
00062     inline void strcatPath(const char* str, d_Boolean prefix=d_True) ;
00063     inline void strcpyDbName(const char* str) ;
00064     inline void strcatDbName(const char* str, d_Boolean prefix=d_True) ;
00065     inline void strcatBoth(const char* str) ;
00066     inline void resetBoth() ;
00067 
00068   // Operations
00069 
00070     BdbStatus prepareBaseDirSpec(d_Boolean defaultFS) ;
00071     BdbStatus prepareMetadataSpec();
00072     BdbStatus prepareDomainSpec(d_Boolean defaultFS) ;
00073     BdbStatus prepareNameSpec(d_Boolean defaultFS) ;
00074     BdbStatus prepareConfigDBSpec() ;
00075 
00076     BdbStatus buildBaseDirectories(d_Boolean defaultFS=d_False) ;
00077     BdbStatus makeMetadataDir();
00078 
00079     BdbStatus verifyDiskSpace(d_Boolean* rebuildDb) ;
00080     void setDbNameAndPath(const char* name, const char* path);
00081     
00082   // Get Methods
00083 
00084     inline BdbFSMgr* fsMgr() ;
00085     const BdbDomain* domain() const ;
00086 
00087     inline d_Boolean defFS() const ;
00088     inline const char* currentDbName() const ;
00089     inline const char* currentPath() const ;
00090     const char* currentHost() ;
00091     const char* baseDirectory() ;
00092     d_Boolean authLevelChanged() const ;
00093     d_Boolean authNameChanged() const;
00094         d_Boolean domainChanged() const ;
00095     d_Boolean allowRemoteFS() const ;
00096 
00097   // Constructor(s)
00098 
00099     BdbFSSupportClustH(d_Boolean quiet=d_False) ; // Should not be here. For conditions clustering hint only
00100     BdbFSSupportClustH(const BdbDomain& domain, 
00101                        d_Boolean quiet=d_False) ;
00102     BdbFSSupportClustH(const BdbFSSupportClustH& obj) ;
00103 
00104 public:
00105 
00106   // Destructor
00107 
00108     virtual ~BdbFSSupportClustH() ;
00109 
00110     d_Boolean quietMode() const { return _quietMode; }
00111 } ;
00112 
00113 // ------------------------------------------------------
00114 // --  I  N  L  I  N  E      F  U  N  C  T  I  O  N  S --
00115 // ------------------------------------------------------
00116 
00117 inline void 
00118 BdbFSSupportClustH::setDefFS(d_Boolean value)
00119 {
00120     _defFS = value ;
00121 }
00122 
00123 inline void 
00124 BdbFSSupportClustH::strcpyPath(const char* str)
00125 {
00126     if ( str != (char*) 0 ) {
00127         _currentPath.resize(strlen(str)+1) ;
00128     }
00129     _currentPath = str ;
00130 }
00131 
00132 inline void 
00133 BdbFSSupportClustH::strcatPath(const char* str, d_Boolean prefix)
00134 {
00135     if ( str == (char*) 0 ) {
00136         return ;
00137     }
00138 
00139     int len = _currentPath.size() + strlen(str) + 1 ;
00140 
00141     _currentPath.resize(len) ;
00142 
00143     if ( prefix ) {
00144         _currentPath += "/" ;
00145         
00146     }
00147     _currentPath += str ;
00148 }
00149 
00150 inline void 
00151 BdbFSSupportClustH::strcpyDbName(const char* str)
00152 {
00153     if ( str != (char*) 0 ) {
00154         _currentDbName.resize(strlen(str)+1) ;
00155     }
00156     _currentDbName = str ;
00157 }
00158 
00159 inline void 
00160 BdbFSSupportClustH::strcatDbName(const char* str, d_Boolean prefix)
00161 {
00162     if ( str == (char*) 0 ) {
00163         return ;
00164     }
00165 
00166     int len = _currentDbName.size() + strlen(str) + 1 ;
00167 
00168     _currentDbName.resize(len) ;
00169     
00170     if ( prefix ) {
00171         _currentDbName += "_" ;
00172         
00173     }
00174     _currentDbName += str ;
00175 }
00176 
00177 inline void 
00178 BdbFSSupportClustH::strcatBoth(const char* str)
00179 {
00180     strcatDbName(str) ;
00181     strcatPath(str) ;
00182 }
00183 
00184 inline void 
00185 BdbFSSupportClustH::resetBoth()
00186 {  
00187     _currentPath   = "" ;
00188     _currentDbName = "" ;
00189 }
00190 
00191 inline const char* 
00192 BdbFSSupportClustH::currentDbName() const
00193 {  return _currentDbName.head() ;   }
00194 
00195 inline const char* 
00196 BdbFSSupportClustH::currentPath() const
00197 {  return _currentPath.head() ;  }
00198 
00199 inline d_Boolean 
00200 BdbFSSupportClustH::defFS() const
00201 {  return _defFS ;   }
00202 
00203 inline BdbFSMgr* 
00204 BdbFSSupportClustH::fsMgr()
00205 {  return _fsMgr ;   }
00206 
00207 #endif /* BDBFSSUPPORTCLUSTH_HH */

 


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

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