58 lines
1.8 KiB
C++
58 lines
1.8 KiB
C++
/**
|
|
* @file include/ActivMiddleware/ActivFramework/ChildService.h
|
|
*
|
|
* @brief Header file for child service class.
|
|
*/
|
|
|
|
#if (!defined ACTIV_FRAMEWORK_CHILD_SERVICE_H)
|
|
#define ACTIV_FRAMEWORK_CHILD_SERVICE_H
|
|
|
|
#include "ActivMiddleware/ActivFramework/External.h"
|
|
#include "ActivMiddleware/ActivFramework/Service.h"
|
|
|
|
//! Activ namespace.
|
|
namespace Activ
|
|
{
|
|
|
|
/**
|
|
* @brief Child service class
|
|
*
|
|
* A child service is attached to another service. The child service is given the same service id as the parent.
|
|
*/
|
|
template <typename T>
|
|
class ChildService : public Service
|
|
{
|
|
public:
|
|
/**
|
|
* @brief Constructor.
|
|
*
|
|
* Attaches the child service to a managed endpoint at the next available slot with the service of the parent service.
|
|
*
|
|
* @param parentService reference to the parent service.
|
|
* @param managedEndPoint reference to a ManagedEndPoint object to which this component is to be attached.
|
|
* @param pHeap heap to use for messaging, or 0 for the parent service heap.
|
|
* @param name name of the Component, local to the endpoint.
|
|
*
|
|
* @throw Exception.
|
|
*/
|
|
ChildService(T &parentService, ManagedEndPoint &managedEndPoint, IHeap * const pHeap = 0,
|
|
const String &name = Component::anonymousName);
|
|
|
|
T &m_parentService; ///< Reference back to the parent service.
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
template <typename T>
|
|
ChildService<T>::ChildService(T &parentService, ManagedEndPoint &managedEndPoint, IHeap * const pHeap,
|
|
const String &name) :
|
|
Service(parentService, managedEndPoint, pHeap, name),
|
|
m_parentService(parentService)
|
|
{
|
|
}
|
|
|
|
} // namespace Activ
|
|
|
|
#endif // (!defined ACTIV_FRAMEWORK_CHILD_SERVICE_H)
|