12#ifndef WSFUCI_MESSAGESERVICE_HPP
13#define WSFUCI_MESSAGESERVICE_HPP
17#include "uci/base/AbstractServiceBusConnection.h"
18#include "UtMemory.hpp"
28 template<
class MessageType,
39 uci::base::AbstractServiceBusConnection* aAsbPtr,
42 mFactoryService(aAsbPtr),
43 mReaderPtr(&mFactoryService.
GetFactory().createReader(aTopic)),
44 mWriterPtr(&mFactoryService.
GetFactory().createWriter(aTopic)),
45 mListenerPtr(
ut::make_unique<GenericListenerType>(aInterface))
47 mReaderPtr->addListener(*mListenerPtr);
55 FactoryType&
GetFactory()
const {
return mFactoryService.GetFactory(); }
56 WriterType&
GetWriter()
const {
return *mWriterPtr; }
57 ReaderType&
GetReader()
const {
return *mReaderPtr; }
63 mReaderPtr->removeListener(*mListenerPtr);
65 mFactoryService.GetFactory().destroyReader(*mReaderPtr);
67 mFactoryService.GetFactory().destroyWriter(*mWriterPtr);
68 mFactoryService.Shutdown();
73 ReaderType* mReaderPtr =
nullptr;
74 WriterType* mWriterPtr =
nullptr;
75 std::unique_ptr<GenericListenerType> mListenerPtr =
nullptr;
Define a generic factory service that can be parameterized with any factory-enabled UCI type.
Definition WsfUCI_FactoryService.hpp:25
Define a generic interface that passes received messages to the interface to dispatch to UCI componen...
Definition WsfUCI_GenericListener.hpp:38
The OMS / UCI Interface Object to the UCI middleware.
Definition WsfUCI_Interface.hpp:118
FactoryType & GetFactory() const
Definition WsfUCI_MessageService.hpp:55
ReaderType & GetReader() const
Definition WsfUCI_MessageService.hpp:57
const UCI_MessageService & operator=(const UCI_MessageService &aRhs)=delete
virtual ~UCI_MessageService()=default
UCI_MessageService()=delete
const UCI_FactoryService< MessageType, FactoryType > & GetTypeFactory() const
Definition WsfUCI_MessageService.hpp:54
WriterType & GetWriter() const
Definition WsfUCI_MessageService.hpp:56
UCI_MessageService(UCI_Interface &aInterface, uci::base::AbstractServiceBusConnection *aAsbPtr, const char *aTopic)
Definition WsfUCI_MessageService.hpp:38
void Shutdown()
Definition WsfUCI_MessageService.hpp:61
UCI_MessageService(const UCI_MessageService &aSrc)=delete
UCI_ServiceBase()=default
Definition WsfSensorErrorModel.hpp:21
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32