22 #ifndef _ScopePool_hxx_
23 #define _ScopePool_hxx_
52 const char*
GetClassName()
const {
return "AttributeProxy"; }
57 XMLAdapter<std::string> nameAdapter(name,
"name",
false);
58 storage.Load(nameAdapter);
59 unsigned attributeIndex = pool._spec.GetIndexSafe(name);
60 pool._attributePools[attributeIndex].Allocate(pool._size);
61 XMLComponentAdapter adapter(pool._attributePools[attributeIndex]);
62 storage.Load(adapter);
75 AttributesData::iterator it = _attributePools.begin();
76 AttributesData::iterator end = _attributePools.end();
77 for (
unsigned i=0; it!=end; i++, it++)
87 storage.
Store(nameAdapter);
89 storage.
Store(sizeAdapter);
90 for (
unsigned attribute=0; attribute<_attributePools.size(); attribute++)
92 if (!_attributePools[attribute].GetData())
continue;
94 storage.
Store(adapter);
101 storage.
Load(nameAdapter);
103 (
"The schema expected a scope named '"+_spec.
GetName()+
104 "', but the XML contains the scope '"+ name+
"' instead").c_str());
107 storage.
Load(sizeAdapter);
109 for (
unsigned attribute=0; attribute<_attributePools.size(); attribute++)
110 _attributePools[attribute].Deallocate();
113 while (storage.
Load(adapter)) {}
117 AttributesData::iterator it = _attributePools.begin();
118 AttributesData::iterator end = _attributePools.end();
119 for (
unsigned i=0; it!=end; i++, it++)
127 AttributesData::iterator it = _attributePools.begin();
128 AttributesData::iterator end = _attributePools.end();
129 for (
unsigned i=0; it!=end; i++, it++)
136 void Reallocate(
unsigned newSize)
139 AttributesData::iterator it = _attributePools.begin();
140 AttributesData::iterator end = _attributePools.end();
141 for (
unsigned i=0; it!=end; i++, it++)
143 if (!it->GetData())
continue;
164 unsigned attribPos = _spec.
GetIndex(attributeName);
165 const void * data = _attributePools[attribPos].GetData();
168 template <
typename AttributeType>
171 unsigned attribPos = _spec.
GetIndex(name);
172 _spec.
CheckType(attribPos,(AttributeType*)0);
173 const void * data = _attributePools[attribPos].GetData();
175 (std::string()+
"Getting data from a non instanciated attribute '"+_spec.
GetName()+
"':'"+name+
"'").c_str());
176 return &(*(
const std::vector<AttributeType>*) data )[0];
179 template <
typename AttributeType>
182 unsigned attribPos = _spec.
GetIndex(name);
183 _spec.
CheckType(attribPos,(AttributeType*)0);
184 void * data = _attributePools[attribPos].GetData();
187 _attributePools[attribPos].Allocate(_size);
188 data = _attributePools[attribPos].GetData();
191 return &(*(std::vector<AttributeType>*) data )[0];
198 #endif// _ScopePool_hxx_