This category includes classes related to the C++ Micro Services component. More...
Namespaces | |
ServiceConstants | |
Classes | |
class | Module |
Represents a CppMicroServices module. More... | |
struct | ModuleActivator |
Customizes the starting and stopping of a CppMicroServices module. More... | |
class | ModuleContext |
A module's execution context within the framework. More... | |
class | ModuleEvent |
An event from the Micro Services framework describing a module lifecycle change. More... | |
struct | ModuleEventHook |
Module Event Hook Service. More... | |
struct | ModuleFindHook |
Module Context Hook Service. More... | |
class | ModuleRegistry |
Here we handle all the modules that are loaded in the framework. More... | |
class | ModuleResource |
Represents a resource (text file, image, etc.) embedded in a CppMicroServices module. More... | |
class | ModuleResourceStream |
An input stream class for ModuleResource objects. More... | |
class | ModuleSettings |
Query and set certain properties of the CppMicroServices library. More... | |
class | ModuleVersion |
Version identifier for CppMicroServices modules. More... | |
class | LDAPFilter |
An RFC 1960-based Filter. More... | |
struct | PrototypeServiceFactory |
A factory for prototype scope services. More... | |
class | ServiceEvent |
An event from the Micro Services framework describing a service lifecycle change. More... | |
struct | ServiceEventListenerHook |
Service Event Listener Hook Service. More... | |
class | ServiceException |
A service exception used to indicate that a service problem occurred. More... | |
class | ServiceFactory |
A factory for module scope services. More... | |
struct | ServiceFindHook |
Service Find Hook Service. More... | |
struct | InterfaceType< Interface > |
A helper type used in several methods to get proper method overload resolutions. More... | |
struct | MakeInterfaceMap< I1, I2, I3 > |
Helper class for constructing InterfaceMap instances based on service implementations or service factories. More... | |
struct | ServiceListenerHook |
Service Listener Hook Service. More... | |
class | ServiceObjects< S > |
Allows multiple service objects for a service to be obtained. More... | |
class | ServiceObjects< void > |
Allows multiple service objects for a service to be obtained. More... | |
class | ServiceReference< S > |
A reference to a service. More... | |
class | ServiceReferenceBase |
A reference to a service. More... | |
class | ServiceRegistration< I1, I2, I3 > |
A registered service. More... | |
class | ServiceRegistrationBase |
A registered service. More... | |
struct | TrackedTypeTraitsBase< T, TTT > |
A base class template for type traits for objects tracked by a ServiceTracker instance. More... | |
struct | TrackedTypeTraits< S, T * > |
Default type traits for custom tracked objects of pointer type. More... | |
class | ServiceTracker< S, TTT > |
The ServiceTracker class simplifies using services from the framework's service registry. More... | |
struct | ServiceTrackerCustomizer< S, T > |
The ServiceTrackerCustomizer interface allows a ServiceTracker to customize the service objects that are tracked. More... | |
Macros | |
#define | US_EXPORT_MODULE_ACTIVATOR(_module_libname, _activator_type) |
Export a module activator class. More... | |
#define | US_IMPORT_MODULE(_import_module_libname) |
Import a static module. More... | |
#define | US_IMPORT_MODULE_RESOURCES(_import_module_libname) |
Import a static module's resources. More... | |
#define | US_LOAD_IMPORTED_MODULES_INTO_MAIN(_static_modules) |
Import a list of static modules into an executable. More... | |
#define | US_LOAD_IMPORTED_MODULES(_module_libname, _static_modules) |
Import a list of static modules into a shared library. More... | |
#define | US_INITIALIZE_MODULE(_module_name, _module_libname) |
Creates initialization code for a module. More... | |
#define | US_INITIALIZE_EXECUTABLE(_executable_id) |
Creates initialization code for an executable. More... | |
#define | US_DECLARE_SERVICE_INTERFACE(_service_interface_type, _service_interface_id) |
Declare a CppMicroServices service interface. More... | |
Typedefs | |
typedef std::map< std::string, void * > | InterfaceMap |
A map containing interfaces ids and their corresponding service object pointers. More... | |
typedef US_UNORDERED_MAP_TYPE < std::string, Any > | ServiceProperties |
A hash table with std::string as the key type and Any as the value type. More... | |
typedef ServiceReference< void > | ServiceReferenceU |
A service reference of unknown type, which is not bound to any interface identifier. More... | |
typedef ServiceRegistration< void > | ServiceRegistrationU |
A service registration object of unknown type. More... | |
Functions | |
ModuleContext * | GetModuleContext () |
Returns the module context of the calling module. More... | |
std::ostream & | operator<< (std::ostream &os, const Module &module) |
std::ostream & | operator<< (std::ostream &os, Module const *module) |
std::ostream & | operator<< (std::ostream &os, const ModuleResource &resource) |
std::ostream & | operator<< (std::ostream &os, const ModuleVersion &v) |
std::ostream & | operator<< (std::ostream &os, const LDAPFilter &filter) |
template<class T > | |
const char * | us_service_interface_iid () |
Returns a unique id for a given type. More... | |
template<class I1 > | |
I1 * | ExtractInterface (const InterfaceMap &map) |
Extract a service interface pointer from a given InterfaceMap instance. More... | |
std::ostream & | operator<< (std::ostream &os, const ServiceReferenceBase &serviceRef) |
std::ostream & | operator<< (std::ostream &os, ModuleEvent::Type eventType) |
std::ostream & | operator<< (std::ostream &os, const ModuleEvent &event) |
US_END_NAMESPACE US_EXPORT std::ostream & | operator<< (std::ostream &os, const US_PREPEND_NAMESPACE(ServiceEvent::Type)&type) |
US_EXPORT std::ostream & | operator<< (std::ostream &os, const US_PREPEND_NAMESPACE(ServiceEvent)&event) |
std::ostream & | operator<< (std::ostream &os, const ServiceException &exc) |
This category includes classes related to the C++ Micro Services component.
The C++ Micro Services component provides a dynamic service registry based on the service layer as specified in the OSGi R4.2 specifications.
#define US_DECLARE_SERVICE_INTERFACE | ( | _service_interface_type, | |
_service_interface_id | |||
) |
Declare a CppMicroServices service interface.
This macro associates the given identifier _service_interface_id (a string literal) to the interface class called _service_interface_type. The Identifier must be unique. For example:
This macro is normally used right after the class definition for _service_interface_type, in a header file.
If you want to use US_DECLARE_SERVICE_INTERFACE with interface classes declared in a namespace then you have to make sure the US_DECLARE_SERVICE_INTERFACE macro call is not inside a namespace though. For example:
_service_interface_type | The service interface type. |
_service_interface_id | A string literal representing a globally unique identifier. |
#define US_EXPORT_MODULE_ACTIVATOR | ( | _module_libname, | |
_activator_type | |||
) |
Export a module activator class.
_module_libname | The physical name of the module, without prefix or suffix. |
_activator_type | The fully-qualified type-name of the module activator class. |
Call this macro after the definition of your module activator to make it accessible by the CppMicroServices library.
Example:
_module_libname
argument must match the value of _module_name
used in the US_INITIALIZE_MODULE
macro call. #define US_IMPORT_MODULE | ( | _import_module_libname | ) |
Import a static module.
_import_module_libname | The physical name of the module to import, without prefix or suffix. |
This macro imports the static module named _import_module_libname
.
Inserting this macro into your application's source code will allow you to make use of a static module. Do not forget to list the imported module when calling the macro US_LOAD_IMPORTED_MODULES and to actually link the static module to the importing executable or shared library.
Example:
#define US_IMPORT_MODULE_RESOURCES | ( | _import_module_libname | ) |
Import a static module's resources.
_import_module_libname | The physical name of the module to import, without prefix or suffix. |
This macro imports the resources of the static module named _import_module_libname
.
Inserting this macro into your application's source code will allow you to make use of the resources embedded in a static module. Do not forget to list the imported module when calling the macro US_LOAD_IMPORTED_MODULES and to actually link the static module to the importing executable or shared library.
#define US_INITIALIZE_EXECUTABLE | ( | _executable_id | ) |
Creates initialization code for an executable.
Each executable which wants to register itself with the CppMicroServices library has to put a call to this macro in one of its source files. This ensures that the executable will get its own ModuleContext instance and can access the service registry.
Example call for an executable:
This will initialize the executable for use with the CppMicroServices library, using a default auto-load directory named after the provided executable id in _executable_id
.
usFunctionGenerateExecutableInit()
._executable_id | A valid C identifier for the executable (no spaces etc.). |
#define US_INITIALIZE_MODULE | ( | _module_name, | |
_module_libname | |||
) |
Creates initialization code for a module.
Each module which wants to register itself with the CppMicroServices library has to put a call to this macro in one of its source files.
Example call for a module with file-name "libmylibname.so":
This will initialize the module for use with the CppMicroServices library, using a default auto-load directory named after the provided library name in _module_libname
.
usFunctionGenerateModuleInit()
._module_name | A human-readable name for the module. If you use this macro in a source file for an executable, the module name must be a valid C-identifier (no spaces etc.). |
_module_libname | The physical name of the module, withou prefix or suffix. |
#define US_LOAD_IMPORTED_MODULES | ( | _module_libname, | |
_static_modules | |||
) |
Import a list of static modules into a shared library.
_module_libname | The physical name of the importing module, without prefix or suffix. |
_static_modules | A space-deliminated list of physical module names, without prefix or suffix. |
This macro ensures that the ModuleActivator::Load(ModuleContext*) function is called for each imported static module when the importing shared library is loaded (if the static module provides an activator). If the static module provides embedded resources and the US_IMPORT_MODULE_RESOURCES macro was called, the resources will be made available through the importing module.
There must be exactly one call of this macro in the shared library which is importing static modules.
Example:
#define US_LOAD_IMPORTED_MODULES_INTO_MAIN | ( | _static_modules | ) |
Import a list of static modules into an executable.
_static_modules | A space-deliminated list of physical module names, without prefix or suffix. |
This macro ensures that the ModuleActivator::Load(ModuleContext*) function is called for each imported static module when the importing executable is loaded (if the static module provides an activator). If the static module provides embedded resources and the US_IMPORT_MODULE_RESOURCES macro was called, the resources will be made available through the importing module.
There must be exactly one call of this macro in the executable which is importing static modules.
Example:
typedef std::map<std::string, void*> InterfaceMap |
A map containing interfaces ids and their corresponding service object pointers.
InterfaceMap instances represent a complete service object which implementes one or more service interfaces. For each implemented service interface, there is an entry in the map with the key being the service interface id and the value a pointer to the service interface implementation.
To create InterfaceMap instances, use the MakeInterfaceMap helper class.
typedef US_UNORDERED_MAP_TYPE<std::string, Any> ServiceProperties |
A hash table with std::string as the key type and Any as the value type.
It is typically used for passing service properties to ModuleContext::RegisterService.
typedef ServiceReference<void> ServiceReferenceU |
A service reference of unknown type, which is not bound to any interface identifier.
typedef ServiceRegistration<void> ServiceRegistrationU |
A service registration object of unknown type.
I1* ExtractInterface | ( | const InterfaceMap & | map | ) |
Extract a service interface pointer from a given InterfaceMap instance.
map | a InterfaceMap instance. |
I1
interface type or NULL if map
does not contain an entry for the given type.ModuleContext* GetModuleContext | ( | ) |
Returns the module context of the calling module.
This function allows easy access to the ModuleContext instance from inside a C++ Micro Services module.
std::ostream& operator<< | ( | std::ostream & | os, |
const ServiceException & | exc | ||
) |
std::ostream& operator<< | ( | std::ostream & | os, |
ModuleEvent::Type | eventType | ||
) |
std::ostream& operator<< | ( | std::ostream & | os, |
const ModuleEvent & | event | ||
) |
std::ostream& operator<< | ( | std::ostream & | os, |
const LDAPFilter & | filter | ||
) |
US_END_NAMESPACE US_EXPORT std::ostream& operator<< | ( | std::ostream & | os, |
const US_PREPEND_NAMESPACE(ServiceEvent::Type)& | type | ||
) |
US_EXPORT std::ostream& operator<< | ( | std::ostream & | os, |
const US_PREPEND_NAMESPACE(ServiceEvent)& | event | ||
) |
std::ostream& operator<< | ( | std::ostream & | os, |
const ServiceReferenceBase & | serviceRef | ||
) |
std::ostream& operator<< | ( | std::ostream & | os, |
const ModuleVersion & | v | ||
) |
std::ostream& operator<< | ( | std::ostream & | os, |
const ModuleResource & | resource | ||
) |
std::ostream& operator<< | ( | std::ostream & | os, |
const Module & | module | ||
) |
std::ostream& operator<< | ( | std::ostream & | os, |
Module const * | module | ||
) |
|
inline |
Returns a unique id for a given type.
This template method is specialized in the macro US_DECLARE_SERVICE_INTERFACE to return a unique id for each service interface.
T | The service interface type. |