Hello all,
I am trying to create dictionaries for a class whose members include pointers to structs of the form
struct epm_gsl_block {
size_t size;
double *data; //[size]
};
struct epm_gsl_vector {
size_t size;
size_t stride;
double *data; //[size]
epm_gsl_block *block;
int owner;
};
These are bit-compatible with equivalent structs in the GSL library (gsl_block and gsl_vector). Originally the class member was a gsl_vector* pointer; but since I could not get genreflex to build dictionaries for these foreign structs (and since I later recognized I would have to add the annotations //[size]) I created these bit-compatible structs, which can be converted back and forth via reinterpret_cast-ing. However, there are remaining problems with persistency — I get the following errors:
Error in TStreamerInfo::Build: epm_gsl_block, discarding: double* data, illegal [size] (must be Int_t)
Error in TStreamerInfo::Build: epm_gsl_vector, discarding: double* data, illegal [size] (must be Int_t)
The underlying type of size_t is typically an unsigned long, rather than an unsigned int. The relevant code that restricts of the counter to be integer is found in TStreamerInfo.cxx (from https://root.cern.ch/doc/master/TStreamerInfo_8cxx_source.html, starting at line 447):
TDataType* dtCounter = dmCounter->GetDataType();
Bool_t isInteger = dtCounter && ((dtCounter->GetType() == 3) || (dtCounter->GetType() == 13));
if (!dtCounter || !isInteger) {
Error("Build", "%s, discarding: %s %s, illegal [%s] (must be Int_t)\n", GetName(), dmFull, dmName, counterName);
continue;
}
Types 3 and 13 are Int_t and UInt_t, while 4 and 14 are Long_t and ULong_t. I cannot think of a reason why it shouldn’t be possible to to allow the dtCounter to be a long type integer (especially since size_t is the canonical type for the size of an array in modern C/C++). Is there are workaround for this issue, or would it be possible to extend TStreamerInfo to allow long types for the counter?