Login Page - Create Account

Support Board


Date/Time: Thu, 25 Apr 2024 11:07:47 +0000



[Programming Help] - Persisting complex classes

View Count: 599

[2019-12-12 23:19:28]
jmt816 - Posts: 45
for an ASCIL study i am working on, i am using a custom class. This class contains a custom struct.
Using the PersistentPointer functions, the basic class persists and reloads correctly. However, the values of the complex struct it contains are not being persisted.
simplified example (please forgive any syntax error here, this is more of pseudo code than actual)

struct MyStruct {
float MyFloat;
int MyInt;
}


class MyClass {
private:
int AnotherInt;
float MyFloatArray[10];
MyStruct ComplexStruct;

// not showing initialization, etc
}


upon retrieval and inspection of the object of type MyClass, the basic members of the class, including arrays, are correctly stored and retrieved. However, the values inside the Struct are all uninitialized, even tho they were set during operation.

My hunch is that the structs would require an add'l persistent pointer to maintain? Or is there another approach? FWIW, the custom struct also contains another small struct. I could refactor to avoid the use of the structs if absolutely necessary, but I would prefer to be able to keep the encapsulation that they provide.

IF the correct approach would be to use add'l PersistentPointers for the structs inside the class, would the approach then be to store the value of the index for the pointer in the class, pass in an instance of SCStudyInterfaceRef and inside the class call Get/Set Persistent Pointers? And would there need to be some add'l method needed (an init or something) to let the object know that it is being "recreated" and therefore that it needs to call GetPersistentPointer ?
hopefully that wasn't too confusing.
Greatly appreciate your input.
Thanks,
[2019-12-13 00:34:55]
jmt816 - Posts: 45
NEVER MIND, found an issue in my code.
Sierra works as designed and expected. sorry for bothering you.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account