Go to the documentation of this file.
38 virtual
void*
cast(const std::
string& a_class)
const {
39 if(
void* p = cmp_cast<node>(
this,a_class))
return p;
42 virtual const std::string&
s_cls()
const = 0;
63 if(
this==a_action.
node()){
77 if(
this==a_action.
node()){
83 if(!a_action.
beg_node(*
this))
return false;
85 if(!a_action.
end_node(*
this))
return false;
98 if((*it)->touched())
return true;
109 mem::increment(s_class().c_str());
114 mem::decrement(s_class().c_str());
121 mem::increment(s_class().c_str());
129 m_fields.push_back(a_field);
137 unsigned int index = 0;
139 if(!(*it)->write(a_action.
buffer())) {
140 a_action.
out() <<
"node::write_fields :"
141 <<
" for field index " << index
142 <<
" and field class " << (*it)->s_cls()
143 <<
" of node class " <<
s_cls()
144 <<
" : field.write() failed" <<
"."
156 a_action.
out() <<
"tools::node::read_fields :"
157 <<
" for node class " <<
s_cls()
158 <<
" : read_action.get_node_desc() failed."
168 a_action.
out() <<
"tools::node::read_fields :"
169 <<
" for node class " <<
s_cls()
170 <<
" : field desc name " << fdesc.
name()
171 <<
" : field desc class " << fdesc.
cls()
172 <<
" : field desc offset " << fdesc.
offset()
173 <<
" : field not found."
177 #ifdef TOOLS_NODE_DEBUG_READ_FIELD
180 {a_action.
out() <<
"read field descs of node class " <<
s_cls() <<
" :" << std::endl;
182 a_action.
out() <<
"name " << (*itr).name()
183 <<
", class " << (*itr).cls()
184 <<
", offset " << (*itr).offset()
187 {a_action.
out() <<
"m_fields of node class " <<
s_cls() <<
" :" << std::endl;
189 a_action.
out() <<
"field class " << (*itm)->s_cls()
197 a_action.
out() <<
"tools::node::read_fields :"
198 <<
" for node class " <<
s_cls()
199 <<
" : field desc class " << fdesc.
cls()
200 <<
" : can't create generic field."
216 a_action.
out() <<
"tools::node::read_fields :"
217 <<
" for node class " <<
s_cls()
218 <<
" : and field class " << fd->
s_cls()
219 <<
" : field read() failed."
234 if(m_fields.empty())
return;
235 m_fields.front()->touch();
254 a_out <<
"field descs of node class " <<
s_cls() <<
" :" << std::endl;
257 a_out <<
"name " << (*itd).name()
258 <<
", class " << (*itd).cls()
259 <<
", offset " << (*itd).offset()
269 if((*it).name()==a_name) {
280 return ((
char*)(a_field)-(
char*)(
this));
286 if((*it).name()==a_rdesc.
name()) {
302 ((*itd).cls()==(*it)->s_cls())
309 a_out <<
"tools::sg::node::check_fields :"
310 <<
" WARNING : node of class " <<
s_cls()
311 <<
" has bad fields description."
317 std::vector<field*> m_fields;
324 #define TOOLS_NODE(a__class,a__sclass,a__parent)\
325 TOOLS_HEADER(a__class,a__sclass,a__parent)\
326 virtual tools::sg::node* copy() const {return new a__class(*this);}
328 #define TOOLS_NODE_NO_CAST(a__class,a__sclass,a__parent)\
330 typedef a__parent parent;\
332 TOOLS_SCLASS(a__sclass)\
334 virtual const std::string& s_cls() const {return s_class();}\
335 virtual tools::sg::node* copy() const {return new a__class(*this);}
337 #define TOOLS_NODE_T(a__T,a__class,a__sclass,a__parent)\
339 typedef a__parent parent;\
341 static const std::string& s_class() {\
342 static const std::string s_v(std::string(#a__class)+"<"+a__T::s_class()+">");\
345 static void check_class_name() {a__class<a__T>::s_class();}\
347 virtual const std::string& s_cls() const {return s_class();}\
348 virtual tools::sg::node* copy() const {return new a__class(*this);}\
350 virtual void* cast(const std::string& a_class) const {\
351 if(void* p = tools::cmp_cast<a__class>(this,a_class)) return p;\
352 return parent::cast(a_class);\
355 #define TOOLS_NODE_VT2(a__T1,a__T2,a__class,a__sclass,a__parent)\
357 typedef a__parent parent;\
359 static const std::string& s_class() {\
360 static const std::string s_v(std::string(#a__class)+"<"+a__T1::s_class()+","+a__T2::s_class()+">");\
363 static void check_class_name() {a__class<a__T1,a__T2>::s_class();}\
365 virtual const std::string& s_cls() const {return s_class();}\
368 virtual void* cast(const std::string& a_class) const {\
369 if(void* p = tools::cmp_cast<a__class>(this,a_class)) return p;\
370 return parent::cast(a_class);\
#define TOOLS_SCLASS(a_name)
#define tools_vforcrit(a__T, a__v, a__it)
#define tools_vforcit(a__T, a__v, a__it)