Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/externals/g4tools/include/tools/wroot/element

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
  2 // See the file tools.license for terms.
  3 
  4 #ifndef tools_wroot_element
  5 #define tools_wroot_element
  6 
  7 #include "buffer"
  8 #include "named"
  9 #include "../snpf"
 10 
 11 namespace tools {
 12 namespace wroot {
 13 
 14 namespace streamer__info {
 15 
 16   enum Type {              // sizeof :
 17     BASE = 0,              //  x
 18     ARRAY = 20,            //  ?
 19     POINTER = 40,          //  4
 20     POINTER_INT = 43,      //  4
 21     POINTER_FLOAT = 45,    //  4
 22     POINTER_DOUBLE = 48,   //  4
 23     COUNTER =  6,          //  4
 24     CHAR =  1,             //  1
 25     SHORT =  2,            //  2
 26     INT =  3,              //  4
 27     FLOAT =  5,            //  4
 28     DOUBLE =  8,           //  8
 29     UNSIGNED_CHAR =  11,   //  1
 30     UNSIGNED_SHORT =  12,  //  2
 31     UNSIGNED_INT = 13,     //  4
 32     BOOL = 18,             //  1 ?
 33     OBJECT = 61,           //  ?
 34     OBJECT_ANY = 62,       //  ?
 35     OBJECT_ARROW = 63,     //  ?
 36     OBJECT_POINTER = 64,   //  ?
 37     _TSTRING = 65,         //  8  //NOTE : TSTRING clashes with a cpp macro in cfitsio.
 38     TOBJECT = 66,          // 12
 39     TNAMED = 67            // 28
 40   };
 41 
 42   const int size_FLOAT = 4;
 43   const int size_DOUBLE = 8;
 44   const int size_INT = 4;
 45   const int size_UINT = 4;
 46   const int size_SHORT = 2;
 47   const int size_BOOL = 4; //(Bool_t = 1 + 3 for alignement)
 48   //uuu ? const int size_BOOL = 1;
 49 
 50   const int size_TString = 8;
 51 }
 52 
 53 
 54 class streamer_element : public virtual ibo {
 55   static const std::string& s_class() {
 56     static const std::string s_v("tools::wroot::streamer_element");
 57     return s_v;
 58   }
 59 public: //ibo
 60   virtual const std::string& store_cls() const {
 61     static const std::string s_v("TStreamerElement");
 62     return s_v;
 63   }
 64   virtual bool stream(buffer& aBuffer) const {
 65     unsigned int c;
 66     if(!aBuffer.write_version(2,c)) return false;
 67     if(!Named_stream(aBuffer,fName,fTitle)) return false;
 68     if(!aBuffer.write(fType)) return false;
 69     if(!aBuffer.write(fSize)) return false;
 70     if(!aBuffer.write(fArrayLength)) return false;
 71     if(!aBuffer.write(fArrayDim)) return false;
 72     if(!aBuffer.write_fast_array<int>(fMaxIndex,5)) return false;
 73     if(!aBuffer.write(fTypeName)) return false;
 74     if(!aBuffer.set_byte_count(c)) return false;
 75     return true;
 76   }
 77 public:
 78   virtual streamer_element* copy() const = 0;
 79 public:
 80   virtual void out(std::ostream& aOut) const {
 81     std::string _fname;
 82     fullName(_fname);
 83     char _s[256];
 84     snpf(_s,sizeof(_s),"  %-14s%-15s offset=%3d type=%2d %-20s",fTypeName.c_str(),_fname.c_str(),fOffset,fType,fTitle.c_str());
 85     aOut << _s << std::endl;
 86   }
 87 public:
 88   streamer_element(const std::string& aName,const std::string& aTitle,
 89                    int aOffset,int aType,const std::string& aTypeName)
 90   :fName(aName),fTitle(aTitle),fType(aType)
 91   ,fSize(0),fArrayLength(0),fArrayDim(0),fOffset(aOffset)
 92   ,fTypeName(aTypeName){
 93 #ifdef TOOLS_MEM
 94     mem::increment(s_class().c_str());
 95 #endif
 96     for(int i=0;i<5;i++) fMaxIndex[i] = 0;
 97   }
 98   virtual ~streamer_element(){
 99 #ifdef TOOLS_MEM
100     mem::decrement(s_class().c_str());
101 #endif
102   }
103 protected:
104   streamer_element(const streamer_element& a_from)
105   :ibo(a_from)
106   ,fName(a_from.fName),fTitle(a_from.fTitle)
107   ,fType(a_from.fType),fSize(a_from.fSize)
108   ,fArrayLength(a_from.fArrayLength)
109   ,fArrayDim(a_from.fArrayDim),fOffset(a_from.fOffset)
110   ,fTypeName(a_from.fTypeName){
111 #ifdef TOOLS_MEM
112     mem::increment(s_class().c_str());
113 #endif
114     for(int i=0;i<5;i++) fMaxIndex[i] = a_from.fMaxIndex[i];
115   }
116   streamer_element& operator=(const streamer_element& a_from){
117     fName = a_from.fName;
118     fTitle = a_from.fTitle;
119     fType = a_from.fType;
120     fSize = a_from.fSize;
121     fArrayLength = a_from.fArrayLength;
122     fArrayDim = a_from.fArrayDim;
123     fOffset = a_from.fOffset;
124     fTypeName = a_from.fTypeName;
125     for(int i=0;i<5;i++) fMaxIndex[i] = a_from.fMaxIndex[i];
126     return *this;
127   }
128 public:
129   virtual void setArrayDimension(int aDimension){
130     fArrayDim = aDimension;
131     if(aDimension) fType += streamer__info::ARRAY;
132     //fNewType = fType;
133   }
134   virtual void setMaxIndex(int aDimension,int aMaximum){
135     //set maximum index for array with dimension dim
136     if (aDimension < 0 || aDimension > 4) return;
137     fMaxIndex[aDimension] = aMaximum;
138     if (fArrayLength == 0)  fArrayLength  = aMaximum;
139     else                    fArrayLength *= aMaximum;
140   }
141 
142   virtual void fullName(std::string& a_s) const {
143     a_s = fName;
144     for (int i=0;i<fArrayDim;i++) {
145       char cdim[32];
146       snpf(cdim,sizeof(cdim),"[%d]",fMaxIndex[i]);
147       a_s += cdim;
148     }
149   }
150 protected: //Named
151   std::string fName;
152   std::string fTitle;
153 protected:
154   int fType;            //element type
155   int fSize;            //sizeof element
156   int fArrayLength;     //cumulative size of all array dims
157   int fArrayDim;        //number of array dimensions
158   int fMaxIndex[5];     //Maximum array index for array dimension "dim"
159   int fOffset;          //!element offset in class
160   //FIXME Int_t         fNewType;         //!new element type when reading
161   std::string fTypeName;        //Data type name of data member
162 };
163 
164 class streamer_base : public streamer_element {
165 public: //ibo
166   virtual const std::string& store_cls() const {
167     static const std::string s_v("TStreamerBase");
168     return s_v;
169   }
170   virtual bool stream(buffer& aBuffer) const {
171     unsigned int c;
172     if(!aBuffer.write_version(3,c)) return false;
173     if(!streamer_element::stream(aBuffer)) return false;
174     if(!aBuffer.write(fBaseVersion)) return false;
175     if(!aBuffer.set_byte_count(c)) return false;
176     return true;
177   }
178 public: //streamer_element
179   virtual streamer_element* copy() const {return new streamer_base(*this);}
180 public:
181   streamer_base(const std::string& aName,const std::string& aTitle,int aOffset,int aBaseVersion)
182   :streamer_element(aName,aTitle,aOffset,streamer__info::BASE,"BASE")
183   ,fBaseVersion(aBaseVersion)
184   {
185     if (aName=="TObject") fType = streamer__info::TOBJECT;
186     if (aName=="TNamed") fType = streamer__info::TNAMED;
187   }
188   virtual ~streamer_base(){}
189 public:
190   streamer_base(const streamer_base& a_from)
191   :ibo(a_from)
192   ,streamer_element(a_from)
193   ,fBaseVersion(a_from.fBaseVersion)
194   {}
195   streamer_base& operator=(const streamer_base& a_from){
196     streamer_element::operator=(a_from);
197     fBaseVersion = a_from.fBaseVersion;
198     return *this;
199   }
200 protected:
201   int fBaseVersion;         //version number of the base class
202 };
203 
204 class streamer_basic_type : public streamer_element {
205 public: //ibo
206   virtual const std::string& store_cls() const {
207     static const std::string s_v("TStreamerBasicType");
208     return s_v;
209   }
210   virtual bool stream(buffer& aBuffer) const {
211     unsigned int c;
212     if(!aBuffer.write_version(2,c)) return false;
213     if(!streamer_element::stream(aBuffer)) return false;
214     if(!aBuffer.set_byte_count(c)) return false;
215     return true;
216   }
217 public: //streamer_element
218   virtual streamer_element* copy() const {return new streamer_basic_type(*this);}
219 public:
220   streamer_basic_type(const std::string& aName,const std::string& aTitle,
221                       int aOffset,int aType,const std::string& aTypeName)
222   :streamer_element(aName,aTitle,aOffset,aType,aTypeName)
223   {}
224   virtual ~streamer_basic_type(){}
225 public:
226   streamer_basic_type(const streamer_basic_type& a_from)
227   :ibo(a_from),streamer_element(a_from)
228   {}
229   streamer_basic_type& operator=(const streamer_basic_type& a_from){
230     streamer_element::operator=(a_from);
231     return *this;
232   }
233 };
234 
235 class streamer_short : public streamer_basic_type {
236 public: //streamer_element
237   virtual streamer_element* copy() const {return new streamer_short(*this);}
238 public:
239   streamer_short(const std::string& aName,const std::string& aTitle,int aOffset)
240   :streamer_basic_type(aName,aTitle,aOffset,streamer__info::SHORT,"Short_t")
241   {}
242   streamer_short(int& aOffset,const std::string& aName,const std::string& aTitle)
243   :streamer_basic_type(aName,aTitle,aOffset,streamer__info::SHORT,"Short_t")
244   {
245     aOffset += streamer__info::size_SHORT;
246   }
247   virtual ~streamer_short(){}
248 public:
249   streamer_short(const streamer_short& a_from):ibo(a_from),streamer_basic_type(a_from){}
250   streamer_short& operator=(const streamer_short& a_from){streamer_basic_type::operator=(a_from);return *this;}
251 };
252 
253 class streamer_int : public streamer_basic_type {
254 public: //streamer_element
255   virtual streamer_element* copy() const {return new streamer_int(*this);}
256 public:
257   streamer_int(const std::string& aName,const std::string& aTitle,int aOffset)
258   :streamer_basic_type(aName,aTitle,aOffset,streamer__info::INT,"Int_t")
259   {}
260   streamer_int(int& aOffset,const std::string& aName,const std::string& aTitle)
261   :streamer_basic_type(aName,aTitle,aOffset,streamer__info::INT,"Int_t")
262   {
263     aOffset += streamer__info::size_INT;
264   }
265   virtual ~streamer_int(){}
266 public:
267   streamer_int(const streamer_int& a_from):ibo(a_from),streamer_basic_type(a_from){}
268   streamer_int& operator=(const streamer_int& a_from){streamer_basic_type::operator=(a_from);return *this;}
269 };
270 
271 class streamer_uint : public streamer_basic_type {
272 public: //streamer_element
273   virtual streamer_element* copy() const {return new streamer_uint(*this);}
274 public:
275   streamer_uint(const std::string& aName,const std::string& aTitle,int aOffset)
276   :streamer_basic_type(aName,aTitle,aOffset,streamer__info::UNSIGNED_INT,"UInt_t")
277   {}
278   streamer_uint(int& aOffset,const std::string& aName,const std::string& aTitle)
279   :streamer_basic_type(aName,aTitle,aOffset,streamer__info::UNSIGNED_INT,"UInt_t")
280   {
281     aOffset += streamer__info::size_UINT;
282   }
283   virtual ~streamer_uint(){}
284 public:
285   streamer_uint(const streamer_uint& a_from):ibo(a_from),streamer_basic_type(a_from){}
286   streamer_uint& operator=(const streamer_uint& a_from){streamer_basic_type::operator=(a_from);return *this;}
287 };
288 
289 class streamer_float : public streamer_basic_type {
290 public: //streamer_element
291   virtual streamer_element* copy() const {return new streamer_float(*this);}
292 public:
293   streamer_float(const std::string& aName,const std::string& aTitle,int aOffset)
294   :streamer_basic_type(aName,aTitle,aOffset,streamer__info::FLOAT,"Float_t")
295   {}
296   streamer_float(int& aOffset,const std::string& aName,const std::string& aTitle)
297   :streamer_basic_type(aName,aTitle,aOffset,streamer__info::FLOAT,"Float_t")
298   {
299     aOffset += streamer__info::size_FLOAT;
300   }
301   virtual ~streamer_float(){}
302 public:
303   streamer_float(const streamer_float& a_from):ibo(a_from),streamer_basic_type(a_from){}
304   streamer_float& operator=(const streamer_float& a_from){streamer_basic_type::operator=(a_from);return *this;}
305 };
306 
307 class streamer_double : public streamer_basic_type {
308 public: //streamer_element
309   virtual streamer_element* copy() const {return new streamer_double(*this);}
310 public:
311   streamer_double(const std::string& aName,const std::string& aTitle,int aOffset)
312   :streamer_basic_type(aName,aTitle,aOffset,streamer__info::DOUBLE,"Double_t")
313   {}
314   streamer_double(int& aOffset,const std::string& aName,const std::string& aTitle)
315   :streamer_basic_type(aName,aTitle,aOffset,streamer__info::DOUBLE,"Double_t")
316   {
317     aOffset += streamer__info::size_DOUBLE;
318   }
319   virtual ~streamer_double(){}
320 public:
321   streamer_double(const streamer_double& a_from):ibo(a_from),streamer_basic_type(a_from){}
322   streamer_double& operator=(const streamer_double& a_from){streamer_basic_type::operator=(a_from);return *this;}
323 };
324 
325 class streamer_stat_t : public streamer_basic_type {
326 public: //streamer_element
327   virtual streamer_element* copy() const {return new streamer_stat_t(*this);}
328 public:
329   streamer_stat_t(const std::string& aName,const std::string& aTitle,int aOffset)
330   :streamer_basic_type(aName,aTitle,aOffset,streamer__info::DOUBLE,"Stat_t")
331   {}
332   streamer_stat_t(int& aOffset,const std::string& aName,const std::string& aTitle)
333   :streamer_basic_type(aName,aTitle,aOffset,streamer__info::DOUBLE,"Stat_t")
334   {
335     aOffset += streamer__info::size_DOUBLE;
336   }
337   virtual ~streamer_stat_t(){}
338 public:
339   streamer_stat_t(const streamer_stat_t& a_from):ibo(a_from),streamer_basic_type(a_from){}
340   streamer_stat_t& operator=(const streamer_stat_t& a_from){streamer_basic_type::operator=(a_from);return *this;}
341 };
342 
343 class streamer_bool : public streamer_basic_type {
344 public: //streamer_element
345   virtual streamer_element* copy() const {return new streamer_bool(*this);}
346 public:
347   streamer_bool(const std::string& aName,const std::string& aTitle,int aOffset)
348   :streamer_basic_type(aName,aTitle,aOffset,streamer__info::UNSIGNED_CHAR,"Bool_t")
349   {}
350   streamer_bool(int& aOffset,const std::string& aName,const std::string& aTitle)
351   :streamer_basic_type(aName,aTitle,aOffset,streamer__info::UNSIGNED_CHAR,"Bool_t")
352   {
353     aOffset += streamer__info::size_BOOL;
354   }
355   virtual ~streamer_bool(){}
356 public:
357   streamer_bool(const streamer_bool& a_from):ibo(a_from),streamer_basic_type(a_from){}
358   streamer_bool& operator=(const streamer_bool& a_from){streamer_basic_type::operator=(a_from);return *this;}
359 };
360 
361 class streamer_basic_pointer : public streamer_element {
362 public: //ibo
363   virtual const std::string& store_cls() const {
364     static const std::string s_v("TStreamerBasicPointer");
365     return s_v;
366   }
367   virtual bool stream(buffer& aBuffer) const {
368     unsigned int c;
369     if(!aBuffer.write_version(2,c)) return false;
370     if(!streamer_element::stream(aBuffer)) return false;
371     if(!aBuffer.write(fCountVersion)) return false;
372     if(!aBuffer.write(fCountName)) return false;
373     if(!aBuffer.write(fCountClass)) return false;
374     if(!aBuffer.set_byte_count(c)) return false;
375     return true;
376   }
377 public: //streamer_element
378   virtual streamer_element* copy() const {return new streamer_basic_pointer(*this);}
379 public:
380   streamer_basic_pointer(const std::string& aName,const std::string& aTitle,
381                          int aOffset,int aType,
382                          const std::string& aCountName,
383                          const std::string& aCountClass,
384                          int aCountVersion,
385                          const std::string& aTypeName)
386   :streamer_element(aName,aTitle,aOffset,aType+streamer__info::POINTER,aTypeName)
387   ,fCountVersion(aCountVersion)
388   ,fCountName(aCountName)
389   ,fCountClass(aCountClass)
390   {}
391   virtual ~streamer_basic_pointer(){}
392 public:
393   streamer_basic_pointer(const streamer_basic_pointer& a_from)
394   :ibo(a_from),streamer_element(a_from)
395   ,fCountVersion(a_from.fCountVersion)
396   ,fCountName(a_from.fCountName)
397   ,fCountClass(a_from.fCountClass)
398   {}
399   streamer_basic_pointer& operator=(const streamer_basic_pointer& a_from){
400     streamer_element::operator=(a_from);
401     fCountVersion = a_from.fCountVersion;
402     fCountName    = a_from.fCountName;
403     fCountClass   = a_from.fCountClass;
404     return *this;
405   }
406 protected:
407   int fCountVersion;       //version number of the class with the counter
408   std::string fCountName;  //name of data member holding the array count
409   std::string fCountClass; //name of the class with the counter
410 };
411 
412 class streamer_string : public streamer_element {
413 public: //ibo
414   virtual const std::string& store_cls() const {
415     static const std::string s_v("TStreamerString");
416     return s_v;
417   }
418   virtual bool stream(buffer& aBuffer) const {
419     unsigned int c;
420     if(!aBuffer.write_version(2,c)) return false;
421     if(!streamer_element::stream(aBuffer)) return false;
422     if(!aBuffer.set_byte_count(c)) return false;
423     return true;
424   }
425 public: //streamer_element
426   virtual streamer_element* copy() const {return new streamer_string(*this);}
427 public:
428   streamer_string(const std::string& aName,const std::string& aTitle,int aOffset)
429   :streamer_element(aName,aTitle,aOffset,streamer__info::_TSTRING,"TString")
430   {}
431   streamer_string(int& aOffset,const std::string& aName,const std::string& aTitle)
432   :streamer_element(aName,aTitle,aOffset,streamer__info::_TSTRING,"TString")
433   {
434     aOffset += streamer__info::size_TString;
435   }
436   virtual ~streamer_string(){}
437 public:
438   streamer_string(const streamer_string& a_from):ibo(a_from),streamer_element(a_from){}
439   streamer_string& operator=(const streamer_string& a_from){streamer_element::operator=(a_from);return *this;}
440 };
441 
442 
443 class streamer_object : public streamer_element {
444 public: //ibo
445   virtual const std::string& store_cls() const {
446     static const std::string s_v("TStreamerObject");
447     return s_v;
448   }
449   virtual bool stream(buffer& aBuffer) const {
450     unsigned int c;
451     if(!aBuffer.write_version(2,c)) return false;
452     if(!streamer_element::stream(aBuffer)) return false;
453     if(!aBuffer.set_byte_count(c)) return false;
454     return true;
455   }
456 public: //streamer_element
457   virtual streamer_element* copy() const {return new streamer_object(*this);}
458 public:
459   streamer_object(const std::string& aName,const std::string& aTitle,int aOffset,const std::string& aTypeName)
460   :streamer_element(aName,aTitle,aOffset,0,aTypeName){
461     fType = streamer__info::OBJECT;
462     if (aName=="TObject") fType = streamer__info::TOBJECT;
463     if (aName=="TNamed") fType = streamer__info::TNAMED;
464   }
465   virtual ~streamer_object(){}
466 public:
467   streamer_object(const streamer_object& a_from):ibo(a_from),streamer_element(a_from){}
468   streamer_object& operator=(const streamer_object& a_from){
469     streamer_element::operator=(a_from);
470     return *this;
471   }
472 };
473 
474 class streamer_object_pointer : public streamer_element {
475 public: //ibo
476   virtual const std::string& store_cls() const {
477     static const std::string s_v("TStreamerObjectPointer");
478     return s_v;
479   }
480   virtual bool stream(buffer& aBuffer) const {
481     unsigned int c;
482     if(!aBuffer.write_version(2,c)) return false;
483     if(!streamer_element::stream(aBuffer)) return false;
484     if(!aBuffer.set_byte_count(c)) return false;
485     return true;
486   }
487 public: //streamer_element
488   virtual streamer_element* copy() const {return new streamer_object_pointer(*this);}
489 public:
490   streamer_object_pointer(const std::string& aName,const std::string& aTitle,
491                           int aOffset,const std::string& aTypeName)
492   :streamer_element(aName,aTitle,aOffset,streamer__info::OBJECT_POINTER,aTypeName){
493     if(aTitle.substr(0,2)=="->") fType = streamer__info::OBJECT_ARROW;
494   }
495   virtual ~streamer_object_pointer(){}
496 public:
497   streamer_object_pointer(const streamer_object_pointer& a_from):ibo(a_from),streamer_element(a_from){}
498   streamer_object_pointer& operator=(const streamer_object_pointer& a_from){
499     streamer_element::operator=(a_from);
500     return *this;
501   }
502 };
503 
504 class streamer_object_any : public streamer_element {
505 public: //ibo
506   virtual const std::string& store_cls() const {
507     static const std::string s_v("TStreamerObjectAny");
508     return s_v;
509   }
510   virtual bool stream(buffer& aBuffer) const {
511     unsigned int c;
512     if(!aBuffer.write_version(2,c)) return false;
513     if(!streamer_element::stream(aBuffer)) return false;
514     if(!aBuffer.set_byte_count(c)) return false;
515     return true;
516   }
517 public: //streamer_element
518   virtual streamer_element* copy() const {return new streamer_object_any(*this);}
519 public:
520   streamer_object_any(const std::string& aName,const std::string& aTitle,
521                       int aOffset,const std::string& aTypeName)
522   :streamer_element(aName,aTitle,aOffset,streamer__info::OBJECT_ANY,aTypeName)
523   {}
524   virtual ~streamer_object_any(){}
525 public:
526   streamer_object_any(const streamer_object_any& a_from):ibo(a_from),streamer_element(a_from){}
527   streamer_object_any& operator=(const streamer_object_any& a_from){
528     streamer_element::operator=(a_from);
529     return *this;
530   }
531 };
532 
533 
534 class streamer_STL : public streamer_element {
535 public: //ibo
536   virtual const std::string& store_cls() const {
537     static const std::string s_v("TStreamerSTL");
538     return s_v;
539   }
540   virtual bool stream(buffer& aBuffer) const {
541     unsigned int c;
542     if(!aBuffer.write_version(2,c)) return false;
543     if(!streamer_element::stream(aBuffer)) return false;
544     if(!aBuffer.write(fSTLtype)) return false;
545     if(!aBuffer.write(fCtype)) return false;
546     if(!aBuffer.set_byte_count(c)) return false;
547     return true;
548   }
549 public: //streamer_element
550   virtual streamer_element* copy() const {return new streamer_STL(*this);}
551 protected:
552   enum ESTLtype { kSTL       = 300, kSTLstring  =365,   kSTLvector = 1,
553                   kSTLlist   =  2,  kSTLdeque   =  3,   kSTLmap    = 4,
554                   kSTLset    =  5,  kSTLmultimap=6,     kSTLmultiset=7};
555 
556   // Instead of EDataType, we use the streamer__info::Type.
557   //enum EDataType {
558   //   kChar_t  = 1, kUChar_t  = 11, kShort_t = 2,  kUShort_t = 12,
559   //   kInt_t   = 3, kUInt_t   = 13, kLong_t  = 4,  kULong_t  = 14,
560   //   kFloat_t = 5, kDouble_t = 8,  kchar  = 10, kOther_t  = -1
561   //};
562 public:
563   streamer_STL(const std::string& aName,const std::string& aTitle,
564                int aOffset,
565                streamer__info::Type aType, //Must match TDataType/EDataType
566                const std::string& aTypeName)
567   :streamer_element(aName,aTitle,aOffset,kSTL,aTypeName){
568     fSTLtype = kSTLvector;
569     fCtype   = aType;
570   }
571   virtual ~streamer_STL(){}
572 public:
573   streamer_STL(const streamer_STL& a_from)
574   :ibo(a_from),streamer_element(a_from)
575   ,fSTLtype(a_from.fSTLtype)
576   ,fCtype(a_from.fCtype)
577   {}
578   streamer_STL& operator=(const streamer_STL& a_from){
579     streamer_element::operator=(a_from);
580     fSTLtype = a_from.fSTLtype;
581     fCtype = a_from.fCtype;
582     return *this;
583   }
584 protected:
585   int fSTLtype;       //type of STL vector
586   int fCtype;         //STL contained type
587 };
588 
589 }}
590 
591 #endif