New Data Dictionary interface in EMA C++

I just downloaded latest Elektron SDK 1.1.0 with EMA3.1.0 and found below information from EMA README but can't find details about the new interface mentioned in the README in Developer Guide.

Do you have details about Dictionary interfaces and how to use it?

2.1.2 Service Requests Resolved In This Release

[EMA-779] - CaseId: 04874840 Provide interface for user access of the internal EMA dictionary

Best Answer

  • @Akechi Sato

    There are several improvements in EMA 3.1.0.
    In term of Data Dictionary, I found new classes from EMA Reference Manual
    (<EMA Install Folder>\Docs\refman\ema). You should be able to use below
    classes to access EMA data dictionary

    • DataDictionary (thomsonreuters::ema::rdm)
    • DictionaryEntry
      (thomsonreuters::ema::rdm)
    • DictionaryUtility
      (thomsonreuters::ema::rdm)

    Also in this version, FieldEntry class provide
    method to get Enum display by using getEnumDisplay() method.

    The new version implements features
    which allow you to get access to the internal EMA dictionary via the
    thomsonreuters::ema::rdm::DataDictioanry class. The EMA’s DataDictionary is the
    Dictionary utility which provides the same capability as same as the
    RsslDataDictionary in ETA C. The example
    "332__Dictionary__Streaming" also update to use the class to decode downloaded
    Data Dictionary.

    Moreover application can extract a
    DataDictionary object used by FieldList when decoding it via the
    DictionaryUtility::dataDictionary() static method. But The DataDictionary is
    valid only in the context of a callback method according to EMA Reference
    Manual.

    DataDictionary and DictionaryEntry class also
    provide interfaces to get Dictionary information such as EnumTables,
    DictionaryID, FieldVersion, EnumRecordTemplateVersion.

    Below is snippet of codes I used to access
    Dictionary data such as Fid ID, Fid Acronym and print Enum table in case that
    the Fid is Enumerate field. I have tested the codes with
    332_Dictionary_Streaming example and change codes in AppClient::decode to print
    dictionary after it received both RWFFld and RWFEnum dictionary.

    if (fldDictComplete && enumTypeComplete)
    {
    const EmaVector<DictionaryEntry>& dictEntries =
    dataDictionary.getEntries();
    for (int index=0; index < dictEntries.size(); index++)
    {
    int fidID = dictEntries[index].getFid();
    std::cout<< "FID[" << fidID << "][" <<
    dictEntries[index].getAcronym() << "]" << endl;

    if(dictEntries[index].hasEnumTypeTable())
    {
    const EnumTypeTable& enumTable = dictEntries[index].getEnumTypeTable();
    const EmaVector<EnumType>& enumType = enumTable.getEnumTypes();
    for(int i = 0; i < enumType.size(); i++)
    {
    EmaString displayTxt;
    displayTxt.append(enumType[i].getDisplay());
    cout<< "\t Enum [" << enumType[i].getValue() << "]
    Display[" << displayTxt << "]" << endl;
    }
    }
    }
    }

    And below is output when running the example
    with modified codes




    FID[12][HIGH_1]
    FID[13][LOW_1]
    FID[14][PRCTCK_1]
    Enum [0] Display[ ]
    Enum [1] Display[Þ]
    Enum [2] Display[þ]
    Enum [3] Display[ ]
    Enum [4] Display[0]
    Enum [5] Display[U]
    Enum [6] Display[D]
    Enum [7] Display[+]
    Enum [8] Display[-]
    FID[15][CURRENCY]
    Enum [0] Display[ ]
    Enum [4] Display[AFA]
    Enum [8] Display[ALL]
    Enum [12] Display[DZD]
    Enum [20] Display[ADP]
    Enum [24] Display[AON]
    Enum [32] Display[ARS]
    Enum [36] Display[AUD]
    Enum [37] Display[AUc]
    Enum [40] Display[ATS]
    Enum [44] Display[BSD]
    Enum [48] Display[BHD]
    Enum [50] Display[BDT]
    Enum [51] Display[AMD]
    Enum [52] Display[BBD]
    Enum [56] Display[BEF]
    Enum [60] Display[BMD]
    Enum [64] Display[BTN]
    Enum [68] Display[BOB]
    Enum [70] Display[BAD]
    Enum [72] Display[BWP]
    Enum [76] Display[BRL]
    ...

Answers


  • EMA provides the dictionary streaming feature for applications to create dictionary request to receive dictionary response messages internally used by EMA or from the network. The internal dictionary used by EMA can be loaded either from the file or network dictionary. The 332__Dictionary__Streaming example shows how to create two dictionary request messages to access the internal EMA dictionary as follows:

    UInt64 fldHandle = consumer.registerClient(ReqMsg().name("RWFFld").filter(DICTIONARY_NORMAL).domainType(MMT_DICTIONARY),client,closure);
    UInt64 enumHandle = consumer.registerClient(ReqMsg().name("RWFEnum").filter(DICTIONARY_NORMAL).domainType(MMT_DICTIONARY),client,closure);

    For requesting dictionary from network, applications must specify either service name or Id to explicitly request dictionary from a provider.

    UInt64 fldHandle = consumer.registerClient(ReqMsg().name("RWFFld").filter(DICTIONARY_NORMAL).domainType(MMT_DICTIONARY).serviceName("ELEKTRON_DD"),client,closure);
    UInt64 enumHandle = consumer.registerClient(ReqMsg().name("RWFEnum").filter(DICTIONARY_NORMAL).domainType(MMT_DICTIONARY).serviceName("ELEKTRON_DD"),client,closure);

    For handling dictionary response messages, applications can use an instance of DataDictionary object to store the payload of the messages and use DataDictionary to retrieve dictionary information such as dictionary version, iterate all dictionary entry and enumerated type definition, search for a dictionary entry with a field name or Id, search for an enumerated type definition.

    Furthermore, the DataDictionary class can be used to load dictionary from file and encode the dictionary payload. Please see IProvider 332__Dictionary_UserControl that demonstrates how to use these functionalities.