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

Generated on 3 Mar 2013 for dmlite by  doxygen 1.4.7