Hello Ralph The base class to create a variable length array of the C-struct is called TTable. http://root.cern.ch/root/htmldoc/TTable.html#TTable:description http://root.cern.ch/root/htmldoc/TGenericTable.html#TGenericTable:descri ption This class was successfully used for 5 years for STAR and for 2 years for Atlas ROOT I/O based persistency as well. See: http://www.usatlas.bnl.gov/computing/software/db/htmldoc/examples/ http://www.usatlas.bnl.gov/computing/software/db/Chep2000.pdf http://www-conf.slac.stanford.edu/chep03/register/report/abstract.asp?ai d=494 http://www.usatlas.bnl.gov/computing/software/db/rootio.html Hope this helps, Valeri > > > Hello! > > > > I would like to save an object of the bellow declared BPM_ALL_BASE. > > This class has two pointer to call the class 'monitor_info'. > > > > First I declared a static array of 'single_monitor' in 'monitor_info' > and the > > root standard streamer functions decomposed this array properly so that > the > > needed data could be saved to file. > > I decided to use a variable length array to save some memory because > both > > 'monitor_info' classes differs largely in size (factor 1000:1) but can > and > > should be described equally. > > > > Is there a easy solution to save a variable length array of C struct > without > > decomposing the C struct into three singular arrays or to write a new > > streamer? > > > > Thanks in advance. > > > > Ralph Steinhagen > > > > [..] excerpts out of the code > > > > struct single_monitor > > { > > Char_t name[20]; > > Float_t pos; > > Int_t plane; // 1: horizontal 2: vertical > > }; > > > > class monitor_info: public TObject > > { public: > > monitor_info(); > > ~monitor_info(); > > Int_t GetMonitorCount(); > > Char_t* GetMonitorName(Int_t i); > > Float_t GetMonitorPosition(Int_t i); > > Int_t GetMonitorPlane(Int_t i); > > const Char_t* GetMonitorNamePlane(Int_t i); > > Int_t AddMonitor(Int_t i, Char_t *name, Float_t pos, > Int_t plane); > > Int_t IsMonitorPlane(Int_t i, Int_t plane); > > > > private: > > Int_t fcount; > > single_monitor *fmonitor; //[fcount] > > > > ClassDef(monitor_info,1) > > }; > > > > > > class BPM_ALL_BASE : public TObject > > { > > public: > > Int_t Cycletype; > > > > monitor_info *MOPOS_Monitor; //-> > > monitor_info *REALTIME_Monitor; //-> > > > > BPM_ALL_BASE(); > > ~BPM_ALL_BASE(); > > > > private: > > > > ClassDef(BPM_ALL_BASE,1) > > }; > > > > > >
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET