Imt.Base C++ API V4.1.1.0
Loading...
Searching...
No Matches
imt::base::lib::remoting::RemoteObjectTemplate< ProtocolType, PROTOCOL_ID > Class Template Referencefinal

Defines a remote object template to serialize and deserialize a protocol and send them directly to a PortOut. More...

#include <Imt.Base.Lib.Remoting/inc/Imt.Base.Lib.Remoting/RemoteObjectTemplate.h>

Inheritance diagram for imt::base::lib::remoting::RemoteObjectTemplate< ProtocolType, PROTOCOL_ID >:
imt::base::lib::remoting::RemoteObjectAbs imt::base::lib::remoting::RemoteObjectIfc imt::base::core::platform::Nonmovable imt::base::core::serialization::SerializableIfc

Public Member Functions

 RemoteObjectTemplate ()=default
 Constructor.
 
 RemoteObjectTemplate (RemotingSendServiceIfc *const pRemotingSendService, RemotingServiceIfc *const pRemotingReceiveService=nullptr, ::imt::base::core::serialization::SerializableSenderIfc *const portOut=nullptr)
 Constructor.
 
void deserialize (::imt::base::core::serialization::Deserializer &buffer) final
 
void serialize (::imt::base::core::serialization::Serializer &buffer) const final
 
void setDataToSend (ProtocolType const *const protocolData)
 Set the reference to the data which is serialized.
 
- Public Member Functions inherited from imt::base::lib::remoting::RemoteObjectAbs
 RemoteObjectAbs (int32_t const uniqueIdToAttach, RemotingSendServiceIfc *const pRemotingSendService=nullptr, RemotingServiceIfc *const pRemotingReceiveService=nullptr)
 Constructor.
 
int32_t getUniqueId () const final
 
bool send () final
 
void onReceive (::imt::base::core::serialization::Deserializer &buffer) final
 
void attach (int32_t const uniqueId) final
 
void detach () final
 
virtual int32_t getUniqueId () const =0
 Gets the unique id of this remote object.
 
virtual bool send ()=0
 Sends this remote object.
 
virtual void onReceive (::imt::base::core::serialization::Deserializer &buffer)=0
 Will be called when data has been received.
 
virtual void attach (int32_t const uniqueId)=0
 Attaches this remote object to remoting service.
 
virtual void detach ()=0
 Detaches this remote object from remoting service.
 
- Public Member Functions inherited from imt::base::core::serialization::SerializableIfc
virtual void deserialize (Deserializer &buffer)=0
 Deserialize this object from the given deserialize.
 
virtual void serialize (Serializer &buffer) const =0
 Serialize this object into the given serializer.
 

Additional Inherited Members

- Static Public Attributes inherited from imt::base::lib::remoting::RemoteObjectIfc
static constexpr int32_t UNDEFINED_ID {-1}
 ID to indicate no or an invalid remote object.
 
- Protected Member Functions inherited from imt::base::lib::remoting::RemoteObjectAbs
 ~RemoteObjectAbs () noexcept
 Destructor.
 
virtual uint32_t getMaxTransferSize () const
 Gets the maximum number of bytes that can be transfered by one transmission.
 
- Protected Member Functions inherited from imt::base::lib::remoting::RemoteObjectIfc
 RemoteObjectIfc () noexcept=default
 
 RemoteObjectIfc (RemoteObjectIfc const &) noexcept=default
 
 RemoteObjectIfc (RemoteObjectIfc &&) noexcept=default
 
 ~RemoteObjectIfc () noexcept=default
 
RemoteObjectIfcoperator= (RemoteObjectIfc const &) &noexcept=default
 
RemoteObjectIfcoperator= (RemoteObjectIfc &&) &noexcept=default
 
- Protected Member Functions inherited from imt::base::core::serialization::SerializableIfc
 SerializableIfc () noexcept=default
 
 SerializableIfc (SerializableIfc const &) noexcept=default
 
 SerializableIfc (SerializableIfc &&) noexcept=default
 
 ~SerializableIfc () noexcept=default
 
SerializableIfcoperator= (SerializableIfc const &) &noexcept=default
 
SerializableIfcoperator= (SerializableIfc &&) &noexcept=default
 

Detailed Description

template<class ProtocolType, uint16_t PROTOCOL_ID>
class imt::base::lib::remoting::RemoteObjectTemplate< ProtocolType, PROTOCOL_ID >

Defines a remote object template to serialize and deserialize a protocol and send them directly to a PortOut.

Example of usage inside an ActivePart:

// ActivePart Header file
[..]
private:
[..]
Defines a remote object template to serialize and deserialize a protocol and send them directly to a ...

Receiving:

// ActivePart implementation file
ReceiverAP::ReceiverAP() :
ActivePartAbs(RuntimePriority::Prio_16, static_cast<uint32_t>("ReceiverAP"),
PortOutAlarmData(),
m_remotingReceiveService(),
m_alarmDataAckRemoteObject(nullptr, &m_remotingReceiveService, &PortOutAlarmData) {
[..]
unsigned __int32 uint32_t
Definition stdint.h:64

Sending:

// ActivePart implementation file
SenderAP::SenderAP() :
SenderAP(RuntimePriority::Prio_16, static_cast<uint32_t>("SenderAP")),
m_remotingSendService(m_sendBuffer, SEND_BUFFER_SIZE),
m_alarmDataRemoteObject(&m_remotingSendService) {
[..]
void SenderAP::execute(const uint16_t protocolIdentifier, Deserializer& buffer) {
switch (protocolIdentifier) {
case DataBusProtocolIdentifier::ALARM_DATA:
AlarmDataProtocol message(buffer);
m_alarmDataRemoteObject.setDataToSend(&message);
const bool ok {m_alarmDataRemoteObject.send()};
break;
}
}
unsigned __int16 uint16_t
Definition stdint.h:63
Template Parameters
ProtocolTypedefines the Protocol where remote object is serialized into
PROTOCOL_IDdefines the unique ProtocolIdentifier

Definition at line 64 of file RemoteObjectTemplate.h.

Constructor & Destructor Documentation

◆ RemoteObjectTemplate() [1/2]

template<class ProtocolType , uint16_t PROTOCOL_ID>
imt::base::lib::remoting::RemoteObjectTemplate< ProtocolType, PROTOCOL_ID >::RemoteObjectTemplate ( )
default

Constructor.

◆ RemoteObjectTemplate() [2/2]

template<class ProtocolType , uint16_t PROTOCOL_ID>
imt::base::lib::remoting::RemoteObjectTemplate< ProtocolType, PROTOCOL_ID >::RemoteObjectTemplate ( RemotingSendServiceIfc *const  pRemotingSendService,
RemotingServiceIfc *const  pRemotingReceiveService = nullptr,
::imt::base::core::serialization::SerializableSenderIfc *const  portOut = nullptr 
)
inlineexplicit

Constructor.

Parameters
pRemotingSendServiceThe sending service to which this object will be attached
pRemotingReceiveServiceThe receiving service to which this object will be attached
portOutThe PortOutput which is used to send received remoting objects to

Definition at line 80 of file RemoteObjectTemplate.h.

Member Function Documentation

◆ deserialize()

template<class ProtocolType , uint16_t PROTOCOL_ID>
void imt::base::lib::remoting::RemoteObjectTemplate< ProtocolType, PROTOCOL_ID >::deserialize ( ::imt::base::core::serialization::Deserializer buffer)
inlinefinal
See also
SerializableIfc

Definition at line 91 of file RemoteObjectTemplate.h.

◆ serialize()

template<class ProtocolType , uint16_t PROTOCOL_ID>
void imt::base::lib::remoting::RemoteObjectTemplate< ProtocolType, PROTOCOL_ID >::serialize ( ::imt::base::core::serialization::Serializer buffer) const
inlinefinal
See also
SerializableIfc

Definition at line 104 of file RemoteObjectTemplate.h.

◆ setDataToSend()

template<class ProtocolType , uint16_t PROTOCOL_ID>
void imt::base::lib::remoting::RemoteObjectTemplate< ProtocolType, PROTOCOL_ID >::setDataToSend ( ProtocolType const *const  protocolData)
inline

Set the reference to the data which is serialized.

Parameters
protocolDatathe protocol to send

Definition at line 118 of file RemoteObjectTemplate.h.


The documentation for this class was generated from the following file: