question

Upvotes
Accepted
28 5 7 12

EMA ElementList access problem

Hi,

We are using Elektron Message API C++ edition, and have problem with accessing EMA ElementList object after it is created. Below is a very simple code snippet for the usage of the ElementList. Looks like that there is problem with Decoder in the ElementList whis is null and all operation on the element list throws access violation exception:

ElementList elementList;

elementList.addArray("", OmmArray().addInt(9).addInt(8).complete()).complete();

EmaString st = elementList.toString();
bool b = elementList.hasInfo(); // ----> this line throws an access violation exception
while (elementList.forth()) // ----> this line throws an access violation exception too

Actually whatever operation we call on newly created element list it throws an exception.

Do you know the reason for this? Or is it known issue?

Thanks

Regards

elektronrefinitiv-realtimeelektron-sdkema-apirrtelektron-message-apic++
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Upvotes
Accepted
7.6k 15 6 9

@mojtaba.danai

It seems to be restriction of EMA C++ mentioned in section 3.2.3 Data Class from EMA Developer Guide.

The EMA does not support immediately retrieving data from freshly created OMM containers or messages. 

Based on the description above, this should be the case you are experiencing.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks for the answer @moragodkrit. Is it possible to have an elementlist stored as a class member and pass it as search list for the retrieved FieldList when calling forth method, instead of creating it every time when iterating thorough filed list? In the documentation it is mentioned that Data class and all classes that inherit from it are designed as temporary short-lived objects. And for this reason do not use them as storage or caching devices. But the code seems working. Thanks

Though the codes works for now, as far as I understand it may have the case that EMA might need to clean up internal object and it may affect the EMA object you stored as a class member. The Data class was designed as temporary short-lived objects therefore we suggest you to copy the data you need from the ElementList or FiledList object and keep it in your own datstructure of class instead.

Thanks @moragodkrit. Yes we could keep our own structure. But every time we wish to iterate through received field list, we have to create ElementList and pass it to the forth method of fieldList, and it won't be efficient. The forth method only gets reference to Data as parameter, which in this case is a ElementList as search list.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.