EMA C++ Edition
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
List of all members
thomsonreuters::ema::access::OmmArray Class Reference

OmmArray is a homogeneous container of primitive data type entries. More...

Inheritance diagram for thomsonreuters::ema::access::OmmArray:
thomsonreuters::ema::access::Data

Public Member Functions

Constructor
 OmmArray ()
 
Destructor
virtual ~OmmArray ()
 
Accessors
DataType::DataTypeEnum getDataType () const
 
Data::DataCode getCode () const
 
const EmaBuffergetAsHex () const
 
const EmaStringtoString () const
 
bool hasFixedWidth () const
 
UInt16 getFixedWidth () const
 
bool forth () const
 
const OmmArrayEntrygetEntry () const
 
void reset () const
 
Operations
OmmArrayclear ()
 
OmmArrayfixedWidth (UInt16 width)
 
OmmArrayaddInt (Int64 value)
 
OmmArrayaddUInt (UInt64 value)
 
OmmArrayaddReal (Int64 mantissa, OmmReal::MagnitudeType magnitudeType)
 
OmmArrayaddRealFromDouble (double value, OmmReal::MagnitudeType magnitudeType=OmmReal::Exponent0Enum)
 
OmmArrayaddFloat (float value)
 
OmmArrayaddDouble (double value)
 
OmmArrayaddDate (UInt16 year, UInt8 month, UInt8 day)
 
OmmArrayaddTime (UInt8 hour=0, UInt8 minute=0, UInt8 second=0, UInt16 millisecond=0, UInt16 microsecond=0, UInt16 nanosecond=0)
 
OmmArrayaddDateTime (UInt16 year, UInt8 month, UInt8 day, UInt8 hour=0, UInt8 minute=0, UInt8 second=0, UInt16 millisecond=0, UInt16 microsecond=0, UInt16 nanosecond=0)
 
OmmArrayaddQos (UInt32 timeliness=OmmQos::RealTimeEnum, UInt32 rate=OmmQos::TickByTickEnum)
 
OmmArrayaddState (OmmState::StreamState streamState=OmmState::OpenEnum, OmmState::DataState dataState=OmmState::OkEnum, UInt8 statusCode=OmmState::NoneEnum, const EmaString &statusText=EmaString())
 
OmmArrayaddEnum (UInt16 value)
 
OmmArrayaddBuffer (const EmaBuffer &value)
 
OmmArrayaddAscii (const EmaString &value)
 
OmmArrayaddUtf8 (const EmaBuffer &value)
 
OmmArrayaddRmtes (const EmaBuffer &value)
 
OmmArrayaddCodeInt ()
 
OmmArrayaddCodeUInt ()
 
OmmArrayaddCodeReal ()
 
OmmArrayaddCodeFloat ()
 
OmmArrayaddCodeDouble ()
 
OmmArrayaddCodeDate ()
 
OmmArrayaddCodeTime ()
 
OmmArrayaddCodeDateTime ()
 
OmmArrayaddCodeQos ()
 
OmmArrayaddCodeState ()
 
OmmArrayaddCodeEnum ()
 
OmmArrayaddCodeBuffer ()
 
OmmArrayaddCodeAscii ()
 
OmmArrayaddCodeUtf8 ()
 
OmmArrayaddCodeRmtes ()
 
const OmmArraycomplete ()
 
- Public Member Functions inherited from thomsonreuters::ema::access::Data
const EmaStringgetCodeAsString () const
 
 operator const char * () const
 
virtual ~Data ()
 

Additional Inherited Members

- Public Types inherited from thomsonreuters::ema::access::Data
enum  DataCode {
  NoCodeEnum = 0,
  BlankEnum = 1
}
 
- Protected Member Functions inherited from thomsonreuters::ema::access::Data
 Data ()
 

Detailed Description

The following code snippet shows addition of primitive data type entries to OmmArray.

OmmArray array;
array.fixedWidth( 8 ).addInt( -16 ).addInt( 28 ).addInt( -35 ).complete();

The following code snippet shows getting data from OmmArray.

const ElementEntry& eEntry = eList.getEntry();
if ( eEntry.getLoadType() == DataType::OmmArrayEnum &&
eEntry.getCode() != Data::BlankEnum )
{
const OmmArray& array = eList.getArray();
while ( array.forth() )
{
const OmmArrayEntry& aEntry = array.getEntry();
switch ( aEntry.getLoadType() )
{
Int64 value = aEntry.getInt();
break;
const OmmReal& real = aEntry.getReal();
break;
...
}
}
}
Remarks
Objects of this class are intended to be short lived or rather transitional.
This class is designed to efficiently perform setting and extracting of OmmArray and its content.
Objects of this class are not cache-able.
All methods in this class are Lock-free Method.
See Also
Data, OmmArrayEntry, OmmReal, OmmState, OmmQos, EmaString, EmaBuffer

Definition at line 85 of file OmmArray.h.

Constructor & Destructor Documentation

thomsonreuters::ema::access::OmmArray::OmmArray ( )

Constructs OmmArray

virtual thomsonreuters::ema::access::OmmArray::~OmmArray ( )
virtual

Destructor

Member Function Documentation

OmmArray& thomsonreuters::ema::access::OmmArray::addAscii ( const EmaString value)

Adds a specific simple type of OMM data to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Parameters
[in]valueadded EmaString as OmmAscii
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addBuffer ( const EmaBuffer value)

Adds a specific simple type of OMM data to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Parameters
[in]valueadded EmaBuffer as OmmBuffer
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addCodeAscii ( )

Adds a blank data code to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addCodeBuffer ( )

Adds a blank data code to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addCodeDate ( )

Adds a blank data code to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addCodeDateTime ( )

Adds a blank data code to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addCodeDouble ( )

Adds a blank data code to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addCodeEnum ( )

Adds a blank data code to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addCodeFloat ( )

Adds a blank data code to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addCodeInt ( )

Adds a blank data code to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addCodeQos ( )

Adds a blank data code to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addCodeReal ( )

Adds a blank data code to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addCodeRmtes ( )

Adds a blank data code to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addCodeState ( )

Adds a blank data code to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addCodeTime ( )

Adds a blank data code to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addCodeUInt ( )

Adds a blank data code to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addCodeUtf8 ( )

Adds a blank data code to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addDate ( UInt16  year,
UInt8  month,
UInt8  day 
)

Adds a specific simple type of OMM data to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
OmmOutOfRangeExceptionif passed in OmmDate is invalid
Parameters
[in]yearadded OmmDate::year (0 - 4095 where 0 indicates blank)
[in]monthadded OmmDate::month (0 - 12 where 0 indicates blank)
[in]dayadded OmmDate::day (0 - 31 where 0 indicates blank)
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addDateTime ( UInt16  year,
UInt8  month,
UInt8  day,
UInt8  hour = 0,
UInt8  minute = 0,
UInt8  second = 0,
UInt16  millisecond = 0,
UInt16  microsecond = 0,
UInt16  nanosecond = 0 
)

Adds a specific simple type of OMM data to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
OmmOutOfRangeExceptionif passed in OmmDate is invalid
Parameters
[in]yearadded OmmDateTime::year (0 - 4095 where 0 indicates blank)
[in]monthadded OmmDateTime::month (0 - 12 where 0 indicates blank)
[in]dayadded OmmDateTime::day (0 - 31 where 0 indicates blank)
[in]houradded OmmDateTime::hour (0 - 23 where 255 indicates blank)
[in]minuteadded OmmDateTime::minute (0 - 59 where 255 indicates blank)
[in]secondadded OmmDateTime::second (0 - 60 where 255 indicates blank)
[in]millisecondadded OmmDateTime::millisecond (0 - 999 where 65535 indicates blank)
[in]microsecondadded OmmDateTime::microsecond (0 - 999 where 2047 indicates blank)
[in]picosecondsadded OmmDateTime::nanosecond (0 - 999 where 2047 indicates blank)
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addDouble ( double  value)

Adds a specific simple type of OMM data to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Parameters
[in]valueadded double
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addEnum ( UInt16  value)

Adds a specific simple type of OMM data to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Parameters
[in]valueadded Enum
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addFloat ( float  value)

Adds a specific simple type of OMM data to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Parameters
[in]valueadded float
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addInt ( Int64  value)

Adds a specific simple type of OMM data to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Parameters
[in]valuespecifies added Int64
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addQos ( UInt32  timeliness = OmmQos::RealTimeEnum,
UInt32  rate = OmmQos::TickByTickEnum 
)

Adds a specific simple type of OMM data to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Parameters
[in]timelinessadded OmmQos::timeliness (default value is OmmQos::RealTimeEnum)
[in]rateadded OmmQos::rate (default value is OmmQos::TickByTickEnum)
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addReal ( Int64  mantissa,
OmmReal::MagnitudeType  magnitudeType 
)

Adds a specific simple type of OMM data to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Parameters
[in]mantissaadded OmmReal::mantissa
[in]magnitudeTypeadded OmmReal::magnitudeType
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addRealFromDouble ( double  value,
OmmReal::MagnitudeType  magnitudeType = OmmReal::Exponent0Enum 
)

Adds a specific simple type of OMM data to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Parameters
[in]valueadded double to be converted to OmmReal
[in]magnitudeTypeOmmReal::magnitudeType used for the conversion (default value is OmmReal::Exponent0Enum)
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addRmtes ( const EmaBuffer value)

Adds a specific simple type of OMM data to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Parameters
[in]valueadded EmaBuffer as OmmRmtes
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addState ( OmmState::StreamState  streamState = OmmState::OpenEnum,
OmmState::DataState  dataState = OmmState::OkEnum,
UInt8  statusCode = OmmState::NoneEnum,
const EmaString statusText = EmaString() 
)

Adds a specific simple type of OMM data to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Parameters
[in]streamStateadded OmmState::streamState (default value is OmmState::OpenEnum)
[in]dataStateadded OmmState::dataState (default value is OmmState::OkEnum)
[in]statusCodeadded OmmState::statusCode (default value is OmmState::NoneEnum)
[in]statusTextadded OmmState::text (default value is 'empty string')
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addTime ( UInt8  hour = 0,
UInt8  minute = 0,
UInt8  second = 0,
UInt16  millisecond = 0,
UInt16  microsecond = 0,
UInt16  nanosecond = 0 
)

Adds a specific simple type of OMM data to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
OmmOutOfRangeExceptionif passed in OmmTime is invalid
Parameters
[in]houradded OmmTime::hour (0 - 23 where 255 indicates blank)
[in]minuteadded OmmTime::minute (0 - 59 where 255 indicates blank)
[in]secondadded OmmTime::second (0 - 60 where 255 indicates blank)
[in]millisecondadded OmmTime::millisecond (0 - 999 where 65535 indicates blank)
[in]microsecondadded OmmTime::microsecond (0 - 999 where 2047 indicates blank)
[in]nanosecondadded OmmTime::nanosecond (0 - 999 where 2047 indicates blank)
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addUInt ( UInt64  value)

Adds a specific simple type of OMM data to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Parameters
[in]valuespecifies added UInt64
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::addUtf8 ( const EmaBuffer value)

Adds a specific simple type of OMM data to the OmmArray.

Exceptions
OmmInvalidUsageExceptionif first addition was of different data type
Parameters
[in]valueadded EmaBuffer as OmmUtf8
Returns
reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::clear ( )

Clears the OmmArray

Remarks
Invoking clear() method clears all the values and resets all the defaults
Returns
reference to this object
const OmmArray& thomsonreuters::ema::access::OmmArray::complete ( )

Completes encoding of OmmArray.

Returns
const reference to this object
OmmArray& thomsonreuters::ema::access::OmmArray::fixedWidth ( UInt16  width)

Specifies FixedWidth. Setting fixed-width implies each array entry has been populated with the same fixed size, to allow minimizing bandwidth. Setting fixed-width as 0 implies the data contained in the array entries may be of different sizes, to allow the flexibility of different sized encoding;

When using a fixed width, the application still passes in the base primitive type when encoding (e.g., if encoding fixed width DataType::IntEnum types, an Int is passed in regardless of fixed width). When encoding buffer types as fixed width: Any content that exceeds fixedWidth will be truncated. Any content that is shorter than fixedWidth will be padded with the \0 (NULL) character.

Only specific types are allowed as fixed-width encodings. Here lists supported fixed widths and allowable data ranges: DataType::IntEnum supports one byte(-2^7 to 2^7-1), two byte(-2^15 to 2^15-1), four byte((-2^31 to 2^31-1), or eight byte((-2^63 to 2^63-1). DataType::UIntEnum supports one byte(0 to 2^8-1), two byte(0 to 2^16-1), four byte(0 to 2^32-1), or eight byte(0 to 2^64-1). DataType::FloatEnum supports four byte, floating point type that represents the same range of values allowed by the system float type. Follows the IEEE 754 specification. DataType::DoubleEnum supports eight byte, floating point type that represents the same range of values allowed by the system double type. Follows the IEEE 754 specification. DataType::DateEnum supports four byte(year, month, day). DataType::TimeEnum supports: three byte(hour, minute, second); five byte(hour, minute, second, millisec); seven byte(hour, minute, second, millisec, microsec); eight byte(hour, minute, second, millisec, microsec, nanosec). DataType::DateTimeEnum supports: seven byte(year, month, day, hour, minute, second); nine byte(year, month, day, hour, minute, second, millisec); eleven byte(year, month, day, hour, minute, second, millisec, microsec); twelve byte(year, month, day, hour, minute, second, millisec, microsec, nanosec); DataType::EnumEnum supports one byte(0 to 2^8-1) or two byte(0 to 2^16-1). DataType::BufferEnum, DataType::AsciiEnum, DataType::Utf8Enum, and DataType::RmtesEnum support any legal width value.

Exceptions
OmmInvalidUsageExceptionif an entry was already added
Parameters
[in]widthspecifies fixed width value
Returns
reference to this object
bool thomsonreuters::ema::access::OmmArray::forth ( ) const

Iterates through a list of Data of any DataType. Typical usage is to extract the entry during each iteration via getEntry().

Returns
false at the end of Ommarray; true otherwise
const EmaBuffer& thomsonreuters::ema::access::OmmArray::getAsHex ( ) const
virtual

Returns a buffer that in turn provides an alphanumeric null-terminated hexadecimal string representation.

Returns
EmaBuffer with the message hex information

Implements thomsonreuters::ema::access::Data.

Data::DataCode thomsonreuters::ema::access::OmmArray::getCode ( ) const
virtual

Returns the Code, which indicates a special state of a DataType.

Returns
Data::BlankEnum if OmmArray is blank; Data::NoCodeEnum otherwise

Implements thomsonreuters::ema::access::Data.

DataType::DataTypeEnum thomsonreuters::ema::access::OmmArray::getDataType ( ) const
virtual

Returns the DataType, which is the type of Omm data. Results in this class type.

Returns
DataType::OmmArrayEnum

Implements thomsonreuters::ema::access::Data.

const OmmArrayEntry& thomsonreuters::ema::access::OmmArray::getEntry ( ) const

Returns Entry.

Exceptions
OmmInvalidUsageExceptionif forth() was not called first
Returns
OmmArrayEntry
UInt16 thomsonreuters::ema::access::OmmArray::getFixedWidth ( ) const

Returns FixedWidth.

Returns
fixed width
bool thomsonreuters::ema::access::OmmArray::hasFixedWidth ( ) const

Indicates presence of FixedWidth.

Returns
true if fixed width is set; false otherwise
void thomsonreuters::ema::access::OmmArray::reset ( ) const

Resets iteration to start of container.

const EmaString& thomsonreuters::ema::access::OmmArray::toString ( ) const
virtual

Returns a string representation of the class instance.

Returns
string representation of the class instance

Implements thomsonreuters::ema::access::Data.