Go to the documentation of this file.
4 #ifndef tools_rroot_obj_array
5 #define tools_rroot_obj_array
18 typedef typename std::vector<T*> parent;
20 static const std::string& s_store_class() {
21 static const std::string s_v(
"TObjArray");
26 static const std::string s_v(
"tools::rroot::obj_array<"+T::s_class()+
">");
30 virtual void*
cast(
const std::string& a_class)
const {
38 if(
void* p = cmp_cast<obj_array>(
this,a_class)) {
return p;}
44 bool accept_null =
false;
52 mem::increment(
s_class().c_str());
58 mem::decrement(
s_class().c_str());
68 mem::increment(
s_class().c_str());
70 typedef typename parent::const_iterator it_t;
71 for(it_t it=a_from.begin();it!=a_from.end();++it) {
77 T* obj = safe_cast<iro,T>(*_obj);
79 m_fac.
out() <<
"tools::rroot::obj_array::obj_array :"
80 <<
" inlib::cast failed."
86 parent::push_back(obj);
93 if(&a_from==
this)
return *
this;
97 typedef typename parent::const_iterator it_t;
98 for(it_t it=a_from.begin();it!=a_from.end();++it) {
100 parent::push_back(0);
104 T* obj = safe_cast<iro,T>(*_obj);
106 m_fac.
out() <<
"tools::rroot::obj_array::operator= :"
107 <<
" inlib::cast failed."
110 parent::push_back(0);
113 parent::push_back(obj);
138 if(!a_buffer.
read(name))
return false;
140 if(!a_buffer.
read(nobjects))
return false;
142 if(!a_buffer.
read(lowerBound))
return false;
146 for (
int i=0;i<nobjects;i++) {
152 a_buffer.
out() <<
"tools::rroot::obj_array::stream : can't read object"
153 <<
" in obj_array : name " <<
sout(name)
154 <<
", nobjects " << nobjects <<
", iobject " << i << std::endl;
160 T*
to = safe_cast<iro,T>(*obj);
162 a_buffer.
out() <<
"tools::rroot::obj_array::stream :"
163 <<
" inlib::cast failed."
164 <<
" " << obj->
s_cls() <<
" is not a " << T::s_class() <<
"."
172 parent::push_back(
to);
175 parent::push_back(
to);
182 parent::push_back(0);
192 typedef typename parent::iterator it_t;
193 typedef std::vector<bool>::iterator itb_t;
194 while(!parent::empty()) {
196 itb_t itb =
m_owns.begin();
201 if(own)
delete entry;