22 #ifndef USMODULECONTEXT_H_
23 #define USMODULECONTEXT_H_
27 #include "usListenerFunctors_p.h"
39 class ModuleContextPrivate;
107 Module* GetModule()
const;
116 Module* GetModule(
long id)
const;
124 Module* GetModule(
const std::string& name);
136 std::vector<Module*> GetModules()
const;
234 InterfaceMap servicePointers = MakeInterfaceMap<S>(service);
235 return RegisterService(servicePointers, properties);
265 template<
class I1,
class I2,
class Impl>
268 InterfaceMap servicePointers = MakeInterfaceMap<I1, I2>(impl);
269 return RegisterService(servicePointers, properties);
294 template<
class I1,
class I2,
class I3,
class Impl>
297 InterfaceMap servicePointers = MakeInterfaceMap<I1, I2, I3>(impl);
298 return RegisterService(servicePointers, properties);
330 InterfaceMap servicePointers = MakeInterfaceMap<S>(factory);
331 return RegisterService(servicePointers, properties);
359 template<
class I1,
class I2>
362 InterfaceMap servicePointers = MakeInterfaceMap<I1,I2>(factory);
363 return RegisterService(servicePointers, properties);
388 template<
class I1,
class I2,
class I3>
391 InterfaceMap servicePointers = MakeInterfaceMap<I1,I2,I3>(factory);
392 return RegisterService(servicePointers, properties);
440 std::vector<ServiceReferenceU> GetServiceReferences(
const std::string& clazz,
const std::string& filter = std::string());
468 std::string clazz = us_service_interface_iid<S>();
469 if (clazz.empty())
throw ServiceException(
"The service interface class has no US_DECLARE_SERVICE_INTERFACE macro");
470 typedef std::vector<ServiceReferenceU> BaseVectorT;
471 BaseVectorT serviceRefs = GetServiceReferences(clazz, filter);
472 std::vector<ServiceReference<S> > result;
473 for(BaseVectorT::const_iterator i = serviceRefs.begin(); i != serviceRefs.end(); ++i)
475 result.push_back(ServiceReference<S>(*i));
532 std::string clazz = us_service_interface_iid<S>();
533 if (clazz.empty())
throw ServiceException(
"The service interface class has no US_DECLARE_SERVICE_INTERFACE macro");
534 return ServiceReference<S>(GetServiceReference(clazz));
587 void* GetService(
const ServiceReferenceBase& reference);
614 const ServiceReferenceBase& baseRef = reference;
615 return reinterpret_cast<S*
>(GetService(baseRef));
679 bool UngetService(
const ServiceReferenceBase& reference);
682 const std::string& filter = std::string());
740 const std::string& filter = std::string())
742 AddServiceListener(ServiceListenerMemberFunctor(receiver, callback),
743 static_cast<void*
>(receiver), filter);
764 RemoveServiceListener(ServiceListenerMemberFunctor(receiver, callback),
765 static_cast<void*
>(receiver));
788 AddModuleListener(ModuleListenerMemberFunctor(receiver, callback),
789 static_cast<void*
>(receiver));
810 RemoveModuleListener(ModuleListenerMemberFunctor(receiver, callback),
811 static_cast<void*
>(receiver));
825 std::string GetDataFile(
const std::string& filename)
const;
831 friend class ModulePrivate;
840 const std::string& filter);
841 void RemoveServiceListener(
const ServiceListener& delegate,
void* data);
843 void AddModuleListener(
const ModuleListener& delegate,
void* data);
844 void RemoveModuleListener(
const ModuleListener& delegate,
void* data);
846 ModuleContextPrivate *
const d;