EMA C++ Edition
List of all members
refinitiv::ema::access::PackedMsg Class Reference

PackedMsg class provides API to pack messages. More...

Public Member Functions

Constructor
 PackedMsg (OmmProvider &ommProvider)
  More...
 

Destructor

class OmmNiProviderImpl
 
class OmmIProviderImpl
 
virtual ~PackedMsg ()
  More...
 
PackedMsginitBuffer ()
  More...
 
PackedMsginitBuffer (UInt32 maxSize)
  More...
 
PackedMsginitBuffer (UInt64 clientHandle)
  More...
 
PackedMsginitBuffer (UInt64 clientHandle, UInt32 maxSize)
  More...
 
PackedMsgaddMsg (const Msg &msg, UInt64 itemHandle)
  More...
 
UInt64 remainingSize () const
  More...
 
UInt64 packedMsgCount () const
  More...
 
UInt64 maxSize () const
  More...
 
PackedMsgclear ()
  More...
 

Detailed Description

PackedMsg contains a list of messages packed to be sent across the wire together.

Remarks
Thread safety of all the methods in this class depends on user's implementation.
// create packed message
OmmProvider provider( OmmIProviderConfig().port( "14002" ), appClient );
PackedMsg packedMsg(provider);
// initialize packed message
packedMsg.initBuffer(clientHandle)
// add user messages to the packed message
for (Int32 i = 0; i < 10; i++)
{
msg.clear();
flist.clear();
flist.addReal(22, 3391 + i, OmmReal::ExponentNeg2Enum);
flist.addReal(30, 10 + i, OmmReal::Exponent0Enum);
flist.complete();
msg.serviceName("DIRECT_FEED").name("IBM.N");
msg.payload(flist);
packedMsg.addMsg(msg, itemHandle);
}
// submit and clear packed message
if (packedMsg.packedMsgCount() > 0)
{
provider.submit(packedMsg);
packedMsg.clear();
}
int Int32
represents 32-bit signed integer
Definition: Common.h:62
PackedMsg(OmmProvider &ommProvider)

Definition at line 67 of file PackedMsg.h.

Constructor & Destructor Documentation

◆ PackedMsg()

refinitiv::ema::access::PackedMsg::PackedMsg ( OmmProvider ommProvider)

Create an PackedMsg with OmmProvider. Set up default values for packed data variables.

Parameters
[in]OmmProviderinstance.
Exceptions
OmmMemoryExhaustionExceptionif the application runs out of memory.

◆ ~PackedMsg()

virtual refinitiv::ema::access::PackedMsg::~PackedMsg ( )
virtual

Destructor.

Member Function Documentation

◆ addMsg()

PackedMsg& refinitiv::ema::access::PackedMsg::addMsg ( const Msg msg,
UInt64  itemHandle 
)

Adds a Msg to the packed message buffer if there is enough space in the buffer to add the Msg.

Parameters
[in]Msgmsg message to add to this packed message.
[in]longitemHandle which is related to the packed message.
Exceptions
OmmInvalidUsageExceptionif the connection is not established.
OmmInvalidUsageExceptionif item handle is not set.
OmmInvalidUsageExceptionif incoming message is empty.
OmmInvalidUsageExceptionif not possible to allocate memory for StreamInfo Non-Interactive Provider.
OmmInvalidUsageExceptionif fail to encode incoming message.
OmmInvalidUsageExceptionif not possible to add messages to packed buffer.
Returns
this PackedMsg.

◆ clear()

PackedMsg& refinitiv::ema::access::PackedMsg::clear ( )

Clears the entries in the PackedMessage.

Returns
this PackedMsg

◆ initBuffer() [1/4]

PackedMsg& refinitiv::ema::access::PackedMsg::initBuffer ( )

For Non-Interactive Provider applications, initialize a new write buffer. The size of the new packed messages write buffer will be set to its default size.

Exceptions
OmmInvalidUsageExceptionif the user tries to call this method with Interactive Provider.
OmmInvalidUsageExceptionif connection is not established.
OmmInvalidUsageExceptionif not possible to allocate buffer for packed message.
Returns
this PackedMsg.

◆ initBuffer() [2/4]

PackedMsg& refinitiv::ema::access::PackedMsg::initBuffer ( UInt32  maxSize)

For Non-Interactive Provider applications, initialize a new write buffer. Also sets the maximum size of the new packed messages write buffer.

Parameters
[in]UInt32maxSize maximum size of the packed message buffer.
Exceptions
OmmInvalidUsageExceptionif the user tries to call this method with Interactive Provider.
OmmInvalidUsageExceptionif connection is not established.
OmmInvalidUsageExceptionif not possible to allocate buffer for packed messages.
Returns
this PackedMsg.

◆ initBuffer() [3/4]

PackedMsg& refinitiv::ema::access::PackedMsg::initBuffer ( UInt64  clientHandle)

For Interactive Provider applications, initialize a new write buffer and sets the client handle for this PackedMsg to submit messages to. The size of the new packed messages write buffer will be set to its default size. The handle is required to be set before adding messages or submitting the packedMsg. The size of the packed message buffer will be set to its default size.

Parameters
[in]UInt64clientHandle unique client identifier associated by EMA with a connected client.
Exceptions
OmmInvalidUsageExceptionif the user tries to call this method with Non-Interactive Provider.
OmmInvalidUsageExceptionif client handle is not valid.
OmmInvalidUsageExceptionif not possible to allocate buffer for packed message.
Returns
this PackedMsg.

◆ initBuffer() [4/4]

PackedMsg& refinitiv::ema::access::PackedMsg::initBuffer ( UInt64  clientHandle,
UInt32  maxSize 
)

For Interactive Provider applications, initialize a new write buffer and sets the client handle for this PackedMsg to submit messages to. Also sets the maximum size of the new packed messages write buffer. The handle is required to be set before adding messages or submitting the packedMsg. Also sets the maximum size of the packed message buffer.

Parameters
[in]UInt64clientHandle unique client identifier associated by EMA with a connected client.
[in]UInt32maxSize maximum size of the packed message buffer.
Exceptions
OmmInvalidUsageExceptionif the user tries to call this method with Non-Interactive Provider.
OmmInvalidUsageExceptionif client handle is not valid.
OmmInvalidUsageExceptionif not possible to allocate buffer for packed message.
Returns
this PackedMsg.

◆ maxSize()

UInt64 refinitiv::ema::access::PackedMsg::maxSize ( ) const

Return int value of maximum size of the packed message buffer.

Returns
max packed buffer size.

◆ packedMsgCount()

UInt64 refinitiv::ema::access::PackedMsg::packedMsgCount ( ) const

Returns int value of amount of currently packed messages in this PackedMsg object.

Returns
number of packed messages.

◆ remainingSize()

UInt64 refinitiv::ema::access::PackedMsg::remainingSize ( ) const

Returns int value of remaining size in the buffer available for message packing.

Returns
remaining size of packed buffer.