Skip to content

Spurious(?) warnings persisting interpreted classes #9371

@bendavid

Description

@bendavid

In some cases when trying to persist classes from ACLIC or the interpreter, there are warnings about missing dictionaries, which apparently don't prevent correctly persisting the class.

Real use case is persisting boost histogram templates instantiated with PyROOT, but a standalone example is included below.

#include "TFile.h"
#include <atomic>
#include <iostream>

class Test {
public:
  std::atomic<double> &data() { return data_; }
  const std::atomic<double> &data() const { return data_; }

private:
  std::atomic<double> data_;
};

class Test2 : public std::atomic<double> {
};

int testio() {


  Test t;
  t.data() = 5.;

  Test2 t2;
  t2.store(5.);

  TFile *fout = TFile::Open("test.root", "RECREATE");

  fout->WriteObject(&t, "t");
  fout->WriteObject(&t2, "t2");

  fout->Close();

  TFile *fin = TFile::Open("test.root");

  auto &tread = *fin->Get<Test>("t");
  auto &tread2 = *fin->Get<Test2>("t2");

  std::cout << tread.data() << std::endl;
  std::cout << tread2 << std::endl;


  return 0;
}

The output is:

[bendavid@docker@lxplus8s10 boostiotest]$ root -l testio.cpp+
root [0] 
Processing testio.cpp+...
Info in <TUnixSystem::ACLiC>: creating shared library /home/b/bendavid/boostiotest/./testio_cpp.so
Warning in <TStreamerInfo::Build>: Test: atomic<double> has no streamer or dictionary, data member "data_" will not be saved
Warning in <TStreamerInfo::Build>: Test2: base class atomic<double> has no streamer or dictionary it will not be saved
5
5
(int) 0

So apparently both classes (and the std::atomic data member and/or base class) are persisted just fine.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions