Scopira 20080306

register.h

00001 
00002 /*
00003  *  Copyright (c) 2007-2008    National Research Council
00004  *
00005  *  All rights reserved.
00006  *
00007  *  This material is confidential and proprietary information of
00008  *  National Research Council Canada ("Confidential Information").
00009  *  This Confidential Information may only be used and reproduced
00010  *  in accordance with the terms of the license agreement.
00011  *
00012  */
00013 
00014 #ifndef __INCLUDED_SCOPIRA_AGENT_REGISTER_H__
00015 #define __INCLUDED_SCOPIRA_AGENT_REGISTER_H__
00016 
00017 #include <map>
00018 #include <vector>
00019 
00020 #include <scopira/tool/object.h>
00021 #include <scopira/tool/uuid.h>
00022 
00023 namespace scopira
00024 {
00025   namespace agent
00026   {
00027     class register_service;
00028     class service_registrar;
00029   }
00030 }
00031 
00038 class scopira::agent::register_service
00039 {
00040   public:
00042     register_service(const std::string &taskclassname, scopira::tool::uuid serviceid);
00043 };
00044 
00048 class scopira::agent::service_registrar : public virtual scopira::tool::object
00049 {
00050   private:
00051     // maps class names to servicesd they provide
00052     typedef std::multimap<std::string, scopira::tool::uuid> service_map;
00053 
00054     service_map dm_services;
00055 
00056   public:
00058     service_registrar(void);
00060     virtual ~service_registrar();
00061 
00068     static service_registrar * instance(void);
00069 
00070     void add_service(const std::string &taskclassname, scopira::tool::uuid serviceid);
00071 
00072     void get_service(const std::string &taskclassname, std::vector<scopira::tool::uuid> &out);
00073 
00074   private:
00075     static service_registrar *dm_instance;
00076 };
00077 
00078 #endif
00079