Dataflow Runtime API  4.0.1.0
Public Member Functions | List of all members
imt::base::lib::remoting::RemoteObjectTemplate< ProtocolType, PROTOCOL_ID > Class Template Reference

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

#include <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::serialization::SerializableIfc

Public Member Functions

 RemoteObjectTemplate (RemotingSendServiceIfc *const pRemotingSendService=nullptr, RemotingServiceIfc *const pRemotingReceiveService=nullptr, ::imt::base::core::serialization::SerializableSenderIfc *const portOut=nullptr)
 Constructor. More...
 
virtual ~RemoteObjectTemplate ()
 Destructor. More...
 
virtual void deserialize (::imt::base::core::serialization::Deserializer &deserializer)
 
virtual void serialize (::imt::base::core::serialization::Serializer &serializer) const
 
void setDataToSend (ProtocolType const *const protocolData)
 Set the reference to the data which is serialized. More...
 
- Public Member Functions inherited from imt::base::lib::remoting::RemoteObjectAbs
 RemoteObjectAbs (int32_t const uniqueIdToAttach, RemotingSendServiceIfc *const pRemotingSendService=nullptr, RemotingServiceIfc *const pRemotingReceiveService=nullptr)
 Constructor. More...
 
virtual ~RemoteObjectAbs ()
 Destructor. More...
 
virtual int32_t getUniqueId () const
 
virtual bool send ()
 
virtual void onReceive (::imt::base::core::serialization::Deserializer &deserializer)
 
virtual void attach (int32_t const uniqueId)
 
virtual void detach ()
 
- Public Member Functions inherited from imt::base::lib::remoting::RemoteObjectIfc
virtual ~RemoteObjectIfc ()
 Destructor. More...
 
- Public Member Functions inherited from imt::base::core::serialization::SerializableIfc
virtual ~SerializableIfc ()
 Destructor. More...
 
virtual void deserialize (Deserializer &deserializer)=0
 Deserialize this object from the given deserializer. More...
 
virtual void serialize (Serializer &serializer) const =0
 Serialize this object into the given serializer. More...
 

Additional Inherited Members

- Public Types inherited from imt::base::lib::remoting::RemoteObjectIfc
enum  { UNDEFINED_ID = -1 }
 
- Protected Member Functions inherited from imt::base::lib::remoting::RemoteObjectAbs
virtual uint32_t getMaxTransferSize () const
 Gets the maximum number of bytes that can be transfered by one transmission. More...
 

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:
typedef RemoteObjectTemplate<AlarmDataAckProtocol, DataBusProtocolIdentifier::ALARM_DATA_ACK> AlarmDataAckRemoteObject;
[..]

Receiving:

// ActivePart implementation file
ReceiverAP::ReceiverAP() :
ActivePartAbs(RuntimePriority::Prio_16, static_cast<uint32_t>("ReceiverAP"),
PortOutAlarmData(),
m_remotingReceiveService(),
m_alarmDataAckRemoteObject(nullptr, &m_remotingReceiveService, &PortOutAlarmData) {
[..]
RuntimePriority
Runtime executable priorities (=software priorities) The priorities start at 1 with lowest priority,...
Definition: RuntimePriority.h:53
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& deserializer) {
switch (protocolIdentifier) {
case DataBusProtocolIdentifier::ALARM_DATA:
AlarmDataProtocol message(deserializer);
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

Constructor & Destructor Documentation

◆ RemoteObjectTemplate()

template<class ProtocolType , uint16_t PROTOCOL_ID>
imt::base::lib::remoting::RemoteObjectTemplate< ProtocolType, PROTOCOL_ID >::RemoteObjectTemplate ( RemotingSendServiceIfc *const  pRemotingSendService = nullptr,
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

◆ ~RemoteObjectTemplate()

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

Destructor.

Member Function Documentation

◆ deserialize()

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

◆ serialize()

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

◆ 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

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