mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 21:42:19 +00:00
Initialization in various other constructor forms
This commit is contained in:
+21
-14
@@ -1352,9 +1352,7 @@ IfcFile::IfcFile(const std::string& path, filetype ty)
|
|||||||
}
|
}
|
||||||
if (ty == FT_IFCSPF) {
|
if (ty == FT_IFCSPF) {
|
||||||
IfcSpfStream s(path);
|
IfcSpfStream s(path);
|
||||||
storage_.emplace<1>(); // impl::in_memory_file_storage{};
|
storage_.emplace<1>(this);
|
||||||
// @todo assign in constructor
|
|
||||||
std::get<impl::in_memory_file_storage>(storage_).file = this;
|
|
||||||
std::get<impl::in_memory_file_storage>(storage_).read_from_stream(&s, schema_, max_id_);
|
std::get<impl::in_memory_file_storage>(storage_).read_from_stream(&s, schema_, max_id_);
|
||||||
|
|
||||||
if (std::get<impl::in_memory_file_storage>(storage_).good_) {
|
if (std::get<impl::in_memory_file_storage>(storage_).good_) {
|
||||||
@@ -1376,9 +1374,7 @@ IfcFile::IfcFile(const std::string& path, filetype ty)
|
|||||||
} else {
|
} else {
|
||||||
throw std::runtime_error("Unsupported file format");
|
throw std::runtime_error("Unsupported file format");
|
||||||
}
|
}
|
||||||
if (schema_) {
|
ifcroot_type_ = schema_ ? schema_->declaration_by_name("IfcRoot") : nullptr;
|
||||||
ifcroot_type_ = schema_->declaration_by_name("IfcRoot");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1386,26 +1382,38 @@ IfcFile::IfcFile(std::istream& stream, int length)
|
|||||||
: schema_(nullptr)
|
: schema_(nullptr)
|
||||||
{
|
{
|
||||||
IfcSpfStream s(stream, length);
|
IfcSpfStream s(stream, length);
|
||||||
storage_.emplace<1>();
|
storage_.emplace<1>(this);
|
||||||
std::get<impl::in_memory_file_storage>(storage_).read_from_stream(&s, schema_, max_id_);
|
std::get<impl::in_memory_file_storage>(storage_).read_from_stream(&s, schema_, max_id_);
|
||||||
ifcroot_type_ = schema_->declaration_by_name("IfcRoot");
|
ifcroot_type_ = schema_ ? schema_->declaration_by_name("IfcRoot") : nullptr;
|
||||||
|
|
||||||
|
byid_ = decltype(byid_)(&std::get<impl::rocks_db_file_storage>(storage_).instance_by_name_);
|
||||||
|
byref_excl_ = decltype(byref_excl_)(&std::get<impl::rocks_db_file_storage>(storage_).byref_excl_);
|
||||||
|
byguid_ = decltype(byguid_)(&std::get<impl::rocks_db_file_storage>(storage_).byguid_);
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcFile::IfcFile(void* data, int length)
|
IfcFile::IfcFile(void* data, int length)
|
||||||
: schema_(nullptr)
|
: schema_(nullptr)
|
||||||
{
|
{
|
||||||
IfcSpfStream s(data, length);
|
IfcSpfStream s(data, length);
|
||||||
storage_.emplace<1>();
|
storage_.emplace<1>(this);
|
||||||
std::get<impl::in_memory_file_storage>(storage_).read_from_stream(&s, schema_, max_id_);
|
std::get<impl::in_memory_file_storage>(storage_).read_from_stream(&s, schema_, max_id_);
|
||||||
ifcroot_type_ = schema_->declaration_by_name("IfcRoot");
|
ifcroot_type_ = schema_ ? schema_->declaration_by_name("IfcRoot") : nullptr;
|
||||||
|
|
||||||
|
byid_ = decltype(byid_)(&std::get<impl::rocks_db_file_storage>(storage_).instance_by_name_);
|
||||||
|
byref_excl_ = decltype(byref_excl_)(&std::get<impl::rocks_db_file_storage>(storage_).byref_excl_);
|
||||||
|
byguid_ = decltype(byguid_)(&std::get<impl::rocks_db_file_storage>(storage_).byguid_);
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcFile::IfcFile(IfcParse::IfcSpfStream* s)
|
IfcFile::IfcFile(IfcParse::IfcSpfStream* s)
|
||||||
: schema_(nullptr)
|
: schema_(nullptr)
|
||||||
{
|
{
|
||||||
storage_.emplace<1>();
|
storage_.emplace<1>(this);
|
||||||
std::get<impl::in_memory_file_storage>(storage_).read_from_stream(s, schema_, max_id_);
|
std::get<impl::in_memory_file_storage>(storage_).read_from_stream(s, schema_, max_id_);
|
||||||
ifcroot_type_ = schema_->declaration_by_name("IfcRoot");
|
ifcroot_type_ = schema_ ? schema_->declaration_by_name("IfcRoot") : nullptr;
|
||||||
|
|
||||||
|
byid_ = decltype(byid_)(&std::get<impl::rocks_db_file_storage>(storage_).instance_by_name_);
|
||||||
|
byref_excl_ = decltype(byref_excl_)(&std::get<impl::rocks_db_file_storage>(storage_).byref_excl_);
|
||||||
|
byguid_ = decltype(byguid_)(&std::get<impl::rocks_db_file_storage>(storage_).byguid_);
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcFile::IfcFile(const IfcParse::schema_definition* schema, filetype ty, const std::string& path)
|
IfcFile::IfcFile(const IfcParse::schema_definition* schema, filetype ty, const std::string& path)
|
||||||
@@ -1418,8 +1426,7 @@ IfcFile::IfcFile(const IfcParse::schema_definition* schema, filetype ty, const s
|
|||||||
ty = guess_file_type(path);
|
ty = guess_file_type(path);
|
||||||
}
|
}
|
||||||
if (ty == FT_IFCSPF) {
|
if (ty == FT_IFCSPF) {
|
||||||
storage_.emplace<1>();
|
storage_.emplace<1>(this);
|
||||||
std::get<impl::in_memory_file_storage>(storage_).file = this;
|
|
||||||
|
|
||||||
byid_ = decltype(byid_)(&std::get<impl::in_memory_file_storage>(storage_).byid_);
|
byid_ = decltype(byid_)(&std::get<impl::in_memory_file_storage>(storage_).byid_);
|
||||||
byref_excl_ = decltype(byref_excl_)(&std::get<impl::in_memory_file_storage>(storage_).byref_excl_);
|
byref_excl_ = decltype(byref_excl_)(&std::get<impl::in_memory_file_storage>(storage_).byref_excl_);
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ namespace IfcParse {
|
|||||||
typedef std::map<inverse_attr_record, std::vector<uint32_t>> entities_by_ref_t;
|
typedef std::map<inverse_attr_record, std::vector<uint32_t>> entities_by_ref_t;
|
||||||
typedef entity_instance_by_name_t::iterator iterator;
|
typedef entity_instance_by_name_t::iterator iterator;
|
||||||
|
|
||||||
in_memory_file_storage() : tokens(nullptr), file(nullptr), schema(nullptr) {}
|
in_memory_file_storage(IfcParse::IfcFile* f = nullptr) : tokens(nullptr), file(f), schema(nullptr) {}
|
||||||
in_memory_file_storage(const in_memory_file_storage&) = delete;
|
in_memory_file_storage(const in_memory_file_storage&) = delete;
|
||||||
in_memory_file_storage(const in_memory_file_storage&&) = delete;
|
in_memory_file_storage(const in_memory_file_storage&&) = delete;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user