This category includes classes related to the C++ Micro Services component. More...
Namespaces | |
ServiceConstants | |
Classes | |
class | Framework |
The CppMicroServices Framework. More... | |
class | FrameworkFactory |
A factory for creating Framework instances. More... | |
class | LDAPFilter |
An RFC 1960-based Filter. More... | |
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 | 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... | |
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 | MakeInterfaceMap< Interfaces > |
Helper class for constructing InterfaceMap instances based on service implementations or service factories. More... | |
struct | ServiceListenerHook |
Service Listener Hook Service. More... | |
struct | ServiceListenerHook::ListenerInfo |
Information about a Service Listener. 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, Interfaces > |
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(_activator_type) |
Export a module activator class. More... | |
#define | US_INITIALIZE_STATIC_MODULE(_module_name) |
Initialize a static module. More... | |
#define | US_IMPORT_MODULE(_module_name) |
Import a static module. More... | |
#define | US_INITIALIZE_MODULE |
Creates initialization code for a module. More... | |
#define | US_DECLARE_SERVICE_INTERFACE(_service_interface_type, _service_interface_id) |
Declare a service interface id. More... | |
Typedefs | |
typedef std::map< std::string, void * > | InterfaceMap |
A map containing interfaces ids and their corresponding service object pointers. More... | |
typedef std::unordered_map< 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 | |
static ModuleContext * | GetModuleContext () |
Returns the module context of the calling module. More... | |
std::ostream & | operator<< (std::ostream &os, const LDAPFilter &filter) |
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) |
template<class T > | |
std::string | us_service_interface_iid () |
Returns a unique id for a given type. More... | |
template<class Interface > | |
Interface * | 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) |
std::ostream & | operator<< (std::ostream &os, const ServiceEvent::Type &type) |
std::ostream & | operator<< (std::ostream &os, const ServiceEvent &event) |
std::ostream & | operator<< (std::ostream &os, const ServiceException &exc) |
template<class T > | |
ServiceFactory * | ToFactory (T &factory, typename std::enable_if< std::is_class< T >::value, T >::type *=nullptr) |
Cast the argument to a ServiceFactory pointer. More... | |
template<class T > | |
ServiceFactory * | ToFactory (T factory, typename std::enable_if< std::is_pointer< T >::value &&std::is_class< typename std::remove_pointer< T >::type >::value >::type *=nullptr) |
Cast the argument to a ServiceFactory pointer. More... | |
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 service interface id.
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:
The usage of this macro is optional and the service interface id which is automatically associated with any type is usually good enough (the demangled type name). However, care must be taken if the default id is compared with a string literal hard-coding a service interface id. E.g. the default id for templated types in the STL may differ between platforms. For user-defined types and templates the ids are typically consistent, but platform specific default template arguments will lead to different ids.
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 | ( | _activator_type | ) |
Export a module activator class.
_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:
#define US_IMPORT_MODULE | ( | _module_name | ) |
Import a static module.
_module_name | The name of the module to import. |
This macro imports the static module named _module_name
.
Inserting this macro into your application's source code will allow you to make use of a static module. It will initialize the static module and calls its ModuleActivator. If the module does not provide an activator, use the US_INITIALIZE_STATIC_MODULE macro instead. Do not forget to actually link the static module to the importing executable or shared library.
Example:
#define US_INITIALIZE_MODULE |
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. Further, the module's source files must be compiled with the US_MODULE_NAME
pre-processor definition set to a module-unique identifier.
Calling the US_INITIALIZE_MODULE
macro will initialize the module for use with the CppMicroServices library, using a default auto-load directory named after the US_MODULE_NAME
definition.
usFunctionGenerateModuleInit()
. #define US_INITIALIZE_STATIC_MODULE | ( | _module_name | ) |
Initialize a static module.
_module_name | The name of the module to initialize. |
This macro initializes the static module named _module_name
.
If the module provides an activator, use the US_IMPORT_MODULE macro instead, to ensure that the activator is called. Do not forget to actually link the static module to the importing executable or shared library.
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 std::unordered_map<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.
enum ModuleEvent::Type |
Enumerator | |
---|---|
LOADED |
The module has been loaded. The module's ModuleActivator Load method has been executed. |
UNLOADED |
The module has been unloaded. The module's ModuleActivator Unload method has been executed. |
LOADING |
The module is about to be loaded. The module's ModuleActivator Load method is about to be called. |
UNLOADING |
The module is about to be unloaded. The module's ModuleActivator Unload method is about to be called. |
INSTALLED |
The bundle has been installed. The bundle has been installed by the Framework. |
UNINSTALLED |
The bundle has been uninstalled. The bundle has been removed from the Framework. |
enum ServiceEvent::Type |
Enumerator | |
---|---|
REGISTERED |
This service has been registered. This event is delivered after the service has been registered with the framework.
|
MODIFIED |
The properties of a registered service have been modified. This event is delivered after the service properties have been modified. |
UNREGISTERING |
This service is in the process of being unregistered. This event is delivered before the service has completed unregistering. If a module is using a service that is |
MODIFIED_ENDMATCH |
The properties of a registered service have been modified and the new properties no longer match the listener's filter. This event is delivered after the service properties have been modified. This event is only delivered to listeners which were added with a non-empty filter where the filter matched the service properties prior to the modification but the filter does not match the modified service properties. |
Interface* 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.
|
inlinestatic |
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 | ||
) |
std::ostream& operator<< | ( | std::ostream & | os, |
const ServiceEvent::Type & | type | ||
) |
std::ostream& operator<< | ( | std::ostream & | os, |
const 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 | ||
) |
ServiceFactory* ToFactory | ( | T & | factory, |
typename std::enable_if< std::is_class< T >::value, T >::type * | = nullptr |
||
) |
Cast the argument to a ServiceFactory
pointer.
Useful when calling ModuleContext::RegisterService
with a service factory, for example:
factory | The service factory. May be a pointer or reference type. |
ServiceFactory
pointer to the passed factory
instance.ServiceFactory* ToFactory | ( | T | factory, |
typename std::enable_if< std::is_pointer< T >::value &&std::is_class< typename std::remove_pointer< T >::type >::value >::type * | = nullptr |
||
) |
Cast the argument to a ServiceFactory
pointer.
Useful when calling ModuleContext::RegisterService
with a service factory, for example:
factory | The service factory. May be a pointer or reference type. |
ServiceFactory
pointer to the passed factory
instance.std::string us_service_interface_iid | ( | ) |
Returns a unique id for a given type.
By default, the demangled name of T
is returned.
This template method may be specialized directly or be using the macro US_DECLARE_SERVICE_INTERFACE to return a custom id for each service interface.
T | The service interface type. |