include/dmlite/cpp/base.h

Go to the documentation of this file.
00001 /// @file   include/dmlite/cpp/base.h
00002 /// @brief  Base interfaces.
00003 /// @author Alejandro Álvarez Ayllón <aalvarez@cern.ch>
00004 #ifndef DMLITE_CPP_BASE_H
00005 #define DMLITE_CPP_BASE_H
00006 
00007 #include "dmlite/common/config.h"
00008 #include "exceptions.h"
00009 #include <string>
00010 
00011 namespace dmlite {
00012 
00013   // Forward declarations.
00014   class StackInstance;
00015   class SecurityContext;
00016 
00017   /// Base class for interfaces.
00018   class BaseInterface {
00019    public:
00020     /// Virtual destructor
00021     virtual ~BaseInterface();
00022 
00023     /// String ID of the implementation.
00024     virtual std::string getImplId(void) const throw() = 0;
00025 
00026    protected:
00027     friend class StackInstance;
00028 
00029     /// Set the StackInstance.
00030     /// Some plugins may need to access other stacks (i.e. the pool may need the catalog)
00031     /// However, at construction time not all the stacks have been populated, so this will
00032     /// be called once all are instantiated.
00033     virtual void setStackInstance(StackInstance* si) throw (DmException);
00034 
00035     /// Set the security context.
00036     virtual void setSecurityContext(const SecurityContext* ctx) throw (DmException);
00037 
00038     /// These method allows plugins to call other plugins setStackInstance and setSecurityContext
00039     static void setStackInstance(BaseInterface* i,
00040                                  StackInstance* si) throw (DmException);
00041 
00042     static void setSecurityContext(BaseInterface*   i,
00043                                    const SecurityContext* ctx) throw (DmException);
00044   };
00045 
00046 
00047   /// Base class for factories.
00048   class BaseFactory {
00049    public:
00050     /// Virtual destructor
00051     virtual ~BaseFactory();
00052 
00053     /// Set a configuration parameter
00054     /// @param key   The configuration parameter
00055     /// @param value The value for the configuration parameter
00056     virtual void configure(const std::string& key, const std::string& value) throw (DmException);
00057   };
00058 
00059 };
00060 
00061 #endif // DMLITE_CPP_BASE_H

Generated on 28 Apr 2014 for dmlite by  doxygen 1.4.7