Hi,
I am trying to write my own class containg a chrono::time_point to a tree. The class contains only one data member, a std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>
variable. How do I put this in the LinkDef.h?
C++:
class MyTimepoint : public TObject {
std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> tp_;
public:
MyTimepoint() = default;
// getters/setters
ClassDef(MyTimepoint, 1)
};
LinkDef:
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ nestedclasses;
// #pragma link C++ class std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>-!;
#pragma link C++ class MyTimepoint+;
This compiles fine but when writing to a tree, I get this warning:
Warning in <TStreamerInfo::Build>: MyTimepoint: chrono::time_point<chrono::system_clock,chrono::duration<long,ratio<1,1000000000> > > has no streamer or dictionary, data member "tp_" will not be saved
Warning in <TStreamerInfo::Build>: chrono::time_point<chrono::system_clock,chrono::duration<long,ratio<1,1000000000> > >: chrono::duration<long,ratio<1,1000000000> > has no streamer or dictionary, data member "__d" will not be saved
It seems to work fine though. I can write time_points to a tree and read them back. But getting this warning every time is not good. So probably something is wrong here…
I’ve tried to add the chrono::time_point to the LinkDef.h file (see commented line) but then it doen’t compile any longer:
Error: Class chrono::time_point<chrono::system_clock,chrono::duration<long,ratio<1,1000000000> > > has been selected but currently the support for its I/O is not yet available. Note that chrono::time_point<chrono::system_clock,chrono::duration<long,ratio<1,1000000000> > >, even if not selected, will be available for interpreted code.
Does “support for its I/O is not yet available” mean is isn’t currently supported in ROOT? What exactly do I need to do to support time_point members?
(I know there is TTimeStamp but I prefer the chrono interface, and oviously I want to template the class to allow for different time_point precisions)