//----------------------------------------------------------------------------- // File and Version Information: // $Id: BdbConfigMap.ddl,v 1.6 1998/01/29 07:39:57 yury Exp $ // // Description: // Class BdbConfigMap: a map object for Configuration database. // Essentially, a wrapper around ooMap // // Environment: // Software developed for the BaBar Detector at the SLAC B-Factory. // // Author List: // Yury Kolomensky // // Copyright Information: // Copyright (C) 1997 Caltech // //----------------------------------------------------------------------------- #ifndef BDBCONFIGMAP_HH #define BDBCONFIGMAP_HH //----------------- // BaBar Headers -- //----------------- #include "BaBar/BaBar.hh" //------------- // C Headers -- //------------- #include //---------------------- // Base Class Headers -- //---------------------- #include "BdbConfig/BdbConfigObject.hh" //------------------------------- // Collaborating Class Headers -- //------------------------------- #include "BdbUtil/Bdb.hh" #include //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ class BdbConfigDatabase; class BdbConfigKey; class ostream; // --------------------- // -- Class Interface -- // --------------------- class BdbConfigMap : public BdbConfigObject { //------------------ // Static Members -- //------------------ public: // create an empty map static BdbHandle(BdbConfigMap) create(BdbConfigDatabase* theDatabase, const char* name); // copy static BdbHandle(BdbConfigMap) create(BdbConfigDatabase* theDatabase, const BdbConfigMap& anotherMap); static const char* className( ); public: // Constructor BdbConfigMap(const char* name ); // copy ctor BdbConfigMap(const BdbConfigMap& anotherMap ); // Destructor virtual ~BdbConfigMap( ); // Selectors inline const char* getObjectName() const; // get the name for this object virtual const char* getMyClassName( ) const; // copy method virtual BdbStatus copy(const BdbHandle(BdbConfigContObj)& containerH, BdbHandle(BdbConfigObject)& newObjectH); // Accessors BdbRef(BdbConfigObject) lookup(const char* name) const; // this one is more efficient BdbStatus lookup(const char* name, BdbHandle(BdbConfigObject)& theObjectH, bool open=false) const; bool isMember(const char* name) const; // this accessor is not a good OO practice, but I do not see a better // solution at the moment. void getMapHandle(BdbHandle(BdbMap)&) const; //Modifiers bool add(const char* name, BdbRef(BdbConfigObject)& theObject); bool remove(const char* name); bool replace(const char* name, BdbRef(BdbConfigObject)& theObject); // print method virtual void print(ostream& os) const; private: // Data members ooVString _name; // the name of the object BdbRef(BdbMap) _map; }; //------------------ // Inline methods -- //------------------ const char* BdbConfigMap::getObjectName( ) const { return _name; } #endif