Skip to content

Commit b2c20b1

Browse files
committed
Move definitions
1 parent b9b1252 commit b2c20b1

2 files changed

Lines changed: 23 additions & 25 deletions

File tree

src/ifcparse/IfcFile.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,3 +663,26 @@ std::optional<std::tuple<size_t, const IfcParse::declaration*, IfcEntityInstance
663663

664664
return return_value;
665665
}
666+
667+
IfcUtil::IfcBaseClass* IfcParse::impl::rocks_db_file_storage::create(const IfcParse::declaration* decl) {
668+
if (decl->as_entity() || decl->as_type_declaration()) {
669+
auto* inst = file->schema()->instantiate(decl, rocks_db_attribute_storage{});
670+
inst->file_ = file;
671+
return file->addEntity(inst);
672+
} else {
673+
throw std::runtime_error("Requires and entity or type declaration");
674+
}
675+
}
676+
677+
IfcUtil::IfcBaseClass* IfcParse::impl::in_memory_file_storage::create(const IfcParse::declaration* decl) {
678+
IfcUtil::IfcBaseClass* inst = nullptr;
679+
if (auto* ent = decl->as_entity()) {
680+
inst = file->schema()->instantiate(decl, in_memory_attribute_storage(ent->attribute_count()));
681+
} else if (decl->as_type_declaration() != nullptr) {
682+
inst = file->schema()->instantiate(decl, in_memory_attribute_storage(1));
683+
} else {
684+
throw std::runtime_error("Requires and entity or type declaration");
685+
}
686+
inst->file_ = file;
687+
return file->addEntity(inst);
688+
}

src/ifcparse/IfcFile.h

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,6 @@ namespace impl {
405405

406406
} // namespace IfcParse
407407

408-
409-
410408
template <typename T>
411409
T* IfcParse::impl::in_memory_file_storage::create() {
412410
IfcUtil::IfcBaseClass* inst = nullptr;
@@ -421,19 +419,6 @@ T* IfcParse::impl::in_memory_file_storage::create() {
421419
return file->addEntity(inst)->as<T>();
422420
}
423421

424-
IfcUtil::IfcBaseClass* IfcParse::impl::in_memory_file_storage::create(const IfcParse::declaration* decl) {
425-
IfcUtil::IfcBaseClass* inst = nullptr;
426-
if (auto* ent = decl->as_entity()) {
427-
inst = file->schema()->instantiate(decl, in_memory_attribute_storage(ent->attribute_count()));
428-
} else if (decl->as_type_declaration() != nullptr) {
429-
inst = file->schema()->instantiate(decl, in_memory_attribute_storage(1));
430-
} else {
431-
throw std::runtime_error("Requires and entity or type declaration");
432-
}
433-
inst->file_ = file;
434-
return file->addEntity(inst);
435-
}
436-
437422
template <typename T>
438423
T* IfcParse::impl::rocks_db_file_storage::create() {
439424
if constexpr (std::is_same_v<std::decay_t<std::invoke_result_t<typename T::Class>>, IfcParse::entity> || std::is_same_v<std::decay_t<std::invoke_result_t<typename T::Class>>, IfcParse::type_declaration>) {
@@ -445,16 +430,6 @@ T* IfcParse::impl::rocks_db_file_storage::create() {
445430
}
446431
}
447432

448-
IfcUtil::IfcBaseClass* IfcParse::impl::rocks_db_file_storage::create(const IfcParse::declaration* decl) {
449-
if (decl->as_entity() || decl->as_type_declaration()) {
450-
auto* inst = file->schema()->instantiate(decl, rocks_db_attribute_storage{});
451-
inst->file_ = file;
452-
return file->addEntity(inst);
453-
} else {
454-
throw std::runtime_error("Requires and entity or type declaration");
455-
}
456-
}
457-
458433
namespace std {
459434
template <>
460435
struct iterator_traits<IfcParse::IfcFile::type_iterator> {

0 commit comments

Comments
 (0)