Go to the documentation of this file.
4 #ifndef tools_wroot_buffer
5 #define tools_wroot_buffer
29 static const std::string& s_class() {
30 static const std::string s_v(
"tools::wroot::buffer");
44 mem::increment(s_class().c_str());
63 mem::decrement(s_class().c_str());
77 mem::increment(s_class().c_str());
104 bool write(
bool x) {
return write<unsigned char>(x?1:0);}
115 if(!a_n)
return true;
116 uint32 l = a_n *
sizeof(char);
120 ::memcpy(
m_pos,a_a,l);
129 if(!a_n)
return true;
130 uint32 l = a_n *
sizeof(T);
139 if(a_v.empty())
return true;
149 if(!
write(a_n))
return false;
162 for(
unsigned int index=0;index<a_v.size();index++) {
171 m_out <<
"tools::wroot::buffer::write_version :"
172 <<
" version number " << a_version
173 <<
" cannot be larger than " <<
kMaxVersion() <<
"."
177 return write(a_version);
187 m_pos +=
sizeof(
unsigned int);
190 m_out <<
"tools::wroot::buffer::write_version :"
191 <<
" version number " << a_version
192 <<
" cannot be larger than " <<
kMaxVersion() <<
"."
196 return write(a_version);
202 m_out <<
"tools::wroot::buffer::set_byte_count :"
203 <<
" bytecount too large (more than "
219 {
m_pos = opos;
return false;}
223 {
m_pos = opos;
return false;}
235 std::map<ibo*,uint32>::const_iterator it =
m_objs.find((
ibo*)&a_obj);
238 uint32 objIdx = (*it).second;
243 if(!
write(objIdx))
return false;
245 m_obj_mapped.push_back(std::pair<uint32,uint32>(offset,objIdx));
256 m_pos +=
sizeof(
unsigned int);
266 if(!a_obj.
stream(*
this))
return false;
279 m_out <<
"tools::wroot::buffer::expand :"
280 <<
" can't realloc " << a_new_size <<
" bytes."
304 typedef std::pair<uint32,uint32> offset_id;
307 unsigned int offset = (*it).first;
308 unsigned int id = (*it).second;
311 unsigned int clIdx =
id+a_num;
320 uint32 offset = (*it).first;
327 unsigned int objIdx =
id+a_num;
328 if(!
write(objIdx)) {
m_pos = opos;
return false;}
351 std::map<std::string,uint32>::const_iterator it =
m_clss.find(a_cls);
353 uint32 clIdx = (*it).second;
360 m_cls_mapped.push_back(std::pair<uint32,uint32>(offset,clIdx));
376 m_out <<
"tools::wroot::buffer::set_byte_count_obj :"
377 <<
" bytecount too large (more than "
#define tools_vforcit(a__T, a__v, a__it)