Use naked pointer for attribute list and derive size from schema type to reduce mem usage

This commit is contained in:
Thomas Krijnen
2018-01-29 12:11:50 +01:00
parent a3b7a25866
commit af93f2a64d
6 changed files with 167 additions and 126 deletions
+6 -11
View File
@@ -30,11 +30,12 @@ namespace IfcParse {
class IFC_PARSE_API HeaderEntity : public IfcEntityInstanceData {
private:
const char * const _datatype;
size_t size_;
HeaderEntity(const HeaderEntity&); //N/A
HeaderEntity& operator =(const HeaderEntity&); //N/A
protected:
HeaderEntity(const char * const datatype, IfcParse::IfcFile* file);
HeaderEntity(const char * const datatype, size_t size, IfcParse::IfcFile* file);
void setValue(unsigned int i, const std::string& s) {
IfcWrite::IfcWriteArgument* argument = new IfcWrite::IfcWriteArgument;
@@ -49,19 +50,13 @@ protected:
}
public:
virtual unsigned int getArgumentCount() const {
return size_;
}
std::string toString(bool upper=false) const {
std::stringstream ss;
// Unfortunately this is duplicated from IfcEntityInstanceData::toString()
ss << _datatype << "(";
std::vector<Argument*>::const_iterator it = attributes_.begin();
for (; it != attributes_.end(); ++it) {
if (it != attributes_.begin()) {
ss << ",";
}
ss << (*it)->toString(upper);
}
ss << ")";
ss << _datatype << IfcEntityInstanceData::toString(upper);
return ss.str();
}
};