Hi,
I'm using the following macro to read in an object of SimulationInfoBlock:
#include <vector>
void Macro()
{
gROOT->ProcessLine(".L Id.cpp+");
gROOT->ProcessLine(".L CircuitInfo.cpp+");
gROOT->ProcessLine(".L RootLayerDescription.cpp+");
gROOT->ProcessLine(".L RootLayeredNetDescription.cpp+");
gROOT->ProcessLine(".L SimulationInfoBlock.cpp+");
TFile* p_file = new TFile("simulationorganizersmalldirect.root");
SimulationInfoBlock* p_block =
(SimulationInfoBlock*)p_file->Get("simulationorganizersmalldirect");
cout << p_block->Name() << endl;
std::vector<CircuitInfo> vec_info = p_block->InfoVector();
cout << vec_info.size() << endl;
}
I've created the file simulationorganizersmalldirect.root by a stand alone program and would like to make sure that the information generated can be read and analyzed in CINT sessions.
I get the following error:
root [0] .L Macro.cpp
root [1] Macro()
simulationorganizersmalldirect
Error: Can't call vector<CircuitInfo,allocator<CircuitInfo> >::size() in current scope Macro.cpp:18:
Possible candidates are...
(in vector<CircuitInfo,allocator<CircuitInfo> >)
(class G__CINT_ENDL)28780720
root [2]
Any idea as to what the problem might be? I'm puzzled because reading in the object from the file seems to work.
I have attached the class definitions used in SimulationInfoBlock. I also included the LinkDef.h used to generate the dictionary for the stand alone program. I use root 5.22/00.
Thanks,
Marc
---------------------------SimulationInfoBlock---------------------------- class SimulationInfoBlock : public TNamed { public: ClassDef(SimulationInfoBlock,1); // Necessary for ROOT I/O SimulationInfoBlock(); SimulationInfoBlock ( const SimulationInfoBlock& ); SimulationInfoBlock ( const TString&, const RootLayeredNetDescription&, const std::vector<CircuitInfo>& ); TString Name() const; const vector<CircuitInfo> InfoVector() const; const RootLayeredNetDescription DescriptionVector() const; private: TString _name; RootLayeredNetDescription _desc; std::vector<CircuitInfo> _info; }; // end of Id ----------------LinkDef.h-----------------------------
#include <vector>
#pragma link C++ class Id+;
//#pragma link C++ class NetId+;
#pragma link C++ class CircuitInfo+;
#pragma link C++ class WeightedLink<double>+;
#pragma link C++ class std::vector<CircuitInfo>+;
#pragma link C++ class RootLayerDescription+;
#pragma link C++ class std::vector<RootLayerDescription>+;
#pragma link C++ class RootLayeredNetDescription+;
#pragma link C++ class SimulationInfoBlock+;
#pragma link C++ class std::vector<SimulationInfoBlock>+;
#pragma link C++ class SimulationInfoBlockVector;
Dr. Marc de Kamps
Biosystems Group
School of Computing
University of Leeds
LS29JT, Leeds, UK
<mailto:dekamps_at_comp.leeds.ac.uk> dekamps_at_comp.leeds.ac.uk
http:/www.comp.leeds.ac.uk/dekamps Received on Tue May 12 2009 - 17:28:33 CEST
This archive was generated by hypermail 2.2.0 : Wed May 13 2009 - 17:50:02 CEST