//----------------------------------------------------------------------------- // // File and Version Information: // $Id: BdbConfigDirectCache.hh,v 1.2 1998/01/19 12:25:25 yury Exp $ // // Description: // Class BdbConfigDirectCache: caches a configuration database // object for repeated access. This class implements direct access // to the database via BdbConfigDatabase::fetch() call. // // Environment: // Software developed for the BaBar Detector at the SLAC B-Factory. // // Author List: // Yury Kolomensky original author // // Copyright Information: // Copyright (C) 1998 California Institute of Technology // //----------------------------------------------------------------------------- #ifndef BDBCONFIGDIRECTCACHE_HH #define BDBCONFIGDIRECTCACHE_HH //----------------------- // Base Class Headers -- //----------------------- #include "BdbConfig/BdbConfigCache.hh" //------------------------------- // Collaborating Class Headers -- //------------------------------- #include "BdbConfig/BdbConfigObject.hh" #include "rw/cstring.h" //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ class BdbConfigDatabase; class BdbConfigKey; // --------------------- // -- Class Interface -- // --------------------- class BdbConfigDirectCache : public BdbConfigCache { public: // // Constructor: a cache is uniquely defined by the path to the object and // (possibly) a secondary key // BdbConfigDirectCache(const char* theDatabaseName, const char* theClassName, const char* secondaryKey=0); // Destructor virtual ~BdbConfigDirectCache( ); // method to test the cache virtual bool isCacheValid(const BdbConfigKey& theKey ); // Access the relevant strings const char* secondaryKey() const { return _secondaryKey; } protected: // Fetch the object, given the ConfigKey. virtual BdbHandle(BdbConfigObject) fetch( const BdbConfigKey& theKey ); // Data members char* _secondaryKey; // secondary key BdbConfigDatabase* _database; // database BdbConfigKey _configKey; // cache it for convenience }; #endif