Easy way to translate OMM Enumeration field from number to text?

Trying to
convert the enum primitive value to its display value e.g. for CURRECY field
want to translate 340 to USD according to enumtype.def. Can I use UPA library to help me solve this problem?

Best Answer

  • In UPA/Java:

    DictionaryEntry dictionary_entry;
    Enum rssl_enum;
    // ...
    LOG.debug("{}", rdm_dictionary.entryEnumType (dictionary_entry, rssl_enum).display().toString());

    Similarly in UPA/C:

    RsslDictionaryEntry* dictionary_entry;
    RsslEnum rssl_enum;
    /* ... */
    RsslEnumType* enum_type = getFieldEntryEnumType(dictionary_entry, rssl_enum);
    printf("%.s", enum_type->display.length, enum_type->display.data);

Answers

  • Are you using UPA C or UPA Java?

  • UPA is not built to interpret string based content streams – it is intended to interpret and decode binary OMM/RWF content. All of the UPA dictionary helpers are using binary (U16 type) field ID lookups and enumeration lookups.

    To use the UPA helpers, you would have to do a lot of string conversion and interpretation to get your content to the point where you could interpret it with UPA – by the time you have done all of the other manipulation, it is probably easier to just write your own enumeration interpreter to avoid multiple conversions to and from strings and better work with the content you are processing.

  • This is answering a different question?