Remove _t suffixes from public types

Rename header-scope aliases, enums, and helper types while retaining descriptive names where dropping the suffix would create a collision.

Generated with the assistance of an AI coding tool.
This commit is contained in:
Thomas Krijnen
2026-08-08 14:58:15 +02:00
parent 2859c1ef17
commit 4597929df9
41 changed files with 418 additions and 418 deletions
+10 -10
View File
@@ -18,8 +18,8 @@ public:
int operator()(const double& /*i*/) const { return -1; }
int operator()(const std::string& /*i*/) const { return -1; }
int operator()(const boost::dynamic_bitset<>& /*i*/) const { return -1; }
int operator()(const empty_aggregate_t& /*unused*/) const { return 0; }
int operator()(const empty_aggregate_of_aggregate_t& /*unused*/) const { return 0; }
int operator()(const empty_aggregate& /*unused*/) const { return 0; }
int operator()(const empty_aggregate_of_aggregate& /*unused*/) const { return 0; }
int operator()(const std::vector<int64_t>& i) const { return (int)i.size(); }
int operator()(const std::vector<double>& i) const { return (int)i.size(); }
int operator()(const std::vector<std::vector<int64_t>>& i) const { return (int)i.size(); }
@@ -379,17 +379,17 @@ bool ::impl::serialize(std::string& val, const derived&)
return true;
}
bool ::impl::serialize(std::string& val, const empty_aggregate_t&)
bool ::impl::serialize(std::string& val, const empty_aggregate&)
{
val.resize(1);
val[0] = type_encoder::encode_type<empty_aggregate_t>();
val[0] = type_encoder::encode_type<empty_aggregate>();
return true;
}
bool ::impl::serialize(std::string& val, const empty_aggregate_of_aggregate_t&)
bool ::impl::serialize(std::string& val, const empty_aggregate_of_aggregate&)
{
val.resize(1);
val[0] = type_encoder::encode_type<empty_aggregate_of_aggregate_t>();
val[0] = type_encoder::encode_type<empty_aggregate_of_aggregate>();
return true;
}
@@ -544,8 +544,8 @@ template IFC_PARSE_API void rocks_db_attribute_storage::set<std::vector<std::vec
// @todo why do these need to be included, but are not in BaseEntity::set()?
template IFC_PARSE_API void rocks_db_attribute_storage::set<derived>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index, const derived& value);
template IFC_PARSE_API void rocks_db_attribute_storage::set<empty_aggregate_t>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index, const empty_aggregate_t& value);
template IFC_PARSE_API void rocks_db_attribute_storage::set<empty_aggregate_of_aggregate_t>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index, const empty_aggregate_of_aggregate_t& value);
template IFC_PARSE_API void rocks_db_attribute_storage::set<empty_aggregate>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index, const empty_aggregate& value);
template IFC_PARSE_API void rocks_db_attribute_storage::set<empty_aggregate_of_aggregate>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index, const empty_aggregate_of_aggregate& value);
template IFC_PARSE_API bool rocks_db_attribute_storage::has<blank>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const;
template IFC_PARSE_API bool rocks_db_attribute_storage::has<int64_t>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const;
@@ -567,8 +567,8 @@ template IFC_PARSE_API bool rocks_db_attribute_storage::has<std::vector<std::vec
// @todo why do these need to be included, but are not in BaseEntity::set()?
template IFC_PARSE_API bool rocks_db_attribute_storage::has<derived>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const;
template IFC_PARSE_API bool rocks_db_attribute_storage::has<empty_aggregate_t>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const;
template IFC_PARSE_API bool rocks_db_attribute_storage::has<empty_aggregate_of_aggregate_t>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const;
template IFC_PARSE_API bool rocks_db_attribute_storage::has<empty_aggregate>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const;
template IFC_PARSE_API bool rocks_db_attribute_storage::has<empty_aggregate_of_aggregate>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const;
template <typename T>
T* instance_data::get_storage_of_type() const {
+15 -15
View File
@@ -138,11 +138,11 @@ private:
return bypassed_instances_;
}
const ifcopenshell::impl::in_memory_file_storage::entities_by_ref_t& inverses() const {
const ifcopenshell::impl::in_memory_file_storage::entities_by_ref& inverses() const {
return storage_.byref_excl_;
}
ifcopenshell::impl::in_memory_file_storage::entities_by_ref_t& inverses() {
ifcopenshell::impl::in_memory_file_storage::entities_by_ref& inverses() {
return storage_.byref_excl_;
}
@@ -184,27 +184,27 @@ class uninitialized_tag {};
/// The file takes ownership of instances added to this file and deletes them when the file is deleted.
class IFC_PARSE_API file {
private:
typedef std::map<uint32_t, express::base> entity_entity_map_t;
typedef std::map<uint32_t, express::base> entity_entity_map;
// @todo determine the constness of things (probably needs to be all const, we don't want to overwrite)
// @todo we have variant_iterator and MapVariant, we probably need to retain only one?
public:
using const_iterator = variant_iterator<impl::in_memory_file_storage::iterator, impl::rocks_db_file_storage::const_iterator>;
using type_iterator = variant_iterator<impl::in_memory_file_storage::type_iterator, impl::rocks_db_file_storage::rocksdb_types_iterator>;
using storage_t = std::variant<std::monostate, impl::in_memory_file_storage, impl::rocks_db_file_storage>;
using storage_type = std::variant<std::monostate, impl::in_memory_file_storage, impl::rocks_db_file_storage>;
typedef variant_map<impl::in_memory_file_storage::entity_instance_by_guid_t, impl::rocks_db_file_storage::entity_instance_by_guid_t> entity_instance_by_guid_t;
entity_instance_by_guid_t byguid_;
typedef variant_map<impl::in_memory_file_storage::entity_instance_by_name_t, impl::rocks_db_file_storage::entity_instance_by_name_t> entity_by_id_t;
entity_by_id_t byid_;
typedef variant_map<impl::in_memory_file_storage::entities_by_ref_t, impl::rocks_db_file_storage::entities_by_ref_t> entities_by_ref_t;
entities_by_ref_t byref_excl_;
typedef variant_map<impl::in_memory_file_storage::entity_instance_by_guid, impl::rocks_db_file_storage::entity_instance_by_guid> entity_instance_by_guid;
entity_instance_by_guid byguid_;
typedef variant_map<impl::in_memory_file_storage::entity_instance_by_name, impl::rocks_db_file_storage::entity_instance_by_name> entity_by_id;
entity_by_id byid_;
typedef variant_map<impl::in_memory_file_storage::entities_by_ref, impl::rocks_db_file_storage::entities_by_ref> entities_by_ref;
entities_by_ref byref_excl_;
bool check_existance_before_adding = true;
bool calculate_unit_factors = true;
// @todo temporarily public for header
storage_t storage_;
storage_type storage_;
std::set<std::string> types_to_bypass_loading_;
@@ -215,7 +215,7 @@ public:
const ifcopenshell::schema_definition* schema_;
const ifcopenshell::declaration* ifcroot_type_;
entity_entity_map_t entity_file_map_;
entity_entity_map entity_file_map_;
unsigned int max_id_;
@@ -293,13 +293,13 @@ public:
/// Returns the first entity in the range of instances contained in the model,
/// in arbitrary order
entity_by_id_t::iterator begin() const {
entity_by_id::iterator begin() const {
return byid_.begin();
}
/// Returns the first entity in the range of instances contained in the model,
/// in arbitrary order
entity_by_id_t::iterator end() const {
entity_by_id::iterator end() const {
return byid_.end();
}
@@ -411,7 +411,7 @@ public:
void register_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, int instance_id, int attribute_index);
void unregister_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, const express::base& entity, int attribute_index);
entity_instance_by_guid_t internal_guid_map() { return byguid_; };
entity_instance_by_guid internal_guid_map() { return byguid_; };
void add_type_ref(const express::base& new_entity);
void remove_type_ref(const express::base& new_entity);
+13 -13
View File
@@ -72,8 +72,8 @@ public:
};
class IFC_PARSE_API blank {};
class IFC_PARSE_API derived {};
class IFC_PARSE_API empty_aggregate_t {};
class IFC_PARSE_API empty_aggregate_of_aggregate_t {};
class IFC_PARSE_API empty_aggregate {};
class IFC_PARSE_API empty_aggregate_of_aggregate {};
} // namespace ifcopenshell
@@ -134,7 +134,7 @@ namespace impl {
};
template <>
struct variant_type_name<ifcopenshell::empty_aggregate_t> {
struct variant_type_name<ifcopenshell::empty_aggregate> {
static std::string get() { return "aggregate"; }
};
@@ -144,7 +144,7 @@ namespace impl {
};
template <>
struct variant_type_name<ifcopenshell::empty_aggregate_of_aggregate_t> {
struct variant_type_name<ifcopenshell::empty_aggregate_of_aggregate> {
static std::string get() { return "aggregate of aggregate"; }
};
}
@@ -191,7 +191,7 @@ typedef parameter_pack <
express::base,
// AGGREGATES:
empty_aggregate_t,
empty_aggregate,
// An aggregate of integers, e.g. (1,2,3). Stored as int64_t for the
// same reason as the scalar int64_t above.
std::vector<int64_t>,
@@ -207,7 +207,7 @@ typedef parameter_pack <
std::vector<express::base>,
// AGGREGATES OF AGGREGATES:
empty_aggregate_of_aggregate_t,
empty_aggregate_of_aggregate,
// An aggregate of an aggregate of ints. E.g. ((1, 2), (3))
std::vector<std::vector<int64_t>>,
// An aggregate of an aggregate of floats. E.g. ((1., 2.3), (4.))
@@ -227,17 +227,17 @@ struct pack_to_variant_array<parameter_pack<Args...>> {
using in_memory_attribute_storage = pack_to_variant_array<type_variant_parameter_pack>::type;
template <typename Pack>
struct type_encoder_t;
struct type_encoder_impl;
template <typename... Types>
struct type_encoder_t<parameter_pack<Types...>> {
struct type_encoder_impl<parameter_pack<Types...>> {
template <typename U>
static char encode_type() {
return 'A' + ::impl::TypeIndex_v<U, Types...>;
}
};
using type_encoder = type_encoder_t<type_variant_parameter_pack>;
using type_encoder = type_encoder_impl<type_variant_parameter_pack>;
class IFC_PARSE_API mutable_attribute_value {
public:
@@ -299,8 +299,8 @@ namespace impl {
bool serialize(std::string& buffer, const ifcopenshell::blank& value);
bool serialize(std::string& buffer, const ifcopenshell::derived& value);
bool serialize(std::string& buffer, const ifcopenshell::empty_aggregate_t& value);
bool serialize(std::string& buffer, const ifcopenshell::empty_aggregate_of_aggregate_t& value);
bool serialize(std::string& buffer, const ifcopenshell::empty_aggregate& value);
bool serialize(std::string& buffer, const ifcopenshell::empty_aggregate_of_aggregate& value);
bool serialize(std::string& buffer, const boost::logic::tribool& value);
@@ -475,9 +475,9 @@ public:
case ifcopenshell::Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE:
return visitor((std::vector<std::vector<express::base>>)*this);
case ifcopenshell::Argument_EMPTY_AGGREGATE:
return visitor(empty_aggregate_t{});
return visitor(empty_aggregate{});
case ifcopenshell::Argument_AGGREGATE_OF_EMPTY_AGGREGATE:
return visitor(empty_aggregate_of_aggregate_t{});
return visitor(empty_aggregate_of_aggregate{});
default:
return visitor(blank{});
}
+2 -2
View File
@@ -35,13 +35,13 @@ public:
static constexpr bool read_only = std::is_void<TransformBack>::value;
struct back_storage_fallback {};
using back_storage_t = typename std::conditional<read_only, back_storage_fallback, TransformBack>::type;
using back_storage = typename std::conditional<read_only, back_storage_fallback, TransformBack>::type;
private:
BaseMap* base_map_;
Transform transform_;
back_storage_t transform_back_;
back_storage transform_back_;
public:
// read-only constructor with TransformBack=void
+12 -12
View File
@@ -1330,8 +1330,8 @@ namespace {
}
data_ << ")";
}
void operator()(const empty_aggregate_t& /*unused*/) const { data_ << "()"; }
void operator()(const empty_aggregate_of_aggregate_t& /*unused*/) const { data_ << "()"; }
void operator()(const empty_aggregate& /*unused*/) const { data_ << "()"; }
void operator()(const empty_aggregate_of_aggregate& /*unused*/) const { data_ << "()"; }
};
template <>
@@ -2469,7 +2469,7 @@ template void ifcopenshell::impl::in_memory_file_storage::read_from_stream(file_
void file::recalculate_id_counter() {
/*
// @todo
entity_by_id_t::key_type k = 0;
entity_by_id::key_type k = 0;
for (auto& p : byid_) {
if (p.first > k) {
k = p.first;
@@ -2582,7 +2582,7 @@ express::base file::add_entity(const express::base& entity, int id) {
// If this instance has been inserted before, return
// a reference to the copy that was created from it.
entity_entity_map_t::iterator mit = entity_file_map_.find(entity.identity());
entity_entity_map::iterator mit = entity_file_map_.find(entity.identity());
if (mit != entity_file_map_.end()) {
return mit->second;
}
@@ -2593,9 +2593,9 @@ express::base file::add_entity(const express::base& entity, int id) {
auto entity_attributes = traverse(entity, 1);
for (auto it = entity_attributes.begin() + 1; it != entity_attributes.end(); ++it) {
if (*it != entity) {
entity_entity_map_t::iterator mit2 = entity_file_map_.find(it->identity());
entity_entity_map::iterator mit2 = entity_file_map_.find(it->identity());
if (mit2 == entity_file_map_.end()) {
entity_file_map_.insert(entity_entity_map_t::value_type(it->identity(), add_entity(*it)));
entity_file_map_.insert(entity_entity_map::value_type(it->identity(), add_entity(*it)));
}
}
}
@@ -2618,8 +2618,8 @@ express::base file::add_entity(const express::base& entity, int id) {
if constexpr (std::is_same_v<u, express::base>) {
} else if constexpr (std::is_same_v<u, std::vector<express::base>>) {
} else if constexpr (std::is_same_v<u, std::vector<std::vector<express::base>>>) {
} else if constexpr (std::is_same_v<u, empty_aggregate_t>) {
} else if constexpr (std::is_same_v<u, empty_aggregate_of_aggregate_t>) {
} else if constexpr (std::is_same_v<u, empty_aggregate>) {
} else if constexpr (std::is_same_v<u, empty_aggregate_of_aggregate>) {
} else {
new_entity.set_attribute_value(i, v);
}
@@ -2648,7 +2648,7 @@ express::base file::add_entity(const express::base& entity, int id) {
}
if (attr_type == ifcopenshell::Argument_ENTITY_INSTANCE) {
entity_entity_map_t::const_iterator eit = entity_file_map_.find(((express::base)(attr)).identity());
entity_entity_map::const_iterator eit = entity_file_map_.find(((express::base)(attr)).identity());
if (eit == entity_file_map_.end()) {
throw ifcopenshell::exception("Unable to map instance to file");
}
@@ -2658,7 +2658,7 @@ express::base file::add_entity(const express::base& entity, int id) {
std::vector<express::base> instances = attr;
std::vector<express::base> new_instances;
for (auto& i : instances) {
entity_entity_map_t::const_iterator eit = entity_file_map_.find(i.identity());
entity_entity_map::const_iterator eit = entity_file_map_.find(i.identity());
if (eit == entity_file_map_.end()) {
throw ifcopenshell::exception("Unable to map instance to file");
}
@@ -2672,7 +2672,7 @@ express::base file::add_entity(const express::base& entity, int id) {
for (auto& v : instances) {
new_instances.emplace_back();
for (auto& i : v) {
entity_entity_map_t::const_iterator eit = entity_file_map_.find(i.identity());
entity_entity_map::const_iterator eit = entity_file_map_.find(i.identity());
if (eit == entity_file_map_.end()) {
throw ifcopenshell::exception("Unable to map instance to file");
}
@@ -2719,7 +2719,7 @@ express::base file::add_entity(const express::base& entity, int id) {
}
}
entity_file_map_.insert(entity_entity_map_t::value_type(entity.identity(), new_entity));
entity_file_map_.insert(entity_entity_map::value_type(entity.identity(), new_entity));
// For subtypes of IfcRoot, the GUID mapping needs to be updated.
/*
+2 -2
View File
@@ -108,8 +108,8 @@ void ifcopenshell::spf_header::assign(const spf_header& other) {
if constexpr (std::is_same_v<u, express::base>) {
} else if constexpr (std::is_same_v<u, std::vector<express::base>>) {
} else if constexpr (std::is_same_v<u, std::vector<std::vector<express::base>>>) {
} else if constexpr (std::is_same_v<u, empty_aggregate_t>) {
} else if constexpr (std::is_same_v<u, empty_aggregate_of_aggregate_t>) {
} else if constexpr (std::is_same_v<u, empty_aggregate>) {
} else if constexpr (std::is_same_v<u, empty_aggregate_of_aggregate>) {
} else {
new_entity.set_attribute_value(i, v);
}
+53 -53
View File
@@ -220,19 +220,19 @@ namespace ifcopenshell {
class inverse_index {
public:
typedef std::map<std::tuple<short, short>, std::vector<uint32_t>> legacy_bucket_t;
typedef std::unordered_map<int, legacy_bucket_t> legacy_map_t;
typedef legacy_map_t::key_type key_type;
typedef legacy_map_t::mapped_type mapped_type;
typedef legacy_map_t::value_type value_type;
typedef legacy_map_t::iterator iterator;
typedef legacy_map_t::const_iterator const_iterator;
typedef std::map<std::tuple<short, short>, std::vector<uint32_t>> legacy_bucket;
typedef std::unordered_map<int, legacy_bucket> legacy_map;
typedef legacy_map::key_type key_type;
typedef legacy_map::mapped_type mapped_type;
typedef legacy_map::value_type value_type;
typedef legacy_map::iterator iterator;
typedef legacy_map::const_iterator const_iterator;
typedef std::vector<inverse_record>::const_iterator record_iterator;
private:
mutable std::vector<inverse_record> records_;
mutable bool sorted_ = true;
mutable std::unique_ptr<legacy_map_t> materialized_;
mutable std::unique_ptr<legacy_map> materialized_;
static bool record_less(const inverse_record& a, const inverse_record& b) {
if (a.referenced_id != b.referenced_id) {
@@ -259,9 +259,9 @@ namespace ifcopenshell {
materialized_.reset();
}
legacy_map_t& materialize() const {
legacy_map& materialize() const {
if (!materialized_) {
materialized_ = std::make_unique<legacy_map_t>();
materialized_ = std::make_unique<legacy_map>();
materialized_->reserve(records_.size());
for (const auto& record : records_) {
(*materialized_)[(int)record.referenced_id][{(short)record.source_entity, (short)record.attribute_index}].push_back(record.source_id);
@@ -421,42 +421,42 @@ namespace ifcopenshell {
unresolved_references* references_to_resolve = nullptr;
typedef std::map<const ifcopenshell::declaration*, std::vector<express::base>> entities_by_type_t;
typedef std::unordered_map<uint32_t, shared_pointer_type> entity_instance_by_name_storage_t;
typedef map_transformer<entity_instance_by_name_storage_t, std::function<express::base(shared_pointer_type)>> entity_instance_by_name_t;
typedef std::unordered_map<uint32_t, shared_pointer_type> type_instance_by_name_t;
typedef std::map<std::string, express::base> entity_instance_by_guid_t;
typedef inverse_index entities_by_ref_t;
typedef entity_instance_by_name_t::iterator iterator;
typedef std::map<const ifcopenshell::declaration*, std::vector<express::base>> entities_by_type;
typedef std::unordered_map<uint32_t, shared_pointer_type> entity_instance_by_name_storage;
typedef map_transformer<entity_instance_by_name_storage, std::function<express::base(shared_pointer_type)>> entity_instance_by_name;
typedef std::unordered_map<uint32_t, shared_pointer_type> type_instance_by_name;
typedef std::map<std::string, express::base> entity_instance_by_guid;
typedef inverse_index entities_by_ref;
typedef entity_instance_by_name::iterator iterator;
in_memory_file_storage(ifcopenshell::file* owner_file = nullptr, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : logger_(logger), file(owner_file), schema(nullptr), byid_read_(&byid_, [this](const shared_pointer_type& data) { return express::base(data); }) {};
in_memory_file_storage(const in_memory_file_storage& other) = delete;
in_memory_file_storage(const in_memory_file_storage&& other) = delete;
class type_iterator : public entities_by_type_t::const_iterator {
class type_iterator : public entities_by_type::const_iterator {
public:
using iterator_category = std::forward_iterator_tag;
using value_type = entities_by_type_t::key_type;
using difference_type = typename entities_by_type_t::const_iterator::difference_type;
using value_type = entities_by_type::key_type;
using difference_type = typename entities_by_type::const_iterator::difference_type;
using pointer = value_type const*;
using reference = value_type const&;
type_iterator() : entities_by_type_t::const_iterator() {};
type_iterator() : entities_by_type::const_iterator() {};
type_iterator(const entities_by_type_t::const_iterator& iterator)
: entities_by_type_t::const_iterator(iterator) {};
type_iterator(const entities_by_type::const_iterator& iterator)
: entities_by_type::const_iterator(iterator) {};
entities_by_type_t::key_type const* operator->() const {
return &entities_by_type_t::const_iterator::operator->()->first;
entities_by_type::key_type const* operator->() const {
return &entities_by_type::const_iterator::operator->()->first;
}
entities_by_type_t::key_type const& operator*() const {
return entities_by_type_t::const_iterator::operator*().first;
entities_by_type::key_type const& operator*() const {
return entities_by_type::const_iterator::operator*().first;
}
type_iterator& operator++() {
entities_by_type_t::const_iterator::operator++();
entities_by_type::const_iterator::operator++();
return *this;
}
@@ -467,12 +467,12 @@ namespace ifcopenshell {
}
};
entity_instance_by_name_storage_t byid_;
type_instance_by_name_t tbyid_;
entities_by_type_t bytype_excl_;
entities_by_ref_t byref_excl_;
entity_instance_by_guid_t byguid_;
entity_instance_by_name_t byid_read_;
entity_instance_by_name_storage byid_;
type_instance_by_name tbyid_;
entities_by_type bytype_excl_;
entities_by_ref byref_excl_;
entity_instance_by_guid byguid_;
entity_instance_by_name byid_read_;
template <typename Reader>
shared_pointer_type load(ifcopenshell::spf_lexer<Reader>* tokens, std::optional<size_t> entity_instance_name, const ifcopenshell::declaration* declaration, const ifcopenshell::entity* entity, int attribute_index = -1, bool coerce_attribute_count = true);
@@ -529,35 +529,35 @@ namespace ifcopenshell {
// to make sure that instance pointer are constant during file lifetime
// cache instances because we want stable pointers
// @todo this is silly, but we cannot have the same type, this should be just a pointer then on the file side?
typedef std::map<uint32_t, shared_pointer_type> entity_by_iden_cache_t;
entity_by_iden_cache_t instance_cache_, type_instance_cache_;
typedef std::map<uint32_t, shared_pointer_type> entity_by_iden_cache;
entity_by_iden_cache instance_cache_, type_instance_cache_;
std::mutex instance_cache_mutex_;
// @todo all these size_ts should probably be uint32_t for consistency with in-mem storage
// lookup id->identity
// typedef rocksdb_map_adapter<size_t, size_t> identity_by_id_t;
// identity_by_id_t byid_;
typedef rocksdb_set_view<size_t> instance_name_view_t;
instance_name_view_t instance_ids_;
typedef set_to_map_transformer<instance_name_view_t, std::function<express::base(size_t)>> entity_instance_by_name_t;
entity_instance_by_name_t instance_by_name_;
// typedef rocksdb_map_adapter<size_t, size_t> identity_by_id;
// identity_by_id byid_;
typedef rocksdb_set_view<size_t> instance_name_view;
instance_name_view instance_ids_;
typedef set_to_map_transformer<instance_name_view, std::function<express::base(size_t)>> entity_instance_by_name;
entity_instance_by_name instance_by_name_;
// typedef map_transformer<rocksdb_map_adapter<size_t, size_t>, std::function<ifcopenshell::IfcBaseClass*(size_t)>, std::function<size_t(ifcopenshell::IfcBaseClass*)>> entity_by_id_t;
// typedef map_transformer<rocksdb_map_adapter<size_t, size_t>, std::function<ifcopenshell::IfcBaseClass*(size_t)>, std::function<size_t(ifcopenshell::IfcBaseClass*)>> entity_by_id;
// storage is now Instance name -> Identity -> Pointer (cached)
// entity_by_id_t byidentity_;
// entity_by_id byidentity_;
// index in schema to binary serialized ids
typedef rocksdb_map_adapter<size_t, std::string> instance_id_str_by_type_t;
instance_id_str_by_type_t bytype_;
typedef rocksdb_map_adapter<size_t, std::string> instance_id_str_by_type;
instance_id_str_by_type bytype_;
// guid -> id
typedef rocksdb_map_adapter<std::string, size_t> instance_id_by_guid_str_t;
instance_id_by_guid_str_t byguid_internal_;
typedef rocksdb_map_adapter<std::string, size_t> instance_id_by_guid_str;
instance_id_by_guid_str byguid_internal_;
// guid -> id -> instance
typedef map_transformer<rocksdb_map_adapter<std::string, size_t>, std::function<express::base(size_t)>, std::function<size_t(const express::base&)>> entity_instance_by_guid_t;
entity_instance_by_guid_t byguid_;
typedef map_transformer<rocksdb_map_adapter<std::string, size_t>, std::function<express::base(size_t)>, std::function<size_t(const express::base&)>> entity_instance_by_guid;
entity_instance_by_guid byguid_;
typedef std::tuple<int, int, int> inverse_attr_record;
enum INVERSE_ATTR {
@@ -565,8 +565,8 @@ namespace ifcopenshell {
INSTANCE_TYPE,
ATTRIBUTE_INDEX
};
typedef rocksdb_map_adapter<inverse_attr_record, std::vector<uint32_t>> entities_by_ref_t;
entities_by_ref_t byref_excl_;
typedef rocksdb_map_adapter<inverse_attr_record, std::vector<uint32_t>> entities_by_ref;
entities_by_ref byref_excl_;
bool read_only_ = false;
@@ -675,7 +675,7 @@ namespace ifcopenshell {
};
// @todo rocksdb_instance_iterator?
using const_iterator = entity_instance_by_name_t::iterator;
using const_iterator = entity_instance_by_name::iterator;
void register_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, int instance_id, int attribute_index);
void unregister_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, const express::base& entity, int attribute_index);
+10 -10
View File
@@ -123,7 +123,7 @@ namespace impl {
using type = std::tuple<>;
};
template <typename... Types>
using map_types_t = typename map_types<Types...>::type;
using mapped_types = typename map_types<Types...>::type;
// Create aligned_union from paramater pack stored in tuple for storage in variant
template <typename T>
@@ -138,7 +138,7 @@ namespace impl {
template<typename... Types>
class variant_array {
public:
using types_tuple = ::impl::map_types_t<Types...>;
using types_tuple = ::impl::mapped_types<Types...>;
variant_array(size_t size)
: size_and_indices_(size ? new uint8_t[size + 1] : nullptr)
@@ -190,7 +190,7 @@ public:
destroy_at_index(index);
size_and_indices_[index + 1] = ::impl::TypeIndex_v<u, Types...>;
using v = typename std::tuple_element<::impl::TypeIndex_v<u, Types...>, ::impl::map_types_t<Types... >>::type;
using v = typename std::tuple_element<::impl::TypeIndex_v<u, Types...>, ::impl::mapped_types<Types... >>::type;
if constexpr (::impl::is_unique_ptr<v>::value) {
new(&storage_[index]) v(new u(value));
} else {
@@ -221,7 +221,7 @@ public:
if (!has<T>(index)) {
throw std::bad_cast();
}
using v = typename std::tuple_element<::impl::TypeIndex_v<T, Types...>, ::impl::map_types_t<Types... >>::type;
using v = typename std::tuple_element<::impl::TypeIndex_v<T, Types...>, ::impl::mapped_types<Types... >>::type;
if constexpr (::impl::is_unique_ptr<v>::value) {
return **reinterpret_cast<v*>(&storage_[index]);
} else {
@@ -249,7 +249,7 @@ public:
::impl::variant_type_name<T>::get(), get_type_name(size_and_indices_[index + 1])
);
}
using v = typename std::tuple_element<::impl::TypeIndex_v<T, Types...>, ::impl::map_types_t<Types... >>::type;
using v = typename std::tuple_element<::impl::TypeIndex_v<T, Types...>, ::impl::mapped_types<Types... >>::type;
if constexpr (::impl::is_unique_ptr<v>::value) {
return **reinterpret_cast<const v*>(&storage_[index]);
} else {
@@ -272,7 +272,7 @@ public:
}
private:
using storage_type = typename ::impl::make_union_from_tuple<::impl::map_types_t<Types...>>::type;
using storage_type = typename ::impl::make_union_from_tuple<::impl::mapped_types<Types...>>::type;
uint8_t* size_and_indices_;
storage_type* storage_;
@@ -294,7 +294,7 @@ private:
template<std::size_t Index>
void destroy_type_at_index(std::size_t index, std::integral_constant<std::size_t, Index>) {
if (size_and_indices_[index + 1] == Index - 1) {
using t = typename std::tuple_element_t<Index - 1, ::impl::map_types_t<Types...>>;
using t = typename std::tuple_element_t<Index - 1, ::impl::mapped_types<Types...>>;
if constexpr (!std::is_trivially_destructible<t>::value) {
reinterpret_cast<t*>(&storage_[index])->~t();
}
@@ -311,7 +311,7 @@ private:
template<typename Visitor, std::size_t Index>
auto apply_visitor_impl(Visitor&& visitor, std::size_t index, std::integral_constant<std::size_t, Index>) const {
if (size_and_indices_[index + 1] == Index - 1) {
using t = typename std::tuple_element_t<Index - 1, ::impl::map_types_t<Types...>>;
using t = typename std::tuple_element_t<Index - 1, ::impl::mapped_types<Types...>>;
if constexpr (::impl::is_unique_ptr<t>::value) {
return visitor(**reinterpret_cast<t*>(&storage_[index]));
} else {
@@ -326,8 +326,8 @@ private:
static_cast<void>(visitor);
static_cast<void>(index);
throw std::runtime_error("Invalid variant index");
if constexpr (!std::is_void_v<decltype(std::declval<Visitor>()(std::declval<typename std::tuple_element_t<0, ::impl::map_types_t<Types...>> &>()))>) {
return decltype(std::declval<Visitor>()(std::declval<typename std::tuple_element_t<0, ::impl::map_types_t<Types...>> &>())){};
if constexpr (!std::is_void_v<decltype(std::declval<Visitor>()(std::declval<typename std::tuple_element_t<0, ::impl::mapped_types<Types...>> &>()))>) {
return decltype(std::declval<Visitor>()(std::declval<typename std::tuple_element_t<0, ::impl::mapped_types<Types...>> &>())){};
}
}