Discussion:
STL containers in data format classes (and trees)
Corey Reed
2014-08-31 23:22:59 UTC
Permalink
Hi,

I have some data format classes that currently used fixed length C
arrays, but the length will need to change. To keep things backgward and
forward compatible, I would like to switch to dynamic arrays.

I was wondering what, if any, issues I should be aware of with the use
of STL containers (std::vector)?

The data format classes are stored in split branches of ROOT trees.
Typical tree->Draw statements by users will do things like
Draw("arrayVariable:Iteration$"). std::vector<float> supports such a
Draw, while TArrayF does not.

- If no library is available, can the std::vector (split) branches still
be read? This seems to work for C arrays.

- Will the i/o streamer facility ('+' in the LinkDef) work reliably for
these classes going forward?

- Are there any other issues I should know about?

Thanks!

- Corey
Philippe Canal
2014-09-05 23:03:47 UTC
Permalink
Hi Corey,
- If no library is available, can the std::vector (split) branches still be read? This seems to work for C arrays.
Yes.
- Will the i/o streamer facility ('+' in the LinkDef) work reliably for these classes going forward?
Yes.
- Are there any other issues I should know about?
I don't think so.

Cheers,
Philippe.
Hi,
I have some data format classes that currently used fixed length C arrays, but the length will need to change. To keep things
backgward and forward compatible, I would like to switch to dynamic arrays.
I was wondering what, if any, issues I should be aware of with the use of STL containers (std::vector)?
The data format classes are stored in split branches of ROOT trees. Typical tree->Draw statements by users will do things like
Draw("arrayVariable:Iteration$"). std::vector<float> supports such a Draw, while TArrayF does not.
- If no library is available, can the std::vector (split) branches still be read? This seems to work for C arrays.
- Will the i/o streamer facility ('+' in the LinkDef) work reliably for these classes going forward?
- Are there any other issues I should know about?
Thanks!
- Corey
Loading...