mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 22:43:41 +00:00
option to disable guid map and lazy loading
This commit is contained in:
@@ -112,6 +112,14 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool lazy_load_;
|
||||||
|
static bool lazy_load() { return lazy_load_; }
|
||||||
|
static void lazy_load(bool b) { lazy_load_ = b; }
|
||||||
|
|
||||||
|
static bool guid_map_;
|
||||||
|
static bool guid_map() { return guid_map_; }
|
||||||
|
static void guid_map(bool b) { guid_map_ = b; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::map<uint32_t, IfcUtil::IfcBaseClass*> entity_entity_map_t;
|
typedef std::map<uint32_t, IfcUtil::IfcBaseClass*> entity_entity_map_t;
|
||||||
|
|
||||||
|
|||||||
@@ -1077,7 +1077,16 @@ void IfcEntityInstanceData::load() const {
|
|||||||
if (type_ != 0) {
|
if (type_ != 0) {
|
||||||
tmp_data = new Argument*[getArgumentCount()]{};
|
tmp_data = new Argument*[getArgumentCount()]{};
|
||||||
}
|
}
|
||||||
file->seek_to(*this);
|
|
||||||
|
if (file->parsing_complete()) {
|
||||||
|
// only when parsing is fully complete we need to seek to the instance, otherwise
|
||||||
|
// we know the token cursor is currently at the keyword token
|
||||||
|
file->seek_to(*this);
|
||||||
|
} else {
|
||||||
|
// Apparently the load() function assumes one token later after the opening parenthesis
|
||||||
|
file->tokens->Next();
|
||||||
|
}
|
||||||
|
|
||||||
size_t n = file->load(id(), type_ ? type_->as_entity() : nullptr, tmp_data, getArgumentCount());
|
size_t n = file->load(id(), type_ ? type_->as_entity() : nullptr, tmp_data, getArgumentCount());
|
||||||
if (n != getArgumentCount()) {
|
if (n != getArgumentCount()) {
|
||||||
Logger::Error("Wrong number of attributes on instance with id #" + boost::lexical_cast<std::string>(id_));
|
Logger::Error("Wrong number of attributes on instance with id #" + boost::lexical_cast<std::string>(id_));
|
||||||
@@ -1487,6 +1496,10 @@ void IfcFile::initialize_(IfcParse::IfcSpfStream* s) {
|
|||||||
Logger::Status(ss.str(), false);
|
Logger::Status(ss.str(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!lazy_load_) {
|
||||||
|
data->load();
|
||||||
|
}
|
||||||
|
|
||||||
if (instance->declaration().is(*ifcroot_type_)) {
|
if (instance->declaration().is(*ifcroot_type_)) {
|
||||||
try {
|
try {
|
||||||
const std::string guid = *instance->data().getArgument(0);
|
const std::string guid = *instance->data().getArgument(0);
|
||||||
@@ -2400,4 +2413,7 @@ void IfcParse::IfcFile::build_inverses() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::atomic_uint32_t IfcUtil::IfcBaseClass::counter_(0);
|
std::atomic_uint32_t IfcUtil::IfcBaseClass::counter_(0);
|
||||||
|
|
||||||
|
bool IfcParse::IfcFile::lazy_load_ = true;
|
||||||
|
bool IfcParse::IfcFile::guid_map_ = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user