diff options
Diffstat (limited to 'modules/CIAO/ciao/Deployment/Handlers/CIAO_State.h')
-rw-r--r-- | modules/CIAO/ciao/Deployment/Handlers/CIAO_State.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/modules/CIAO/ciao/Deployment/Handlers/CIAO_State.h b/modules/CIAO/ciao/Deployment/Handlers/CIAO_State.h new file mode 100644 index 00000000000..557f827745a --- /dev/null +++ b/modules/CIAO/ciao/Deployment/Handlers/CIAO_State.h @@ -0,0 +1,88 @@ +/** + * @file CIAO_State.h + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * + * $Id$ + */ + +#ifndef CIAO_STATE_H +#define CIAO_STATE_H + +#include <map> +#include <string> + +#include "ace/Singleton.h" +#include "ciao/Containers/Container_BaseC.h" +#include "ccm/CCM_HomeC.h" +#include "ccm/CCM_ObjectC.h" +#include "CIAO_Locality_Handler_Export.h" +#include "ciao/Deployment/Handlers/Connection_Handler.h" + +namespace CIAO +{ + /** + * @class Deployment_State + * @brief Singleton collecting state for the instance handlers. + * + */ + class CIAO_Locality_Handler_Export Deployment_State + { + public: + + void add_container (const char *id, + CIAO::Container_ptr container); + + void remove_container (const char *id); + + CIAO::Container_ptr fetch_container (const char *id); + + const char * instance_to_container (const char *id); + + void add_home (const char *id, const char *container_id, + Components::CCMHome_ptr home); + + void remove_home (const char *id); + + Components::CCMHome_ptr fetch_home (const char *id); + + void add_component (const char *id, const char *container_id, + Components::CCMObject_ptr component); + + void remove_component (const char *id); + + Components::CCMObject_ptr fetch_component (const char *id); + + Connection_Handler connection_handler; + + private: + typedef std::map < std::string, + CIAO::Container_var > CONTAINERS; + + CONTAINERS containers_; + + typedef std::map < std::string, std::string > INSTANCE_CONTAINER; + + /// maps instance ids to containers. + INSTANCE_CONTAINER instance_container_; + + typedef std::map < std::string, + Components::CCMHome_var > HOMES; + + HOMES homes_; + + typedef std::map < std::string, + Components::CCMObject_var > COMPONENTS; + + COMPONENTS components_; + }; + + typedef ACE_Singleton <Deployment_State, + ACE_SYNCH_MUTEX> DEPLOYMENT_STATE; + +} + +CIAO_LOCALITY_HANDLER_SINGLETON_DECLARE (ACE_Singleton, + CIAO::Deployment_State, + ACE_SYNCH_MUTEX); + +#endif |