Previous | Contents | Index |
rtr_status_t Dispatch();
rtr_status_t Interpret value for the success or failure of this call.
None
This member function must be overridden by the RTR application. When called, the data contained within the object is processed. Processing the data may include performing some application specific logic and/or dispatching to a handler.
sStatus = pApplicationEvent->Dispatch(); { }
rtr_status_t GetEventData( rtr_msgbuf_t &evEventData );
rtr_status_t Interpret value for the success or failure of this call.
evEventData
Pointer to event data.
Retrieve the application data associated with this RTRApplicationEvent object.
GetEventData(&evEventData );
rtr_msglen_t GetEventDataLength();
rtr_msglen_t: Returns the size of the event data length.
None
Call this member function to receive the size of the application event data length.
rtr_msglen_t LengthOfData = pRTRApplicationEvent->GetEventDataLength();
rtr_status_t GetEventNumber (rtr_evtnum_t &evEventNumber );
rtr_status_t Interpret value for the success or failure of this call.
Status | Message |
---|---|
RTR_STS_NOEVENT | The data object does not contain an event. |
RTR_STS_NOMESSAGE | The data object does not contain a message |
RTR_STS_OK | Normal successful completion. |
evEventNumber
An event number.
Get the event number associated with the received application event.
GetEventNumber (&evEventNumber );
rtr_status_t SetEventData (rtr_msgbuf_t &evEventData, rtr_msglen_t dlDataLength);
rtr_status_t Interpret value for the success or failure of this call.
Status | Message |
---|---|
RTR_STS_OK | Normal successful completion. |
RTR_STS_INVARGPTR | The data object does not contain an event. |
evEventData
Pointer to event data.dlDataLength
The length of the data.
Set the application data associated with this RTRApplicationEvent object.
SetEventData (&evEventData, dlDataLength);
rtr_status_t SetEventNumber (const rtr_evtnum_t &evEventNumber );
rtr_status_t Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.
evEventNumber
An event number.
Set the application event number associated with the data in this RTRApplicationEvent object.
SetEventNumber (&evEventNumber );
3.13 RTRApplicationMessage Class
Construction
Method | Description |
---|---|
RTRApplicationMessage() | Default constructor |
~RTRApplicationMessage () | Default destructor |
Operations
Method | Description |
---|---|
Dispatch() | Basic method. |
GetMessage() | Retrieve the message associated with the data in this object. |
GetMessageLength() | Retrieve the actual length of the message associated with the data in this object. |
rtr_status_t Dispatch();
rtr_status_t Interpret value for the success or failure of this call.
None
This member function must be overridden by the RTR application. When called the data contained within the object is processed. Processing the data may include performing some application specific logic and/or dispatching to a handler.
void ABCOrderProcessor::ProcessIncomingOrders() { abc_status sStatus = RTR_STS_OK; RTRData *pOrder = NULL; while (1) { sStatus = pOrder->Dispatch(); print_status_on_failure(sStatus); delete pOrder; } return; }
rtr_msgbuf_t GetMessage();
rtr_status_t Interpret value for the success or failure of this call.
Status | Message |
---|---|
RTR_STS_OK | Normal successful completion. |
RTR_STS_NOMESSAGE | The data object does not contain a message |
None
Retrieve the message associated with the data in this object.
RTRApplicationMessage.GetMessage();
rtr_msgbuf_t GetMessageLength();
rtr_status_t Interpret value for the success or failure of this call.
Status | Message |
---|---|
RTR_STS_OK | Normal successful completion. |
RTR_STS_NOMESSAGE | The data object does not contain a message |
None
Retrieve the actual length of the message associated with the data in this object.
RTRApplicationMessage.GetMessageLength();
3.14 RTRClassFactory Class
The RTRClassFactory class constructs an RTR application event or
message directly from an RTR message data buffer.
Construction
Method | Description |
---|---|
RTRClassFactory() | Default constructor |
~RTRClassFactory() | Default destructor |
Operations
Method | Description |
---|---|
CreateRTRApplicationEvent
(rtr_const_msgbuf_t, rtr_msglen_t, RTRApplicationEvent) |
Create an RTRApplicationEvent data object. |
CreateRTRApplicationMessage
(rtr_const_msgbuf_t, rtr_msglen_t, RTRApplicationMessage) |
Create an RTRApplicationMessage data object. |
CreateRTREvent(RTREvent) | Create an RTREvent data object. |
CreateRTRMessage(RTRMessage) | Create an RTRMessage data object. |
virtual rtr_status_t CreateRTRApplicationEvent(rtr_const_msgbuf_t pmsgCallersData, rtr_msglen_t msglCallersDataLength RTRApplicationEvent *&pApplicationEvent) { rtr_status_t sStatus = RTR_STS_OK; pApplicationEvent = new RTRApplicationEvent(); if (NULL == pApplicationEvent); { sStatus = RTR_STS_INSVIRMEM; } return sStatus; };
rtr_status_t Interpret value for the success or failure of this call.
Status | Message |
---|---|
RTR_STS_OK | Normal successful completion. |
RTR_STS_INSVIREM | Insufficient virtual memory. |
pmsgCallersData
Pointer to the caller's data.msglCallersDataLength
The length of the caller's data.pApplicationEvent
Pointer to the application event.
Create an RTRApplicationEvent data object if the transaction controller determines that Receive call points to a message of type RTRApplicationEvent.
pApplicationEvent = new ApplicationEvent();
virtual rtr_status_t CreateRTRApplicationMessage(rtr_const_msgbuf_t pmsgCallersData, rtr_msglen_t msglCallersDataLength, RTRApplicationMessage *&pApplicationMessage) { rtr_status_t sStatus = RTR_STS_OK; pApplicationMessage = new RTRApplicationMessage(); if (NULL == pApplicationMessage) { sStatus = RTR_STS_INSVIRMEM; } return sStatus; };
rtr_status_t Interpret value for the success or failure of this call.
Status | Message |
---|---|
RTR_STS_OK | Normal successful completion. |
RTR_STS_INSVIREM |
pmsgCallersData
Pointer to the caller's data.msglCallersDataLength
The length of the caller's data.pApplicationMessage
Pointer to the application message.
Create an RTRApplicationMessage data object if the transaction controller determines that Receive call points to a message of type RTRApplicationMessage.
rtr_status_t ABCSClassFactory::CreateRTRApplicationMessage( rtr_const_msgbuf_t pmsgCallersData, rtr_msglen_t msglCallersDataLength, RTRApplicationMessage *&pApplicationMessage ) { // Determine what kind of serialized object we are receiving. // The ABC company protocol defines the first integer of the // message to represent the type of the object we are receiving. // Book = ABC_BOOK. Magazine = ABC_MAGAZINE unsigned int // uiClassType = *(unsigned int*)pmsgCallersData; switch (uiClassType) { case ABC_BOOK : pApplicationMessage = new ABCBook(); break; case ABC_MAGAZINE : pApplicationMessage = new ABCMagazine(); break; default: // If we ever get here then the client is sending us data that we // can't recognize. For some applictations this may not be an // issue. For the ABC company this should be impossible. assert(false); } // Make sure we are passing back a valid address if (NULL == pApplicationMessage) return RTR_STS_INSVIRMEM; return ABC_STS_SUCCESS;}
virtual rtr_status_t CreateRTREvent( RTREvent *&pRTREvent) { rtr_status_t sStatus = RTR_STS_OK; pRTREvent = new RTREvent(); if (NULL == pRTREvent) { sStatus = RTR_STS_INSVIRMEM; } return sStatus; };
rtr_status_t Interpret value for the success or failure of this call.
Status | Message |
---|---|
RTR_STS_OK | Normal successful completion. |
RTR_STS_INSVIREM | Insufficient virtual memory. |
pRTREvent
Pointer to an RTREvent object that describes the message which is being processed.
Create an RTREvent data object if the transaction controller determines that Receive call points to a message of type RTREvent.
CreateRTREvent(*&pRTREvent)
virtual rtr_status_t CreateRTRMessage( RTRMessage *&pRTRMessage) { rtr_status_t sStatus = RTR_STS_OK; pRTRMessage = new RTRMessage(); if (NULL == pRTRMessage) { sStatus = RTR_STS_INSVIRMEM; } return sStatus; };
rtr_status_t Interpret value for the success or failure of this call.
Status | Message |
---|---|
RTR_STS_OK | Normal successful completion. |
RTR_STS_INSVIREM |
pRTRMessage
Pointer to an RTRMessage object that describes the message which is being processed.
Create an RTRMessage data object if the transaction controller determines that Receive call points to a message of type RTRMessage.
pApplicationMessage = new ApplicationMessage();
Previous | Next | Contents | Index |