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  

/BdbClusteringServer/BdbSrvAbsBaseClustH.hh

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------
00002 // File:
00003 //      BdbSrvAbsBaseClustH.hh
00004 //
00005 // Description:
00006 //      Abstract class
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 //
00015 // Copyright Information:
00016 //      Copyright (C) 1997      Stanford Linear Accelerator Center
00017 //
00018 //------------------------------------------------------------------------------
00019 
00020 #ifndef BDBSRVABSBASECLUSTH_HH
00021 #define BDBSRVABSBASECLUSTH_HH
00022 
00023 #include "BdbUtil/Bdb.hh"
00024 #include "BdbApplication/BdbDomain.hh"
00025 #include "BbrStdUtils/CollectionUtils.hh"
00026 
00027 class BdbComponent;
00028 class BdbClSrvCRef;
00029 #include <set>
00030 #include <vector>
00031 #include <string>
00032 class BdbErrorSignal;
00033 
00034 
00035 class BdbSrvAbsBaseClustH : public BdbClusteringHint
00036 {
00037 private:
00038 
00039     static std::set<BdbClSrvCRef*,babar::Collection::PtrLess>*         _contsToBeReturned;
00040     
00041 protected: // temporarily for BdbSpClustering hint Jacek
00042 
00043     const BdbDomain*      _domain;
00044 
00045 private:
00046 
00047     BdbDomain::AuthLevels _authLevel;
00048     char*                 _authName;
00049     char*                 _compName;
00050     char*                 _streamName;
00051 
00052     d_Boolean             _compChanged;
00053     d_Boolean             _streamChanged;
00054 
00055     d_ULong               _maxNoPages;  // exceeding this value == full container
00056     
00057     std::vector<std::string>*       _usedDbs;     // list of all databases which have been used
00058 
00059     std::set<BdbClSrvCRef*,babar::Collection::PtrLess>*                _assignedConts; // set of all containers assigned to 
00060                                           // this clustering hint instance
00061     BdbClSrvCRef*              _currentRef;    // pointer to BdbClSrvCRef representing
00062                                           // currently used container
00063 
00064     d_ULong               _recentTransID;
00065     d_ULong               _maxWaitTime; // max time I should wait for each container to be opened
00066     d_Boolean             _quietMode;
00067     
00068     d_Boolean             _newDbFlag;
00069     d_Boolean             _newContFlag;
00070 
00071 protected:
00072 
00073     BdbErrorSignal*       _es;
00074     d_Boolean             _changeAuthLevel;
00075 
00076 private:
00077 
00078     BdbStatus internalSetComp(const char* name, d_Boolean applyRestr);
00079     static d_Boolean myStrcmp(const char* s1, const char* s2);
00080     
00081     // ----------------------
00082     // Protected functions --
00083     // ----------------------
00084 protected:
00085 
00086     // Constructor(s)
00087     BdbSrvAbsBaseClustH(const BdbDomain& domain, 
00088                      d_ULong maxWaitTime=7200, 
00089                      d_Boolean quiet=d_False);
00090     BdbSrvAbsBaseClustH(const BdbSrvAbsBaseClustH& obj);
00091 
00092     // Operations
00093     virtual BdbStatus setStream(const char* name);
00094     BdbStatus requestContainer();
00095     BdbStatus lockTheHint();
00096     BdbStatus refreshSettings();
00097     d_Boolean conditionsChanged();
00098     virtual void setHint( BdbHandleAny& theHint );
00099     virtual void setHint( BdbRefAny& theHint );
00100     virtual BdbRefAny resetHint();
00101 
00102     // registry of used databases
00103     BdbStatus registerCurrentDbAsUsed();
00104     void printUsedDbs() const;
00105 
00106     // Get methods
00107     inline d_ULong maxWaitTime() const;
00108     d_Boolean currentContIsFull();
00109     
00110     
00111     BdbStatus changeAuthL(BdbDomain::AuthLevels authLevel, 
00112                           const char* name=0);
00113 
00114     d_Boolean transactionChanged();
00115     
00116 // -------------------
00117 // Public Interface --
00118 // -------------------
00119 public:
00120 
00121     // Destructor
00122     virtual ~BdbSrvAbsBaseClustH();
00123 
00124     virtual BdbRefAny hint();
00125 
00126     virtual void prepareHint();
00127 
00128     virtual BdbStatus setComponent(const char* name);
00129     BdbStatus setMaxWaitTime(d_ULong value);
00130 
00131     d_Boolean compIsValid() const  { return 0 != _compName; }
00132     const char* compName() const   { return _compName;      }
00133     const char* streamName() const { return _streamName;    }
00134     
00135     d_Boolean newDatabaseCreated();
00136     d_Boolean newContainerCreated();
00137 
00138     virtual void      internalCollectReturnedConts();       // should be static
00139     virtual BdbStatus internalReturnCollectedConts() const; // should be static
00140       // but cannot be because BdbModules should not depend on this package
00141       // so we call it using 'virtual'
00142 };
00143 
00144 
00145 // ------------------------------------------------------
00146 // --  I  N  L  I  N  E      F  U  N  C  T  I  O  N  S --
00147 // ------------------------------------------------------
00148 
00149 inline d_ULong BdbSrvAbsBaseClustH::maxWaitTime() const  { return _maxWaitTime; }
00150 
00151 #endif /* BDBSRVABSBASECLUSTH_HH */

 


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

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