When I execute those lines, the default constructor of MyObject is called before data members are assigned a value.
In the next step [2], the data members of the class - as they are stored in the ROOT file - have been already loaded.
So, the following command works as expected
[2] ob->GetMyDataMember();
However, before reaching the execution of [2] I would like to be able to call another Initialisation method, once the data members have been already loaded. Because I need to know the values in the initialisation. It is this possible?
to be called automatically (lets say internally) when I call
MyObject *ob = (MyObject *) f->Get("objName");.
I thought I could do that in the constructor of the class, but data members have not been yet loaded. There is a way to force the load of data members already in the constructor?
Ok, I have not much experience with LinkDef and pragma instructions. But for each class in our library we create a custom LinkDef inside a cmake macro. So I guess I will be able to add that line to the class I am interested in.
For information, at this header link and source link you will find the class code where I want to do such thing.
The following data members load normally with f->Get.
name_of_datamembers : This is a list of data members that need to be preloaded? Or that will be initialised afterwards? If it is a list, a proper separator is :?
newObj : is a key parameter definition or I should replace by something more meaningful?
version : I have to specify the current version of the class? Or I can specify any?
You should specify the verison on-file that which the rule should applies (so from your description, it is ‘any/all’ so "[1-]" should do.
newObj : is a key parameter definition or I should replace by something more meaningful?
No. It is a variable provided as input to the code. It points to the live object in memory. (there is also onfile which would point to a in-memory representation of the data as-is on of the file).
name_of_datamembers : This is a list of data members that need to be preloaded? Or that will be initialised afterwards? If it is a list, a proper separator is : ?
Not exactly. There are 2 lists. source which should contain the onfile data member that needs to be used as input (in their onfile/old format); an example of such list is "float fPx; float fPy;".
The second is target which is a list of the in-memory object affected by the rule and an example is "fentries, farrayPointer"