Parameter naming

This commit is contained in:
Thomas Krijnen
2026-03-31 18:23:13 +02:00
parent a07f56db6f
commit 20ccf2b455
24 changed files with 619 additions and 605 deletions
+7 -7
View File
@@ -41,19 +41,19 @@
// //
// creates a horizontal alignment from a list of PI points and curve radii. if include_geometry is true, the geometric representations are created, otherwise only business logic is created // creates a horizontal alignment from a list of PI points and curve radii. if include_geometry is true, the geometric representations are created, otherwise only business logic is created
IFC_PARSE_API Ifc4x3_add2::IfcAlignment addHorizontalAlignment(hierarchy_helper<Ifc4x3_add2>& file, const std::string& alignment_name, const std::vector<std::pair<double, double>>& points, const std::vector<double>& radii,bool include_geometry = true); IFC_PARSE_API Ifc4x3_add2::IfcAlignment addHorizontalAlignment(hierarchy_helper<Ifc4x3_add2>& model, const std::string& alignment_name, const std::vector<std::pair<double, double>>& points, const std::vector<double>& radii, bool include_geometry = true);
// creates a horizontal and vertical alignment from a list of PI points, curve radii, and VPI points and vertical curve lengths. if include_geometry is true, the geometric representations are created, otherwise only business logic is created // creates a horizontal and vertical alignment from a list of PI points, curve radii, and VPI points and vertical curve lengths. if include_geometry is true, the geometric representations are created, otherwise only business logic is created
IFC_PARSE_API Ifc4x3_add2::IfcAlignment addAlignment(hierarchy_helper<Ifc4x3_add2>& file, const std::string& alignment_name, const std::vector<std::pair<double, double>>& points, const std::vector<double>& radii, const std::vector<std::pair<double, double>>& vpoints, const std::vector<double>& vclength, bool include_geometry = true); IFC_PARSE_API Ifc4x3_add2::IfcAlignment addAlignment(hierarchy_helper<Ifc4x3_add2>& model, const std::string& alignment_name, const std::vector<std::pair<double, double>>& points, const std::vector<double>& radii, const std::vector<std::pair<double, double>>& vertical_points, const std::vector<double>& vertical_curve_lengths, bool include_geometry = true);
// Maps horizontal alignment business logic to geometry. // Maps horizontal alignment business logic to geometry.
// Bloss curves have two geometry elements for one horizontal alignment segment. That is the reason for returning a pair. // Bloss curves have two geometry elements for one horizontal alignment segment. That is the reason for returning a pair.
// Typically the first element of the pair will have the geometry and the second element will be nullptr // Typically the first element of the pair will have the geometry and the second element will be nullptr
IFC_PARSE_API std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignmentSegment(hierarchy_helper<Ifc4x3_add2>& file, const Ifc4x3_add2::IfcAlignmentSegment& segment); IFC_PARSE_API std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignmentSegment(hierarchy_helper<Ifc4x3_add2>& model, const Ifc4x3_add2::IfcAlignmentSegment& segment);
IFC_PARSE_API std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignmentHorizontalSegment(hierarchy_helper<Ifc4x3_add2>& file, const Ifc4x3_add2::IfcAlignmentHorizontalSegment& segment); IFC_PARSE_API std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignmentHorizontalSegment(hierarchy_helper<Ifc4x3_add2>& model, const Ifc4x3_add2::IfcAlignmentHorizontalSegment& segment);
IFC_PARSE_API std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignmentVerticalSegment(hierarchy_helper<Ifc4x3_add2>& file, const Ifc4x3_add2::IfcAlignmentVerticalSegment& segment); IFC_PARSE_API std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignmentVerticalSegment(hierarchy_helper<Ifc4x3_add2>& model, const Ifc4x3_add2::IfcAlignmentVerticalSegment& segment);
IFC_PARSE_API std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignmentCantSegment(hierarchy_helper<Ifc4x3_add2>& file, const Ifc4x3_add2::IfcAlignmentCantSegment& segment); IFC_PARSE_API std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignmentCantSegment(hierarchy_helper<Ifc4x3_add2>& model, const Ifc4x3_add2::IfcAlignmentCantSegment& segment);
#endif #endif
#endif #endif
+2 -2
View File
@@ -31,10 +31,10 @@
namespace ifcopenshell { namespace ifcopenshell {
IFC_PARSE_API const char* argument_type_to_string(argument_type argument_type); IFC_PARSE_API const char* argument_type_to_string(argument_type type);
/// Returns false when the string `s` contains character outside of {'0', '1'} /// Returns false when the string `s` contains character outside of {'0', '1'}
IFC_PARSE_API bool valid_binary_string(const std::string& string); IFC_PARSE_API bool valid_binary_string(const std::string& binary_string);
} // namespace ifcopenshell } // namespace ifcopenshell
+2 -2
View File
@@ -52,8 +52,8 @@ enum argument_type {
Argument_UNKNOWN Argument_UNKNOWN
}; };
IFC_PARSE_API argument_type from_parameter_type(const ifcopenshell::parameter_type*); IFC_PARSE_API argument_type from_parameter_type(const ifcopenshell::parameter_type* parameter_type);
IFC_PARSE_API argument_type make_aggregate(argument_type elem_type); IFC_PARSE_API argument_type make_aggregate(argument_type element_type);
} // namespace ifcopenshell } // namespace ifcopenshell
#endif #endif
+1 -1
View File
@@ -62,7 +62,7 @@ class IFC_PARSE_API character_decoder {
operator std::string(); operator std::string();
// Gets a decoded string representation at the offset provided, // Gets a decoded string representation at the offset provided,
// does not mutate the underlying token stream read pointer. // does not mutate the underlying token stream read pointer.
std::string get(size_t&); std::string get(size_t& offset);
}; };
} // namespace ifcopenshell } // namespace ifcopenshell
+2 -2
View File
@@ -49,8 +49,8 @@ class IFC_PARSE_API exception : public std::exception {
class IFC_PARSE_API attribute_out_of_range_exception : public exception { class IFC_PARSE_API attribute_out_of_range_exception : public exception {
public: public:
attribute_out_of_range_exception(const std::string& exception) attribute_out_of_range_exception(const std::string& message)
: exception(exception) {} : exception(message) {}
~attribute_out_of_range_exception() override; ~attribute_out_of_range_exception() override;
}; };
+28 -28
View File
@@ -81,26 +81,26 @@ class IFC_PARSE_API Base {
typename std::enable_if< typename std::enable_if<
(!std::is_base_of_v<express::Base, T> || std::is_same_v<express::Base, T>), (!std::is_base_of_v<express::Base, T> || std::is_same_v<express::Base, T>),
void>::type void>::type
set_attribute_value(size_t i, const T& t); set_attribute_value(size_t attribute_index, const T& value);
template <typename T> template <typename T>
typename std::enable_if< typename std::enable_if<
(!std::is_base_of_v<express::Base, T> || std::is_same_v<express::Base, T>), (!std::is_base_of_v<express::Base, T> || std::is_same_v<express::Base, T>),
void>::type void>::type
set_attribute_value(const std::string& name, const T& t); set_attribute_value(const std::string& attribute_name, const T& value);
void set_attribute_value(size_t i, const express::Base& p); void set_attribute_value(size_t attribute_index, const express::Base& value);
void set_attribute_value(const std::string& name, const express::Base& p); void set_attribute_value(const std::string& attribute_name, const express::Base& value);
void unset_attribute_value(size_t i); void unset_attribute_value(size_t attribute_index);
attribute_value get_attribute_value(size_t index) const; attribute_value get_attribute_value(size_t attribute_index) const;
uint32_t identity() const; uint32_t identity() const;
uint32_t id() const; uint32_t id() const;
void to_string(std::ostream&, bool upper = false) const; void to_string(std::ostream& stream, bool uppercase = false) const;
template <class T> template <class T>
T as() const { T as() const {
@@ -135,15 +135,15 @@ class IFC_PARSE_API Entity : public Base {
Entity() {} Entity() {}
Entity(const std::weak_ptr<instance_data>& data) : Base(data) {} Entity(const std::weak_ptr<instance_data>& data) : Base(data) {}
attribute_value get(const std::string& name) const; attribute_value get(const std::string& attribute_name) const;
template <typename T> template <typename T>
T get_value(const std::string& name) const; T get_value(const std::string& attribute_name) const;
template <typename T> template <typename T>
T get_value(const std::string& name, const T& default_value) const; T get_value(const std::string& attribute_name, const T& default_value) const;
std::vector<express::Entity> get_inverse(const std::string& name) const; std::vector<express::Entity> get_inverse(const std::string& attribute_name) const;
}; };
class IFC_PARSE_API Select : public Base { class IFC_PARSE_API Select : public Base {
@@ -173,15 +173,15 @@ namespace std {
template <> template <>
struct hash<express::Base> { struct hash<express::Base> {
std::size_t operator()(const express::Base& c) const noexcept { std::size_t operator()(const express::Base& value) const noexcept {
return std::hash<uint32_t>{}(c.identity()); return std::hash<uint32_t>{}(value.identity());
} }
}; };
template <> template <>
struct hash<express::Entity> { struct hash<express::Entity> {
std::size_t operator()(const express::Entity& c) const noexcept { std::size_t operator()(const express::Entity& value) const noexcept {
return std::hash<uint32_t>{}(c.identity()); return std::hash<uint32_t>{}(value.identity());
} }
}; };
@@ -191,15 +191,15 @@ namespace boost {
template <> template <>
struct hash<express::Base> { struct hash<express::Base> {
std::size_t operator()(const express::Base& c) const noexcept { std::size_t operator()(const express::Base& value) const noexcept {
return std::hash<uint32_t>{}(c.identity()); return std::hash<uint32_t>{}(value.identity());
} }
}; };
template <> template <>
struct hash<express::Entity> { struct hash<express::Entity> {
std::size_t operator()(const express::Entity& c) const noexcept { std::size_t operator()(const express::Entity& value) const noexcept {
return std::hash<uint32_t>{}(c.identity()); return std::hash<uint32_t>{}(value.identity());
} }
}; };
@@ -230,27 +230,27 @@ typename std::conditional_t<
is_std_vector<U>::value, is_std_vector<U>::value,
std::vector<std::vector<T>>, std::vector<std::vector<T>>,
std::vector<T>> std::vector<T>>
cast_vector(const std::vector<U>& vs) { cast_vector(const std::vector<U>& values) {
if constexpr (is_std_vector<U>::value) { if constexpr (is_std_vector<U>::value) {
using V = typename U::value_type; using V = typename U::value_type;
std::vector<std::vector<T>> result; std::vector<std::vector<T>> result;
result.reserve(vs.size()); result.reserve(values.size());
for (const auto& v : vs) { for (const auto& value : values) {
result.push_back(cast_vector<T>(v)); result.push_back(cast_vector<T>(value));
} }
return result; return result;
} else { } else {
std::vector<T> result; std::vector<T> result;
for (const auto& v : vs) { for (const auto& value : values) {
if constexpr (std::is_base_of_v<T, U>) { if constexpr (std::is_base_of_v<T, U>) {
// For a base or identity transform we can just rely on static cast // For a base or identity transform we can just rely on static cast
result.push_back(v); result.push_back(value);
} else if constexpr (std::is_base_of_v<express::Select, U> && std::is_same_v<T, express::Base>) { } else if constexpr (std::is_base_of_v<express::Select, U> && std::is_same_v<T, express::Base>) {
// From a select to concrete we simply call the appropriate method // From a select to concrete we simply call the appropriate method
result.push_back(v.concrete()); result.push_back(value.concrete());
} else { } else {
if (auto u = v.template as<T>()) { if (auto cast_value = value.template as<T>()) {
result.push_back(u); result.push_back(cast_value);
} }
} }
} }
+33 -33
View File
@@ -86,7 +86,7 @@ enum filetype {
FT_AUTODETECT FT_AUTODETECT
}; };
IFC_PARSE_API filetype guess_file_type(const std::string& fn); IFC_PARSE_API filetype guess_file_type(const std::string& path);
template <typename Reader = file_reader<full_buffer_impl>> template <typename Reader = file_reader<full_buffer_impl>>
class IFC_PARSE_API instance_streamer { class IFC_PARSE_API instance_streamer {
@@ -151,19 +151,19 @@ private:
size_t semicolon_count() const; size_t semicolon_count() const;
void push_page(const std::string& page); void push_page(const std::string& page_data);
instance_streamer(ifcopenshell::file* f = nullptr); instance_streamer(ifcopenshell::file* owner_file = nullptr);
instance_streamer(const std::string& fn, bool mmap = false, ifcopenshell::file* f = nullptr); instance_streamer(const std::string& path, bool use_mmap = false, ifcopenshell::file* owner_file = nullptr);
instance_streamer(void* data, int length, ifcopenshell::file* f = nullptr); instance_streamer(void* data, int data_size, ifcopenshell::file* owner_file = nullptr);
instance_streamer(Reader* stream, ifcopenshell::file* f = nullptr); instance_streamer(Reader* stream, ifcopenshell::file* owner_file = nullptr);
void bypass_types(const std::set<std::string>& type_names); void bypass_types(const std::set<std::string>& type_names);
void yield_header_instances(bool value) { yield_header_instances_ = value; } void yield_header_instances(bool enabled) { yield_header_instances_ = enabled; }
const ifcopenshell::schema_definition* schema() const { return schema_; } const ifcopenshell::schema_definition* schema() const { return schema_; }
@@ -237,7 +237,7 @@ public:
/// </summary> /// </summary>
/// <param name="path">UTF-8 file path to an IFC-SPF file</param> /// <param name="path">UTF-8 file path to an IFC-SPF file</param>
/// <param name="mmap">Whether to use memory-mapped I/O</param> /// <param name="mmap">Whether to use memory-mapped I/O</param>
file(const std::string& path, bool mmap); file(const std::string& path, bool use_mmap);
#endif #endif
/// <summary> /// <summary>
/// Constructs an file object from a file path, supports IFC-SPF and the IfcOpenShell-specific RocksDB format. /// Constructs an file object from a file path, supports IFC-SPF and the IfcOpenShell-specific RocksDB format.
@@ -245,17 +245,17 @@ public:
/// <param name="path">UTF-8 file path to an IFC-SPF file or RocksDB database directory</param> /// <param name="path">UTF-8 file path to an IFC-SPF file or RocksDB database directory</param>
/// <param name="ty">File type of the path</param> /// <param name="ty">File type of the path</param>
/// <param name="readonly">Whether to open in read-only mode, only supported on RocksDB databases</param> /// <param name="readonly">Whether to open in read-only mode, only supported on RocksDB databases</param>
file(const std::string& path, filetype ty=FT_AUTODETECT, bool readonly=false); file(const std::string& path, filetype type = FT_AUTODETECT, bool read_only = false);
/// <summary> /// <summary>
/// Constructs an file object from a stream containing IFC-SPF data. /// Constructs an file object from a stream containing IFC-SPF data.
/// </summary> /// </summary>
file(std::istream& stream, int length); file(std::istream& stream, int data_size);
/// <summary> /// <summary>
/// Constructs an file object from a memory buffer containing IFC-SPF data. /// Constructs an file object from a memory buffer containing IFC-SPF data.
/// </summary> /// </summary>
file(void* data, int length); file(void* data, int data_size);
/// <summary> /// <summary>
/// Constructs an file object with the specified schema, file type, and file path. /// Constructs an file object with the specified schema, file type, and file path.
@@ -264,16 +264,16 @@ public:
/// <param name="schema">Pointer to the schema definition to use. Defaults to the IFC4 schema if not specified.</param> /// <param name="schema">Pointer to the schema definition to use. Defaults to the IFC4 schema if not specified.</param>
/// <param name="ty">The file type to use for the file. Defaults to FT_AUTODETECT.</param> /// <param name="ty">The file type to use for the file. Defaults to FT_AUTODETECT.</param>
/// <param name="path">The file system path to the IFC file. Defaults to an empty string.</param> /// <param name="path">The file system path to the IFC file. Defaults to an empty string.</param>
file(const ifcopenshell::schema_definition* schema = ifcopenshell::schema_by_name("IFC4"), filetype ty = FT_AUTODETECT, const std::string& path = ""); file(const ifcopenshell::schema_definition* schema = ifcopenshell::schema_by_name("IFC4"), filetype type = FT_AUTODETECT, const std::string& path = "");
/// <summary> /// <summary>
/// Constructs an unitialized file object. Call initialize() later on. Allows to specify which types to bypass during load. /// Constructs an unitialized file object. Call initialize() later on. Allows to specify which types to bypass during load.
/// </summary> /// </summary>
file(const uninitialized_tag&); file(const uninitialized_tag& tag);
bool initialize(const std::string& path, filetype ty = FT_AUTODETECT, bool readonly = false); bool initialize(const std::string& path, filetype type = FT_AUTODETECT, bool read_only = false);
#ifdef USE_MMAP #ifdef USE_MMAP
bool initialize(const std::string& path, bool mmap); bool initialize(const std::string& path, bool use_mmap);
#endif #endif
/// @brief Bypass loading of all instances of the specified type name. Only applies to parsed IFC-SPF files. /// @brief Bypass loading of all instances of the specified type name. Only applies to parsed IFC-SPF files.
@@ -325,36 +325,36 @@ public:
/// Returns all entities in the file that match the positional argument. /// Returns all entities in the file that match the positional argument.
/// NOTE: This also returns subtypes of the requested type, for example: /// NOTE: This also returns subtypes of the requested type, for example:
/// IfcWall will also return IfcWallStandardCase entities /// IfcWall will also return IfcWallStandardCase entities
std::vector<express::Base> instances_by_type(const ifcopenshell::declaration*); std::vector<express::Base> instances_by_type(const ifcopenshell::declaration* declaration);
/// Returns all entities in the file that match the positional argument. /// Returns all entities in the file that match the positional argument.
std::vector<express::Base> instances_by_type_excl_subtypes(const ifcopenshell::declaration*); std::vector<express::Base> instances_by_type_excl_subtypes(const ifcopenshell::declaration* declaration);
/// Returns all entities in the file that match the positional argument. /// Returns all entities in the file that match the positional argument.
/// NOTE: This also returns subtypes of the requested type, for example: /// NOTE: This also returns subtypes of the requested type, for example:
/// IfcWall will also return IfcWallStandardCase entities /// IfcWall will also return IfcWallStandardCase entities
std::vector<express::Base> instances_by_type(const std::string& type); std::vector<express::Base> instances_by_type(const std::string& type_name);
/// Returns all entities in the file that match the positional argument. /// Returns all entities in the file that match the positional argument.
std::vector<express::Base> instances_by_type_excl_subtypes(const std::string& type); std::vector<express::Base> instances_by_type_excl_subtypes(const std::string& type_name);
/// Returns all entities in the file that reference the id /// Returns all entities in the file that reference the id
std::vector<express::Base> instances_by_reference(int id); std::vector<express::Base> instances_by_reference(int reference_id);
/// Returns the entity with the specified id /// Returns the entity with the specified id
express::Base instance_by_id(int id); express::Base instance_by_id(int instance_id);
/// Returns the entity with the specified GlobalId /// Returns the entity with the specified GlobalId
express::Base instance_by_guid(const std::string& guid); express::Base instance_by_guid(const std::string& global_id);
/// Performs a depth-first traversal, returning all entity instance /// Performs a depth-first traversal, returning all entity instance
/// attributes as a flat list. NB: includes the root instance specified /// attributes as a flat list. NB: includes the root instance specified
/// in the first function argument. /// in the first function argument.
static std::vector<express::Base> traverse(const express::Base& instance, int max_level = -1); static std::vector<express::Base> traverse(const express::Base& instance, int max_depth = -1);
/// Same as traverse() but maintains topological order by using a /// Same as traverse() but maintains topological order by using a
/// breadth-first search /// breadth-first search
static std::vector<express::Base> traverse_breadth_first(const express::Base& instance, int max_level = -1); static std::vector<express::Base> traverse_breadth_first(const express::Base& instance, int max_depth = -1);
/// Get the attribute indices corresponding to the list of entity instances /// Get the attribute indices corresponding to the list of entity instances
/// returned by get_inverse(). /// returned by get_inverse().
@@ -365,7 +365,7 @@ public:
return get_inverse(instance_id, &T::Class(), attribute_index)->template as<T>(); return get_inverse(instance_id, &T::Class(), attribute_index)->template as<T>();
} }
std::vector<express::Entity> get_inverse(int instance_id, const ifcopenshell::declaration* type, int attribute_index); std::vector<express::Entity> get_inverse(int instance_id, const ifcopenshell::declaration* declaration, int attribute_index);
size_t get_total_inverses(int instance_id); size_t get_total_inverses(int instance_id);
@@ -377,7 +377,7 @@ public:
void recalculate_id_counter(); void recalculate_id_counter();
express::Base add_entity(const express::Base& entity, int id = -1); express::Base add_entity(const express::Base& entity, int instance_id = -1);
/// Removes entity instance from file and unsets references. /// Removes entity instance from file and unsets references.
/// ///
@@ -401,16 +401,16 @@ public:
void build_inverses(); void build_inverses();
void register_inverse(unsigned, const ifcopenshell::entity* from_entity, int inst_id, int attribute_index); void register_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, int instance_id, int attribute_index);
void unregister_inverse(unsigned, const ifcopenshell::entity* from_entity, const express::Base&, 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_t internal_guid_map() { return byguid_; };
void add_type_ref(const express::Base& new_entity); void add_type_ref(const express::Base& new_entity);
void remove_type_ref(const express::Base& new_entity); void remove_type_ref(const express::Base& new_entity);
void process_deletion_inverse(const express::Base& inst); void process_deletion_inverse(const express::Base& entity);
void build_inverses_(const express::Base&); void build_inverses_(const express::Base& entity);
// @nb this does not support id assignment // @nb this does not support id assignment
template <typename T, typename... Ts> template <typename T, typename... Ts>
@@ -423,11 +423,11 @@ public:
} }
template <typename T> template <typename T>
T create(int id = -1) { T create(int instance_id = -1) {
return create(&T::Class(), id).template as<T>(); return create(&T::Class(), instance_id).template as<T>();
} }
express::Base create(const ifcopenshell::declaration* decl, int id = -1); express::Base create(const ifcopenshell::declaration* declaration, int instance_id = -1);
void batch() { void batch() {
batch_mode_ = true; batch_mode_ = true;
+47 -45
View File
@@ -72,21 +72,22 @@ public:
file_reader() = default; file_reader() = default;
explicit file_reader(const std::string& fn) explicit file_reader(const std::string& path)
: cursor_(0) { : cursor_(0) {
if constexpr (std::is_same_v<Impl, full_buffer_impl> if constexpr (std::is_same_v<Impl, full_buffer_impl>
#ifdef USE_MMAP #ifdef USE_MMAP
|| std::is_same_v<Impl, mmap_impl> || std::is_same_v<Impl, mmap_impl>
#endif #endif
) { ) {
impl_ = std::make_shared<Impl>(fn); impl_ = std::make_shared<Impl>(path);
} else { } else {
static_assert(file_reader_dependent_false_v<Impl>, "This file_reader constructor is not supported for the selected backend"); static_assert(file_reader_dependent_false_v<Impl>, "This file_reader constructor is not supported for the selected backend");
} }
} }
explicit file_reader(const caller_fed_tag&) explicit file_reader(const caller_fed_tag& tag)
: cursor_(0) { : cursor_(0) {
static_cast<void>(tag);
if constexpr (std::is_same_v<Impl, full_buffer_impl>) { if constexpr (std::is_same_v<Impl, full_buffer_impl>) {
impl_ = std::make_shared<Impl>(caller_fed_tag{}); impl_ = std::make_shared<Impl>(caller_fed_tag{});
} else if constexpr (std::is_same_v<Impl, pushed_sequential_impl>) { } else if constexpr (std::is_same_v<Impl, pushed_sequential_impl>) {
@@ -96,8 +97,9 @@ public:
} }
} }
file_reader(const std::string& content, const caller_fed_tag&) file_reader(const std::string& content, const caller_fed_tag& tag)
: file_reader(caller_fed_tag{}) { : file_reader(caller_fed_tag{}) {
static_cast<void>(tag);
if constexpr (std::is_same_v<Impl, full_buffer_impl> if constexpr (std::is_same_v<Impl, full_buffer_impl>
|| std::is_same_v<Impl, pushed_sequential_impl>) { || std::is_same_v<Impl, pushed_sequential_impl>) {
impl_->push_next_page(content); impl_->push_next_page(content);
@@ -106,10 +108,10 @@ public:
} }
} }
file_reader(const std::string& fn, size_t page_size, size_t page_capacity) file_reader(const std::string& path, size_t page_size, size_t page_capacity)
: cursor_(0) { : cursor_(0) {
if constexpr (std::is_same_v<Impl, paged_file_impl>) { if constexpr (std::is_same_v<Impl, paged_file_impl>) {
impl_ = std::make_shared<Impl>(fn, page_size, page_capacity); impl_ = std::make_shared<Impl>(path, page_size, page_capacity);
} else { } else {
static_assert(file_reader_dependent_false_v<Impl>, "This file_reader constructor is not supported for the selected backend"); static_assert(file_reader_dependent_false_v<Impl>, "This file_reader constructor is not supported for the selected backend");
} }
@@ -121,11 +123,11 @@ public:
return c; return c;
} }
void seek(size_t pos) { void seek(size_t position) {
if (pos > size()) { if (position > size()) {
throw std::out_of_range("seek out of range"); throw std::out_of_range("seek out of range");
} }
cursor_ = pos; cursor_ = position;
} }
size_t tell() const { return cursor_; } size_t tell() const { return cursor_; }
@@ -154,23 +156,23 @@ public:
return impl_->get_u32(cursor_); return impl_->get_u32(cursor_);
} }
void increment(size_t n = 1) { void increment(size_t count = 1) {
if (cursor_ + n > size()) { if (cursor_ + count > size()) {
throw std::out_of_range("increment past EOF"); throw std::out_of_range("increment past EOF");
} }
cursor_ += n; cursor_ += count;
} }
void push_next_page(const std::string& data) { void push_next_page(const std::string& page_data) {
impl_->push_next_page(data); impl_->push_next_page(page_data);
} }
void drop_pages() { void drop_pages() {
impl_->drop_pages(0); impl_->drop_pages(0);
} }
void drop_pages(size_t up_to_pos) { void drop_pages(size_t up_to_position) {
impl_->drop_pages(up_to_pos); impl_->drop_pages(up_to_position);
} }
bool eof() const { bool eof() const {
@@ -183,8 +185,8 @@ public:
return c; return c;
} }
char get(size_t offset) const { char get(size_t position) const {
return impl_->get(offset); return impl_->get(position);
} }
private: private:
@@ -195,16 +197,16 @@ private:
class IFC_PARSE_API full_buffer_impl { class IFC_PARSE_API full_buffer_impl {
public: public:
full_buffer_impl() = default; full_buffer_impl() = default;
explicit full_buffer_impl(const std::string& fn); explicit full_buffer_impl(const std::string& path);
explicit full_buffer_impl(const caller_fed_tag&); explicit full_buffer_impl(const caller_fed_tag& tag);
full_buffer_impl(const std::string& content, const caller_fed_tag&); full_buffer_impl(const std::string& content, const caller_fed_tag& tag);
size_t size() const; size_t size() const;
char get(size_t pos) const; char get(size_t position) const;
uint32_t get_u32(size_t pos) const; uint32_t get_u32(size_t position) const;
uint64_t get_u64(size_t pos) const; uint64_t get_u64(size_t position) const;
void push_next_page(const std::string& data); void push_next_page(const std::string& page_data);
void drop_pages(size_t pos); void drop_pages(size_t up_to_position);
private: private:
std::vector<char> buf_; std::vector<char> buf_;
@@ -218,19 +220,19 @@ public:
std::list<size_t>::iterator it; std::list<size_t>::iterator it;
}; };
paged_file_impl(const std::string& fn, size_t page_size, size_t cap); paged_file_impl(const std::string& path, size_t page_size, size_t page_capacity);
~paged_file_impl(); ~paged_file_impl();
size_t size() const; size_t size() const;
char get(size_t pos) const; char get(size_t position) const;
uint32_t get_u32(size_t pos) const; uint32_t get_u32(size_t position) const;
uint64_t get_u64(size_t pos) const; uint64_t get_u64(size_t position) const;
void push_next_page(const std::string& data); void push_next_page(const std::string& page_data);
void drop_pages(size_t pos); void drop_pages(size_t up_to_position);
private: private:
const file_reader_page& fetchPage_(size_t idx) const; const file_reader_page& fetchPage_(size_t page_index) const;
void touch_(std::unordered_map<size_t, Entry>::iterator it) const; void touch_(std::unordered_map<size_t, Entry>::iterator entry_it) const;
void evict_() const; void evict_() const;
std::string fn_; std::string fn_;
@@ -245,14 +247,14 @@ private:
#ifdef USE_MMAP #ifdef USE_MMAP
class IFC_PARSE_API mmap_impl { class IFC_PARSE_API mmap_impl {
public: public:
explicit mmap_impl(const std::string& fn); explicit mmap_impl(const std::string& path);
size_t size() const; size_t size() const;
char get(size_t pos) const; char get(size_t position) const;
uint32_t get_u32(size_t pos) const; uint32_t get_u32(size_t position) const;
uint64_t get_u64(size_t pos) const; uint64_t get_u64(size_t position) const;
void push_next_page(const std::string& data); void push_next_page(const std::string& page_data);
void drop_pages(size_t pos); void drop_pages(size_t up_to_position);
private: private:
boost::iostreams::mapped_file_source map_; boost::iostreams::mapped_file_source map_;
@@ -263,11 +265,11 @@ private:
class IFC_PARSE_API pushed_sequential_impl { class IFC_PARSE_API pushed_sequential_impl {
public: public:
size_t size() const; size_t size() const;
char get(size_t pos) const; char get(size_t position) const;
uint32_t get_u32(size_t pos) const; uint32_t get_u32(size_t position) const;
uint64_t get_u64(size_t pos) const; uint64_t get_u64(size_t position) const;
void push_next_page(const std::string& data); void push_next_page(const std::string& page_data);
void drop_pages(size_t pos); void drop_pages(size_t up_to_position);
private: private:
std::deque<file_reader_page> pages_; std::deque<file_reader_page> pages_;
+1 -1
View File
@@ -37,7 +37,7 @@ class IFC_PARSE_API global_id {
public: public:
static const unsigned int length = 22; static const unsigned int length = 22;
global_id(); global_id();
global_id(const std::string&); global_id(const std::string& value);
operator const std::string&() const; operator const std::string&() const;
operator const boost::uuids::uuid&() const; operator const boost::uuids::uuid&() const;
const std::string& formatted() const; const std::string& formatted() const;
+240 -239
View File
@@ -75,287 +75,287 @@
namespace { namespace {
#ifdef HAS_SCHEMA_2x3 #ifdef HAS_SCHEMA_2x3
Ifc2x3::IfcObjectDefinition get_parent_of_relation(const Ifc2x3::IfcRelContainedInSpatialStructure& t) { Ifc2x3::IfcObjectDefinition get_parent_of_relation(const Ifc2x3::IfcRelContainedInSpatialStructure& relation) {
return t.RelatingStructure(); return relation.RelatingStructure();
} }
std::vector<express::Base> get_children_of_relation(const Ifc2x3::IfcRelContainedInSpatialStructure& t) { std::vector<express::Base> get_children_of_relation(const Ifc2x3::IfcRelContainedInSpatialStructure& relation) {
return cast_vector<express::Base>(t.RelatedElements()); return cast_vector<express::Base>(relation.RelatedElements());
} }
std::vector<express::Base> get_children_of_relation(const Ifc2x3::IfcRelAggregates& t) { std::vector<express::Base> get_children_of_relation(const Ifc2x3::IfcRelAggregates& relation) {
return cast_vector<express::Base>(t.RelatedObjects()); return cast_vector<express::Base>(relation.RelatedObjects());
} }
void set_children_of_relation(Ifc2x3::IfcRelContainedInSpatialStructure& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc2x3::IfcRelContainedInSpatialStructure& relation, std::vector<express::Base>& children) {
t.setRelatedElements(cast_vector<Ifc2x3::IfcProduct>(cs)); relation.setRelatedElements(cast_vector<Ifc2x3::IfcProduct>(children));
} }
void set_children_of_relation(Ifc2x3::IfcRelAggregates& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc2x3::IfcRelAggregates& relation, std::vector<express::Base>& children) {
t.setRelatedObjects(cast_vector<Ifc2x3::IfcObjectDefinition>(cs)); relation.setRelatedObjects(cast_vector<Ifc2x3::IfcObjectDefinition>(children));
} }
#endif #endif
#ifdef HAS_SCHEMA_4 #ifdef HAS_SCHEMA_4
Ifc4::IfcObjectDefinition get_parent_of_relation(const Ifc4::IfcRelContainedInSpatialStructure& t) { Ifc4::IfcObjectDefinition get_parent_of_relation(const Ifc4::IfcRelContainedInSpatialStructure& relation) {
return t.RelatingStructure(); return relation.RelatingStructure();
} }
std::vector<express::Base> get_children_of_relation(const Ifc4::IfcRelContainedInSpatialStructure& t) { std::vector<express::Base> get_children_of_relation(const Ifc4::IfcRelContainedInSpatialStructure& relation) {
return cast_vector<express::Base>(t.RelatedElements()); return cast_vector<express::Base>(relation.RelatedElements());
} }
std::vector<express::Base> get_children_of_relation(const Ifc4::IfcRelAggregates& t) { std::vector<express::Base> get_children_of_relation(const Ifc4::IfcRelAggregates& relation) {
return cast_vector<express::Base>(t.RelatedObjects()); return cast_vector<express::Base>(relation.RelatedObjects());
} }
void set_children_of_relation(Ifc4::IfcRelContainedInSpatialStructure& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4::IfcRelContainedInSpatialStructure& relation, std::vector<express::Base>& children) {
t.setRelatedElements(cast_vector<Ifc4::IfcProduct>(cs)); relation.setRelatedElements(cast_vector<Ifc4::IfcProduct>(children));
} }
void set_children_of_relation(Ifc4::IfcRelAggregates& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4::IfcRelAggregates& relation, std::vector<express::Base>& children) {
t.setRelatedObjects(cast_vector<Ifc4::IfcObjectDefinition>(cs)); relation.setRelatedObjects(cast_vector<Ifc4::IfcObjectDefinition>(children));
} }
#endif #endif
#ifdef HAS_SCHEMA_4x1 #ifdef HAS_SCHEMA_4x1
Ifc4x1::IfcObjectDefinition get_parent_of_relation(const Ifc4x1::IfcRelContainedInSpatialStructure& t) { Ifc4x1::IfcObjectDefinition get_parent_of_relation(const Ifc4x1::IfcRelContainedInSpatialStructure& relation) {
return t.RelatingStructure(); return relation.RelatingStructure();
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x1::IfcRelContainedInSpatialStructure& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x1::IfcRelContainedInSpatialStructure& relation) {
return cast_vector<express::Base>(t.RelatedElements()); return cast_vector<express::Base>(relation.RelatedElements());
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x1::IfcRelAggregates& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x1::IfcRelAggregates& relation) {
return cast_vector<express::Base>(t.RelatedObjects()); return cast_vector<express::Base>(relation.RelatedObjects());
} }
void set_children_of_relation(Ifc4x1::IfcRelContainedInSpatialStructure& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x1::IfcRelContainedInSpatialStructure& relation, std::vector<express::Base>& children) {
t.setRelatedElements(cast_vector<Ifc4x1::IfcProduct>(cs)); relation.setRelatedElements(cast_vector<Ifc4x1::IfcProduct>(children));
} }
void set_children_of_relation(Ifc4x1::IfcRelAggregates& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x1::IfcRelAggregates& relation, std::vector<express::Base>& children) {
t.setRelatedObjects(cast_vector<Ifc4x1::IfcObjectDefinition>(cs)); relation.setRelatedObjects(cast_vector<Ifc4x1::IfcObjectDefinition>(children));
} }
#endif #endif
#ifdef HAS_SCHEMA_4x2 #ifdef HAS_SCHEMA_4x2
Ifc4x2::IfcObjectDefinition get_parent_of_relation(const Ifc4x2::IfcRelContainedInSpatialStructure& t) { Ifc4x2::IfcObjectDefinition get_parent_of_relation(const Ifc4x2::IfcRelContainedInSpatialStructure& relation) {
return t.RelatingStructure(); return relation.RelatingStructure();
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x2::IfcRelContainedInSpatialStructure& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x2::IfcRelContainedInSpatialStructure& relation) {
return cast_vector<express::Base>(t.RelatedElements()); return cast_vector<express::Base>(relation.RelatedElements());
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x2::IfcRelAggregates& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x2::IfcRelAggregates& relation) {
return cast_vector<express::Base>(t.RelatedObjects()); return cast_vector<express::Base>(relation.RelatedObjects());
} }
void set_children_of_relation(Ifc4x2::IfcRelContainedInSpatialStructure& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x2::IfcRelContainedInSpatialStructure& relation, std::vector<express::Base>& children) {
t.setRelatedElements(cast_vector<Ifc4x2::IfcProduct>(cs)); relation.setRelatedElements(cast_vector<Ifc4x2::IfcProduct>(children));
} }
void set_children_of_relation(Ifc4x2::IfcRelAggregates& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x2::IfcRelAggregates& relation, std::vector<express::Base>& children) {
t.setRelatedObjects(cast_vector<Ifc4x2::IfcObjectDefinition>(cs)); relation.setRelatedObjects(cast_vector<Ifc4x2::IfcObjectDefinition>(children));
} }
#endif #endif
#ifdef HAS_SCHEMA_4x3_rc1 #ifdef HAS_SCHEMA_4x3_rc1
Ifc4x3_rc1::IfcObjectDefinition get_parent_of_relation(const Ifc4x3_rc1::IfcRelContainedInSpatialStructure& t) { Ifc4x3_rc1::IfcObjectDefinition get_parent_of_relation(const Ifc4x3_rc1::IfcRelContainedInSpatialStructure& relation) {
return t.RelatingStructure(); return relation.RelatingStructure();
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x3_rc1::IfcRelContainedInSpatialStructure& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x3_rc1::IfcRelContainedInSpatialStructure& relation) {
return cast_vector<express::Base>(t.RelatedElements()); return cast_vector<express::Base>(relation.RelatedElements());
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x3_rc1::IfcRelAggregates& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x3_rc1::IfcRelAggregates& relation) {
return cast_vector<express::Base>(t.RelatedObjects()); return cast_vector<express::Base>(relation.RelatedObjects());
} }
void set_children_of_relation(Ifc4x3_rc1::IfcRelContainedInSpatialStructure& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x3_rc1::IfcRelContainedInSpatialStructure& relation, std::vector<express::Base>& children) {
t.setRelatedElements(cast_vector<Ifc4x3_rc1::IfcProduct>(cs)); relation.setRelatedElements(cast_vector<Ifc4x3_rc1::IfcProduct>(children));
} }
void set_children_of_relation(Ifc4x3_rc1::IfcRelAggregates& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x3_rc1::IfcRelAggregates& relation, std::vector<express::Base>& children) {
t.setRelatedObjects(cast_vector<Ifc4x3_rc1::IfcObjectDefinition>(cs)); relation.setRelatedObjects(cast_vector<Ifc4x3_rc1::IfcObjectDefinition>(children));
} }
#endif #endif
#ifdef HAS_SCHEMA_4x3_rc2 #ifdef HAS_SCHEMA_4x3_rc2
Ifc4x3_rc2::IfcObjectDefinition get_parent_of_relation(const Ifc4x3_rc2::IfcRelContainedInSpatialStructure& t) { Ifc4x3_rc2::IfcObjectDefinition get_parent_of_relation(const Ifc4x3_rc2::IfcRelContainedInSpatialStructure& relation) {
return t.RelatingStructure(); return relation.RelatingStructure();
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x3_rc2::IfcRelContainedInSpatialStructure& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x3_rc2::IfcRelContainedInSpatialStructure& relation) {
return cast_vector<express::Base>(t.RelatedElements()); return cast_vector<express::Base>(relation.RelatedElements());
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x3_rc2::IfcRelAggregates& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x3_rc2::IfcRelAggregates& relation) {
return cast_vector<express::Base>(t.RelatedObjects()); return cast_vector<express::Base>(relation.RelatedObjects());
} }
void set_children_of_relation(Ifc4x3_rc2::IfcRelContainedInSpatialStructure& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x3_rc2::IfcRelContainedInSpatialStructure& relation, std::vector<express::Base>& children) {
t.setRelatedElements(cast_vector<Ifc4x3_rc2::IfcProduct>(cs)); relation.setRelatedElements(cast_vector<Ifc4x3_rc2::IfcProduct>(children));
} }
void set_children_of_relation(Ifc4x3_rc2::IfcRelAggregates& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x3_rc2::IfcRelAggregates& relation, std::vector<express::Base>& children) {
t.setRelatedObjects(cast_vector<Ifc4x3_rc2::IfcObjectDefinition>(cs)); relation.setRelatedObjects(cast_vector<Ifc4x3_rc2::IfcObjectDefinition>(children));
} }
#endif #endif
#ifdef HAS_SCHEMA_4x3_rc3 #ifdef HAS_SCHEMA_4x3_rc3
Ifc4x3_rc3::IfcObjectDefinition get_parent_of_relation(const Ifc4x3_rc3::IfcRelContainedInSpatialStructure& t) { Ifc4x3_rc3::IfcObjectDefinition get_parent_of_relation(const Ifc4x3_rc3::IfcRelContainedInSpatialStructure& relation) {
return t.RelatingStructure(); return relation.RelatingStructure();
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x3_rc3::IfcRelContainedInSpatialStructure& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x3_rc3::IfcRelContainedInSpatialStructure& relation) {
return cast_vector<express::Base>(t.RelatedElements()); return cast_vector<express::Base>(relation.RelatedElements());
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x3_rc3::IfcRelAggregates& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x3_rc3::IfcRelAggregates& relation) {
return cast_vector<express::Base>(t.RelatedObjects()); return cast_vector<express::Base>(relation.RelatedObjects());
} }
void set_children_of_relation(Ifc4x3_rc3::IfcRelContainedInSpatialStructure& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x3_rc3::IfcRelContainedInSpatialStructure& relation, std::vector<express::Base>& children) {
t.setRelatedElements(cast_vector<Ifc4x3_rc3::IfcProduct>(cs)); relation.setRelatedElements(cast_vector<Ifc4x3_rc3::IfcProduct>(children));
} }
void set_children_of_relation(Ifc4x3_rc3::IfcRelAggregates& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x3_rc3::IfcRelAggregates& relation, std::vector<express::Base>& children) {
t.setRelatedObjects(cast_vector<Ifc4x3_rc3::IfcObjectDefinition>(cs)); relation.setRelatedObjects(cast_vector<Ifc4x3_rc3::IfcObjectDefinition>(children));
} }
#endif #endif
#ifdef HAS_SCHEMA_4x3_rc4 #ifdef HAS_SCHEMA_4x3_rc4
Ifc4x3_rc4::IfcObjectDefinition get_parent_of_relation(const Ifc4x3_rc4::IfcRelContainedInSpatialStructure& t) { Ifc4x3_rc4::IfcObjectDefinition get_parent_of_relation(const Ifc4x3_rc4::IfcRelContainedInSpatialStructure& relation) {
return t.RelatingStructure(); return relation.RelatingStructure();
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x3_rc4::IfcRelContainedInSpatialStructure& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x3_rc4::IfcRelContainedInSpatialStructure& relation) {
return cast_vector<express::Base>(t.RelatedElements()); return cast_vector<express::Base>(relation.RelatedElements());
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x3_rc4::IfcRelAggregates& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x3_rc4::IfcRelAggregates& relation) {
return cast_vector<express::Base>(t.RelatedObjects()); return cast_vector<express::Base>(relation.RelatedObjects());
} }
void set_children_of_relation(Ifc4x3_rc4::IfcRelContainedInSpatialStructure& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x3_rc4::IfcRelContainedInSpatialStructure& relation, std::vector<express::Base>& children) {
t.setRelatedElements(cast_vector<Ifc4x3_rc4::IfcProduct>(cs)); relation.setRelatedElements(cast_vector<Ifc4x3_rc4::IfcProduct>(children));
} }
void set_children_of_relation(Ifc4x3_rc4::IfcRelAggregates& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x3_rc4::IfcRelAggregates& relation, std::vector<express::Base>& children) {
t.setRelatedObjects(cast_vector<Ifc4x3_rc4::IfcObjectDefinition>(cs)); relation.setRelatedObjects(cast_vector<Ifc4x3_rc4::IfcObjectDefinition>(children));
} }
#endif #endif
#ifdef HAS_SCHEMA_4x3 #ifdef HAS_SCHEMA_4x3
Ifc4x3::IfcObjectDefinition get_parent_of_relation(const Ifc4x3::IfcRelContainedInSpatialStructure& t) { Ifc4x3::IfcObjectDefinition get_parent_of_relation(const Ifc4x3::IfcRelContainedInSpatialStructure& relation) {
return t.RelatingStructure(); return relation.RelatingStructure();
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x3::IfcRelContainedInSpatialStructure& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x3::IfcRelContainedInSpatialStructure& relation) {
return cast_vector<express::Base>(t.RelatedElements()); return cast_vector<express::Base>(relation.RelatedElements());
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x3::IfcRelAggregates& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x3::IfcRelAggregates& relation) {
return cast_vector<express::Base>(t.RelatedObjects()); return cast_vector<express::Base>(relation.RelatedObjects());
} }
void set_children_of_relation(Ifc4x3::IfcRelContainedInSpatialStructure& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x3::IfcRelContainedInSpatialStructure& relation, std::vector<express::Base>& children) {
t.setRelatedElements(cast_vector<Ifc4x3::IfcProduct>(cs)); relation.setRelatedElements(cast_vector<Ifc4x3::IfcProduct>(children));
} }
void set_children_of_relation(Ifc4x3::IfcRelAggregates& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x3::IfcRelAggregates& relation, std::vector<express::Base>& children) {
t.setRelatedObjects(cast_vector<Ifc4x3::IfcObjectDefinition>(cs)); relation.setRelatedObjects(cast_vector<Ifc4x3::IfcObjectDefinition>(children));
} }
#endif #endif
#ifdef HAS_SCHEMA_4x3_tc1 #ifdef HAS_SCHEMA_4x3_tc1
Ifc4x3_tc1::IfcObjectDefinition get_parent_of_relation(const Ifc4x3_tc1::IfcRelContainedInSpatialStructure& t) { Ifc4x3_tc1::IfcObjectDefinition get_parent_of_relation(const Ifc4x3_tc1::IfcRelContainedInSpatialStructure& relation) {
return t.RelatingStructure(); return relation.RelatingStructure();
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x3_tc1::IfcRelContainedInSpatialStructure& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x3_tc1::IfcRelContainedInSpatialStructure& relation) {
return cast_vector<express::Base>(t.RelatedElements()); return cast_vector<express::Base>(relation.RelatedElements());
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x3_tc1::IfcRelAggregates& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x3_tc1::IfcRelAggregates& relation) {
return cast_vector<express::Base>(t.RelatedObjects()); return cast_vector<express::Base>(relation.RelatedObjects());
} }
void set_children_of_relation(Ifc4x3_tc1::IfcRelContainedInSpatialStructure& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x3_tc1::IfcRelContainedInSpatialStructure& relation, std::vector<express::Base>& children) {
t.setRelatedElements(cast_vector<Ifc4x3_tc1::IfcProduct>(cs)); relation.setRelatedElements(cast_vector<Ifc4x3_tc1::IfcProduct>(children));
} }
void set_children_of_relation(Ifc4x3_tc1::IfcRelAggregates& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x3_tc1::IfcRelAggregates& relation, std::vector<express::Base>& children) {
t.setRelatedObjects(cast_vector<Ifc4x3_tc1::IfcObjectDefinition>(cs)); relation.setRelatedObjects(cast_vector<Ifc4x3_tc1::IfcObjectDefinition>(children));
} }
#endif #endif
#ifdef HAS_SCHEMA_4x3_add1 #ifdef HAS_SCHEMA_4x3_add1
Ifc4x3_add1::IfcObjectDefinition get_parent_of_relation(const Ifc4x3_add1::IfcRelContainedInSpatialStructure& t) { Ifc4x3_add1::IfcObjectDefinition get_parent_of_relation(const Ifc4x3_add1::IfcRelContainedInSpatialStructure& relation) {
return t.RelatingStructure(); return relation.RelatingStructure();
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x3_add1::IfcRelContainedInSpatialStructure& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x3_add1::IfcRelContainedInSpatialStructure& relation) {
return cast_vector<express::Base>(t.RelatedElements()); return cast_vector<express::Base>(relation.RelatedElements());
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x3_add1::IfcRelAggregates& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x3_add1::IfcRelAggregates& relation) {
return cast_vector<express::Base>(t.RelatedObjects()); return cast_vector<express::Base>(relation.RelatedObjects());
} }
void set_children_of_relation(Ifc4x3_add1::IfcRelContainedInSpatialStructure& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x3_add1::IfcRelContainedInSpatialStructure& relation, std::vector<express::Base>& children) {
t.setRelatedElements(cast_vector<Ifc4x3_add1::IfcProduct>(cs)); relation.setRelatedElements(cast_vector<Ifc4x3_add1::IfcProduct>(children));
} }
void set_children_of_relation(Ifc4x3_add1::IfcRelAggregates& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x3_add1::IfcRelAggregates& relation, std::vector<express::Base>& children) {
t.setRelatedObjects(cast_vector<Ifc4x3_add1::IfcObjectDefinition>(cs)); relation.setRelatedObjects(cast_vector<Ifc4x3_add1::IfcObjectDefinition>(children));
} }
#endif #endif
#ifdef HAS_SCHEMA_4x3_add2 #ifdef HAS_SCHEMA_4x3_add2
Ifc4x3_add2::IfcObjectDefinition get_parent_of_relation(const Ifc4x3_add2::IfcRelContainedInSpatialStructure& t) { Ifc4x3_add2::IfcObjectDefinition get_parent_of_relation(const Ifc4x3_add2::IfcRelContainedInSpatialStructure& relation) {
return t.RelatingStructure(); return relation.RelatingStructure();
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x3_add2::IfcRelContainedInSpatialStructure& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x3_add2::IfcRelContainedInSpatialStructure& relation) {
return cast_vector<express::Base>(t.RelatedElements()); return cast_vector<express::Base>(relation.RelatedElements());
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x3_add2::IfcRelAggregates& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x3_add2::IfcRelAggregates& relation) {
return cast_vector<express::Base>(t.RelatedObjects()); return cast_vector<express::Base>(relation.RelatedObjects());
} }
std::vector<express::Base> get_children_of_relation(const Ifc4x3_add2::IfcRelNests& t) { std::vector<express::Base> get_children_of_relation(const Ifc4x3_add2::IfcRelNests& relation) {
return cast_vector<express::Base>(t.RelatedObjects()); return cast_vector<express::Base>(relation.RelatedObjects());
} }
void set_children_of_relation(Ifc4x3_add2::IfcRelContainedInSpatialStructure& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x3_add2::IfcRelContainedInSpatialStructure& relation, std::vector<express::Base>& children) {
t.setRelatedElements(cast_vector<Ifc4x3_add2::IfcProduct>(cs)); relation.setRelatedElements(cast_vector<Ifc4x3_add2::IfcProduct>(children));
} }
void set_children_of_relation(Ifc4x3_add2::IfcRelAggregates& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x3_add2::IfcRelAggregates& relation, std::vector<express::Base>& children) {
t.setRelatedObjects(cast_vector<Ifc4x3_add2::IfcObjectDefinition>(cs)); relation.setRelatedObjects(cast_vector<Ifc4x3_add2::IfcObjectDefinition>(children));
} }
void set_children_of_relation(Ifc4x3_add2::IfcRelNests& t, std::vector<express::Base>& cs) { void set_children_of_relation(Ifc4x3_add2::IfcRelNests& relation, std::vector<express::Base>& children) {
t.setRelatedObjects(cast_vector<Ifc4x3_add2::IfcObjectDefinition>(cs)); relation.setRelatedObjects(cast_vector<Ifc4x3_add2::IfcObjectDefinition>(children));
} }
#endif #endif
express::Base get_parent_of_relation(const express::Base& t) { express::Base get_parent_of_relation(const express::Base& relation) {
return t.as<express::Entity>().get("RelatingObject"); return relation.as<express::Entity>().get("RelatingObject");
} }
std::vector<express::Base> get_children_of_relation(const express::Base& t) { std::vector<express::Base> get_children_of_relation(const express::Base& relation) {
return t.as<express::Entity>().get("RelatedElements"); return relation.as<express::Entity>().get("RelatedElements");
} }
void set_children_of_relation(express::Base& t, std::vector<express::Base>& cs) { void set_children_of_relation(express::Base& relation, std::vector<express::Base>& children) {
return t.set_attribute_value("RelatedElements", cs); return relation.set_attribute_value("RelatedElements", children);
} }
} // namespace } // namespace
template <typename Schema> template <typename Schema>
@@ -378,9 +378,9 @@ class IFC_PARSE_API hierarchy_helper : public ifcopenshell::file {
} }
template <typename T, typename U> template <typename T, typename U>
T addValue(U v) { T addValue(U value) {
auto measure = create<T>(); auto measure = create<T>();
measure.set_attribute_value(0, v); measure.set_attribute_value(0, value);
return measure; return measure;
} }
@@ -393,25 +393,25 @@ class IFC_PARSE_API hierarchy_helper : public ifcopenshell::file {
return ts.front(); return ts.front();
} }
typename Schema::IfcAxis2Placement3D addPlacement3d(double ox = 0.0, double oy = 0.0, double oz = 0.0, double zx = 0.0, double zy = 0.0, double zz = 1.0, double xx = 1.0, double xy = 0.0, double xz = 0.0); typename Schema::IfcAxis2Placement3D addPlacement3d(double origin_x = 0.0, double origin_y = 0.0, double origin_z = 0.0, double z_axis_x = 0.0, double z_axis_y = 0.0, double z_axis_z = 1.0, double x_axis_x = 1.0, double x_axis_y = 0.0, double x_axis_z = 0.0);
typename Schema::IfcAxis2Placement2D addPlacement2d(double ox = 0.0, double oy = 0.0, double xx = 1.0, double xy = 0.0); typename Schema::IfcAxis2Placement2D addPlacement2d(double origin_x = 0.0, double origin_y = 0.0, double x_axis_x = 1.0, double x_axis_y = 0.0);
typename Schema::IfcLocalPlacement addLocalPlacement(typename Schema::IfcObjectPlacement parent = typename Schema::IfcObjectPlacement{}, typename Schema::IfcLocalPlacement addLocalPlacement(typename Schema::IfcObjectPlacement parent_placement = typename Schema::IfcObjectPlacement{},
double ox = 0.0, double origin_x = 0.0,
double oy = 0.0, double origin_y = 0.0,
double oz = 0.0, double origin_z = 0.0,
double zx = 0.0, double z_axis_x = 0.0,
double zy = 0.0, double z_axis_y = 0.0,
double zz = 1.0, double z_axis_z = 1.0,
double xx = 1.0, double x_axis_x = 1.0,
double xy = 0.0, double x_axis_y = 0.0,
double xz = 0.0); double x_axis_z = 0.0);
template <class T> template <class T>
void addRelatedObject(const typename Schema::IfcObjectDefinition& relating_object, void addRelatedObject(const typename Schema::IfcObjectDefinition& relating_object,
const typename Schema::IfcObjectDefinition& related_object, const typename Schema::IfcObjectDefinition& related_object,
typename Schema::IfcOwnerHistory owner_hist = typename Schema::IfcOwnerHistory{}) typename Schema::IfcOwnerHistory owner_history = typename Schema::IfcOwnerHistory{})
{ {
if constexpr (std::is_same_v<T, typename Schema::IfcRelDefinesByType>) { if constexpr (std::is_same_v<T, typename Schema::IfcRelDefinesByType>) {
auto li = instances_by_type<typename Schema::IfcRelDefinesByType>(); auto li = instances_by_type<typename Schema::IfcRelDefinesByType>();
@@ -426,16 +426,16 @@ class IFC_PARSE_API hierarchy_helper : public ifcopenshell::file {
} }
} }
if (!found) { if (!found) {
if (!owner_hist) { if (!owner_history) {
owner_hist = getSingle<typename Schema::IfcOwnerHistory>(); owner_history = getSingle<typename Schema::IfcOwnerHistory>();
} }
if (!owner_hist) { if (!owner_history) {
owner_hist = addOwnerHistory(); owner_history = addOwnerHistory();
} }
std::vector<typename Schema::IfcObject> related_objects = {related_object.template as<typename Schema::IfcObject>()}; std::vector<typename Schema::IfcObject> related_objects = {related_object.template as<typename Schema::IfcObject>()};
auto t = create<typename Schema::IfcRelDefinesByType>(); auto t = create<typename Schema::IfcRelDefinesByType>();
t.setGlobalId(ifcopenshell::global_id()); t.setGlobalId(ifcopenshell::global_id());
t.setOwnerHistory(owner_hist); t.setOwnerHistory(owner_history);
t.setRelatedObjects(related_objects); t.setRelatedObjects(related_objects);
t.setRelatingType(relating_object.template as<typename Schema::IfcTypeObject>()); t.setRelatingType(relating_object.template as<typename Schema::IfcTypeObject>());
} }
@@ -458,11 +458,11 @@ class IFC_PARSE_API hierarchy_helper : public ifcopenshell::file {
} }
} }
if (!found) { if (!found) {
if (!owner_hist) { if (!owner_history) {
owner_hist = getSingle<typename Schema::IfcOwnerHistory>(); owner_history = getSingle<typename Schema::IfcOwnerHistory>();
} }
if (!owner_hist) { if (!owner_history) {
owner_hist = addOwnerHistory(); owner_history = addOwnerHistory();
} }
std::vector<express::Base> related_objects; std::vector<express::Base> related_objects;
@@ -470,7 +470,7 @@ class IFC_PARSE_API hierarchy_helper : public ifcopenshell::file {
T t = create<T>(); T t = create<T>();
t.set_attribute_value(0, (std::string)ifcopenshell::global_id()); t.set_attribute_value(0, (std::string)ifcopenshell::global_id());
t.set_attribute_value(1, owner_hist); t.set_attribute_value(1, owner_history);
int relating_index = 4; int relating_index = 4;
int related_index = 5; int related_index = 5;
if (T::Class().name() == "IfcRelContainedInSpatialStructure" || std::is_base_of<typename Schema::IfcRelDefines, T>::value) { if (T::Class().name() == "IfcRelContainedInSpatialStructure" || std::is_base_of<typename Schema::IfcRelDefines, T>::value) {
@@ -484,149 +484,150 @@ class IFC_PARSE_API hierarchy_helper : public ifcopenshell::file {
} }
typename Schema::IfcOwnerHistory addOwnerHistory(); typename Schema::IfcOwnerHistory addOwnerHistory();
typename Schema::IfcProject addProject(typename Schema::IfcOwnerHistory owner_hist = typename Schema::IfcOwnerHistory{}); typename Schema::IfcProject addProject(typename Schema::IfcOwnerHistory owner_history = typename Schema::IfcOwnerHistory{});
void relatePlacements(typename Schema::IfcProduct parent, typename Schema::IfcProduct product); void relatePlacements(typename Schema::IfcProduct parent, typename Schema::IfcProduct product);
typename Schema::IfcSite addSite(typename Schema::IfcProject = typename Schema::IfcProject{}, typename Schema::IfcOwnerHistory = typename Schema::IfcOwnerHistory{}); typename Schema::IfcSite addSite(typename Schema::IfcProject project = typename Schema::IfcProject{}, typename Schema::IfcOwnerHistory owner_history = typename Schema::IfcOwnerHistory{});
typename Schema::IfcBuilding addBuilding(typename Schema::IfcSite site = typename Schema::IfcSite{}, typename Schema::IfcOwnerHistory owner_hist = typename Schema::IfcOwnerHistory{}); typename Schema::IfcBuilding addBuilding(typename Schema::IfcSite site = typename Schema::IfcSite{}, typename Schema::IfcOwnerHistory owner_history = typename Schema::IfcOwnerHistory{});
typename Schema::IfcBuildingStorey addBuildingStorey(typename Schema::IfcBuilding building = typename Schema::IfcBuilding{}, typename Schema::IfcBuildingStorey addBuildingStorey(typename Schema::IfcBuilding building = typename Schema::IfcBuilding{},
typename Schema::IfcOwnerHistory owner_hist = typename Schema::IfcOwnerHistory{}); typename Schema::IfcOwnerHistory owner_history = typename Schema::IfcOwnerHistory{});
typename Schema::IfcBuildingStorey addBuildingProduct(typename Schema::IfcProduct product, typename Schema::IfcBuildingStorey addBuildingProduct(typename Schema::IfcProduct product,
typename Schema::IfcBuildingStorey storey = typename Schema::IfcBuildingStorey{}, typename Schema::IfcBuildingStorey storey = typename Schema::IfcBuildingStorey{},
typename Schema::IfcOwnerHistory owner_hist = typename Schema::IfcOwnerHistory{}); typename Schema::IfcOwnerHistory owner_history = typename Schema::IfcOwnerHistory{});
void addExtrudedPolyline(typename Schema::IfcShapeRepresentation rep, const std::vector<std::pair<double, double>>& points, double h, typename Schema::IfcAxis2Placement2D place = typename Schema::IfcAxis2Placement2D{}, typename Schema::IfcAxis2Placement3D place2 = typename Schema::IfcAxis2Placement3D{}, typename Schema::IfcDirection dir = typename Schema::IfcDirection{}, typename Schema::IfcRepresentationContext context = typename Schema::IfcRepresentationContext{}); void addExtrudedPolyline(typename Schema::IfcShapeRepresentation representation, const std::vector<std::pair<double, double>>& points, double height, typename Schema::IfcAxis2Placement2D profile_placement = typename Schema::IfcAxis2Placement2D{}, typename Schema::IfcAxis2Placement3D extrusion_placement = typename Schema::IfcAxis2Placement3D{}, typename Schema::IfcDirection extrusion_direction = typename Schema::IfcDirection{}, typename Schema::IfcRepresentationContext context = typename Schema::IfcRepresentationContext{});
typename Schema::IfcProductDefinitionShape addExtrudedPolyline(const std::vector<std::pair<double, double>>& points, double h, typename Schema::IfcAxis2Placement2D place = typename Schema::IfcAxis2Placement2D{}, typename Schema::IfcAxis2Placement3D place2 = typename Schema::IfcAxis2Placement3D{}, typename Schema::IfcDirection dir = typename Schema::IfcDirection{}, typename Schema::IfcRepresentationContext context = typename Schema::IfcRepresentationContext{}); typename Schema::IfcProductDefinitionShape addExtrudedPolyline(const std::vector<std::pair<double, double>>& points, double height, typename Schema::IfcAxis2Placement2D profile_placement = typename Schema::IfcAxis2Placement2D{}, typename Schema::IfcAxis2Placement3D extrusion_placement = typename Schema::IfcAxis2Placement3D{}, typename Schema::IfcDirection extrusion_direction = typename Schema::IfcDirection{}, typename Schema::IfcRepresentationContext context = typename Schema::IfcRepresentationContext{});
void addBox(typename Schema::IfcShapeRepresentation rep, double w, double d, double h, typename Schema::IfcAxis2Placement2D place = typename Schema::IfcAxis2Placement2D{}, typename Schema::IfcAxis2Placement3D place2 = typename Schema::IfcAxis2Placement3D{}, typename Schema::IfcDirection dir = typename Schema::IfcDirection{}, typename Schema::IfcRepresentationContext context = typename Schema::IfcRepresentationContext{}); void addBox(typename Schema::IfcShapeRepresentation representation, double width, double depth, double height, typename Schema::IfcAxis2Placement2D profile_placement = typename Schema::IfcAxis2Placement2D{}, typename Schema::IfcAxis2Placement3D extrusion_placement = typename Schema::IfcAxis2Placement3D{}, typename Schema::IfcDirection extrusion_direction = typename Schema::IfcDirection{}, typename Schema::IfcRepresentationContext context = typename Schema::IfcRepresentationContext{});
typename Schema::IfcProductDefinitionShape addBox(double w, double d, double h, typename Schema::IfcAxis2Placement2D place = typename Schema::IfcAxis2Placement2D{}, typename Schema::IfcAxis2Placement3D place2 = typename Schema::IfcAxis2Placement3D{}, typename Schema::IfcDirection dir = typename Schema::IfcDirection{}, typename Schema::IfcRepresentationContext context = typename Schema::IfcRepresentationContext{}); typename Schema::IfcProductDefinitionShape addBox(double width, double depth, double height, typename Schema::IfcAxis2Placement2D profile_placement = typename Schema::IfcAxis2Placement2D{}, typename Schema::IfcAxis2Placement3D extrusion_placement = typename Schema::IfcAxis2Placement3D{}, typename Schema::IfcDirection extrusion_direction = typename Schema::IfcDirection{}, typename Schema::IfcRepresentationContext context = typename Schema::IfcRepresentationContext{});
void addAxis(typename Schema::IfcShapeRepresentation rep, double l, typename Schema::IfcRepresentationContext context = typename Schema::IfcRepresentationContext{}); void addAxis(typename Schema::IfcShapeRepresentation representation, double length, typename Schema::IfcRepresentationContext context = typename Schema::IfcRepresentationContext{});
typename Schema::IfcProductDefinitionShape addAxisBox(double w, double d, double h, typename Schema::IfcRepresentationContext context = typename Schema::IfcRepresentationContext{}); typename Schema::IfcProductDefinitionShape addAxisBox(double width, double depth, double height, typename Schema::IfcRepresentationContext context = typename Schema::IfcRepresentationContext{});
void clipRepresentation(typename Schema::IfcProductRepresentation shape, void clipRepresentation(typename Schema::IfcProductRepresentation representation,
typename Schema::IfcAxis2Placement3D place, typename Schema::IfcAxis2Placement3D placement,
bool agree); bool sense_agreement);
void clipRepresentation(typename Schema::IfcRepresentation shape, void clipRepresentation(typename Schema::IfcRepresentation representation,
typename Schema::IfcAxis2Placement3D place, typename Schema::IfcAxis2Placement3D placement,
bool agree); bool sense_agreement);
typename Schema::IfcProductDefinitionShape addMappedItem(typename Schema::IfcShapeRepresentation, typename Schema::IfcProductDefinitionShape addMappedItem(typename Schema::IfcShapeRepresentation source_representation,
typename Schema::IfcCartesianTransformationOperator3D transform = typename Schema::IfcCartesianTransformationOperator3D{}, typename Schema::IfcCartesianTransformationOperator3D transform = typename Schema::IfcCartesianTransformationOperator3D{},
typename Schema::IfcProductDefinitionShape def = typename Schema::IfcProductDefinitionShape{}); typename Schema::IfcProductDefinitionShape definition_shape = typename Schema::IfcProductDefinitionShape{});
typename Schema::IfcProductDefinitionShape addMappedItem(std::vector<typename Schema::IfcShapeRepresentation>&, typename Schema::IfcProductDefinitionShape addMappedItem(std::vector<typename Schema::IfcShapeRepresentation>& source_representations,
typename Schema::IfcCartesianTransformationOperator3D transform = typename Schema::IfcCartesianTransformationOperator3D{}); typename Schema::IfcCartesianTransformationOperator3D transform = typename Schema::IfcCartesianTransformationOperator3D{});
typename Schema::IfcShapeRepresentation addEmptyRepresentation(const std::string& repid = "Body", const std::string& reptype = "SweptSolid"); typename Schema::IfcShapeRepresentation addEmptyRepresentation(const std::string& representation_identifier = "Body", const std::string& representation_type = "SweptSolid");
typename Schema::IfcGeometricRepresentationContext getRepresentationContext(const std::string&); typename Schema::IfcGeometricRepresentationContext getRepresentationContext(const std::string& context_identifier);
typename Schema::IfcGeometricRepresentationSubContext getRepresentationSubContext(const std::string& ident, const std::string& type); typename Schema::IfcGeometricRepresentationSubContext getRepresentationSubContext(const std::string& context_identifier, const std::string& context_type);
private: private:
std::map<std::string, typename Schema::IfcGeometricRepresentationContext> contexts_; std::map<std::string, typename Schema::IfcGeometricRepresentationContext> contexts_;
}; };
#ifdef HAS_SCHEMA_2x3 #ifdef HAS_SCHEMA_2x3
IFC_PARSE_API Ifc2x3::IfcPresentationStyleAssignment addStyleAssignment(hierarchy_helper<Ifc2x3>& file, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc2x3::IfcPresentationStyleAssignment addStyleAssignment(hierarchy_helper<Ifc2x3>& model, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc2x3::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc2x3>& file, const Ifc2x3::IfcProductRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc2x3::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc2x3>& model, const Ifc2x3::IfcProductRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc2x3::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc2x3>& file, const Ifc2x3::IfcRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc2x3::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc2x3>& model, const Ifc2x3::IfcRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc2x3>& file, const Ifc2x3::IfcProductRepresentation& shape, const Ifc2x3::IfcPresentationStyleAssignment& style_assignment); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc2x3>& model, const Ifc2x3::IfcProductRepresentation& shape, const Ifc2x3::IfcPresentationStyleAssignment& style_assignment);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc2x3>& file, const Ifc2x3::IfcRepresentation& shape, const Ifc2x3::IfcPresentationStyleAssignment& style_assignment); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc2x3>& model, const Ifc2x3::IfcRepresentation& shape, const Ifc2x3::IfcPresentationStyleAssignment& style_assignment);
#endif #endif
#ifdef HAS_SCHEMA_4 #ifdef HAS_SCHEMA_4
IFC_PARSE_API Ifc4::IfcPresentationStyleAssignment addStyleAssignment(hierarchy_helper<Ifc4>& file, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4::IfcPresentationStyleAssignment addStyleAssignment(hierarchy_helper<Ifc4>& model, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4>& file, const Ifc4::IfcProductRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4>& model, const Ifc4::IfcProductRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4>& file, const Ifc4::IfcRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4>& model, const Ifc4::IfcRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4>& file, const Ifc4::IfcProductRepresentation& shape, const Ifc4::IfcPresentationStyleAssignment& style_assignment); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4>& model, const Ifc4::IfcProductRepresentation& shape, const Ifc4::IfcPresentationStyleAssignment& style_assignment);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4>& file, const Ifc4::IfcRepresentation& shape, const Ifc4::IfcPresentationStyleAssignment& style_assignment); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4>& model, const Ifc4::IfcRepresentation& shape, const Ifc4::IfcPresentationStyleAssignment& style_assignment);
#endif #endif
#ifdef HAS_SCHEMA_4x1 #ifdef HAS_SCHEMA_4x1
IFC_PARSE_API Ifc4x1::IfcPresentationStyleAssignment addStyleAssignment(hierarchy_helper<Ifc4x1>& file, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x1::IfcPresentationStyleAssignment addStyleAssignment(hierarchy_helper<Ifc4x1>& model, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x1::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4x1>& file, const Ifc4x1::IfcProductRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x1::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4x1>& model, const Ifc4x1::IfcProductRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x1::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4x1>& file, const Ifc4x1::IfcRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x1::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4x1>& model, const Ifc4x1::IfcRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x1>& file, const Ifc4x1::IfcProductRepresentation& shape, const Ifc4x1::IfcPresentationStyleAssignment& style_assignment); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x1>& model, const Ifc4x1::IfcProductRepresentation& shape, const Ifc4x1::IfcPresentationStyleAssignment& style_assignment);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x1>& file, const Ifc4x1::IfcRepresentation& shape, const Ifc4x1::IfcPresentationStyleAssignment& style_assignment); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x1>& model, const Ifc4x1::IfcRepresentation& shape, const Ifc4x1::IfcPresentationStyleAssignment& style_assignment);
#endif #endif
#ifdef HAS_SCHEMA_4x2 #ifdef HAS_SCHEMA_4x2
IFC_PARSE_API Ifc4x2::IfcPresentationStyleAssignment addStyleAssignment(hierarchy_helper<Ifc4x2>& file, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x2::IfcPresentationStyleAssignment addStyleAssignment(hierarchy_helper<Ifc4x2>& model, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x2::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4x2>& file, const Ifc4x2::IfcProductRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x2::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4x2>& model, const Ifc4x2::IfcProductRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x2::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4x2>& file, const Ifc4x2::IfcRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x2::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4x2>& model, const Ifc4x2::IfcRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x2>& file, const Ifc4x2::IfcProductRepresentation& shape, const Ifc4x2::IfcPresentationStyleAssignment& style_assignment); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x2>& model, const Ifc4x2::IfcProductRepresentation& shape, const Ifc4x2::IfcPresentationStyleAssignment& style_assignment);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x2>& file, const Ifc4x2::IfcRepresentation& shape, const Ifc4x2::IfcPresentationStyleAssignment& style_assignment); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x2>& model, const Ifc4x2::IfcRepresentation& shape, const Ifc4x2::IfcPresentationStyleAssignment& style_assignment);
#endif #endif
#ifdef HAS_SCHEMA_4x3_rc1 #ifdef HAS_SCHEMA_4x3_rc1
IFC_PARSE_API Ifc4x3_rc1::IfcPresentationStyleAssignment addStyleAssignment(hierarchy_helper<Ifc4x3_rc1>& file, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_rc1::IfcPresentationStyleAssignment addStyleAssignment(hierarchy_helper<Ifc4x3_rc1>& model, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x3_rc1::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4x3_rc1>& file, const Ifc4x3_rc1::IfcProductRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_rc1::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4x3_rc1>& model, const Ifc4x3_rc1::IfcProductRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x3_rc1::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4x3_rc1>& file, const Ifc4x3_rc1::IfcRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_rc1::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4x3_rc1>& model, const Ifc4x3_rc1::IfcRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_rc1>& file, const Ifc4x3_rc1::IfcProductRepresentation& shape, const Ifc4x3_rc1::IfcPresentationStyleAssignment& style_assignment); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_rc1>& model, const Ifc4x3_rc1::IfcProductRepresentation& shape, const Ifc4x3_rc1::IfcPresentationStyleAssignment& style_assignment);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_rc1>& file, const Ifc4x3_rc1::IfcRepresentation& shape, const Ifc4x3_rc1::IfcPresentationStyleAssignment& style_assignment); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_rc1>& model, const Ifc4x3_rc1::IfcRepresentation& shape, const Ifc4x3_rc1::IfcPresentationStyleAssignment& style_assignment);
#endif #endif
#ifdef HAS_SCHEMA_4x3_rc2 #ifdef HAS_SCHEMA_4x3_rc2
IFC_PARSE_API Ifc4x3_rc2::IfcPresentationStyleAssignment addStyleAssignment(hierarchy_helper<Ifc4x3_rc2>& file, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_rc2::IfcPresentationStyleAssignment addStyleAssignment(hierarchy_helper<Ifc4x3_rc2>& model, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x3_rc2::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4x3_rc2>& file, const Ifc4x3_rc2::IfcProductRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_rc2::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4x3_rc2>& model, const Ifc4x3_rc2::IfcProductRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x3_rc2::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4x3_rc2>& file, const Ifc4x3_rc2::IfcRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_rc2::IfcPresentationStyleAssignment setSurfaceColour(hierarchy_helper<Ifc4x3_rc2>& model, const Ifc4x3_rc2::IfcRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_rc2>& file, const Ifc4x3_rc2::IfcProductRepresentation& shape, const Ifc4x3_rc2::IfcPresentationStyleAssignment& style_assignment); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_rc2>& model, const Ifc4x3_rc2::IfcProductRepresentation& shape, const Ifc4x3_rc2::IfcPresentationStyleAssignment& style_assignment);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_rc2>& file, const Ifc4x3_rc2::IfcRepresentation& shape, const Ifc4x3_rc2::IfcPresentationStyleAssignment& style_assignment); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_rc2>& model, const Ifc4x3_rc2::IfcRepresentation& shape, const Ifc4x3_rc2::IfcPresentationStyleAssignment& style_assignment);
#endif #endif
#ifdef HAS_SCHEMA_4x3_rc3 #ifdef HAS_SCHEMA_4x3_rc3
IFC_PARSE_API Ifc4x3_rc3::IfcPresentationStyle addStyleAssignment(hierarchy_helper<Ifc4x3_rc3>& file, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_rc3::IfcPresentationStyle addStyleAssignment(hierarchy_helper<Ifc4x3_rc3>& model, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x3_rc3::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_rc3>& file, const Ifc4x3_rc3::IfcProductRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_rc3::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_rc3>& model, const Ifc4x3_rc3::IfcProductRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x3_rc3::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_rc3>& file, const Ifc4x3_rc3::IfcRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_rc3::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_rc3>& model, const Ifc4x3_rc3::IfcRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_rc3>& file, const Ifc4x3_rc3::IfcProductRepresentation& shape, const Ifc4x3_rc3::IfcPresentationStyle& style); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_rc3>& model, const Ifc4x3_rc3::IfcProductRepresentation& shape, const Ifc4x3_rc3::IfcPresentationStyle& style);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_rc3>& file, const Ifc4x3_rc3::IfcRepresentation& shape, const Ifc4x3_rc3::IfcPresentationStyle& style); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_rc3>& model, const Ifc4x3_rc3::IfcRepresentation& shape, const Ifc4x3_rc3::IfcPresentationStyle& style);
#endif #endif
#ifdef HAS_SCHEMA_4x3_rc4 #ifdef HAS_SCHEMA_4x3_rc4
IFC_PARSE_API Ifc4x3_rc4::IfcPresentationStyle addStyleAssignment(hierarchy_helper<Ifc4x3_rc4>& file, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_rc4::IfcPresentationStyle addStyleAssignment(hierarchy_helper<Ifc4x3_rc4>& model, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x3_rc4::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_rc4>& file, const Ifc4x3_rc4::IfcProductRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_rc4::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_rc4>& model, const Ifc4x3_rc4::IfcProductRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x3_rc4::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_rc4>& file, const Ifc4x3_rc4::IfcRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_rc4::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_rc4>& model, const Ifc4x3_rc4::IfcRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_rc4>& file, const Ifc4x3_rc4::IfcProductRepresentation& shape, const Ifc4x3_rc4::IfcPresentationStyle& style); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_rc4>& model, const Ifc4x3_rc4::IfcProductRepresentation& shape, const Ifc4x3_rc4::IfcPresentationStyle& style);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_rc4>& file, const Ifc4x3_rc4::IfcRepresentation& shape, const Ifc4x3_rc4::IfcPresentationStyle& style); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_rc4>& model, const Ifc4x3_rc4::IfcRepresentation& shape, const Ifc4x3_rc4::IfcPresentationStyle& style);
#endif #endif
#ifdef HAS_SCHEMA_4x3 #ifdef HAS_SCHEMA_4x3
IFC_PARSE_API Ifc4x3::IfcPresentationStyle addStyleAssignment(hierarchy_helper<Ifc4x3>& file, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3::IfcPresentationStyle addStyleAssignment(hierarchy_helper<Ifc4x3>& model, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x3::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3>& file, const Ifc4x3::IfcProductRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3>& model, const Ifc4x3::IfcProductRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x3::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3>& file, const Ifc4x3::IfcRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3>& model, const Ifc4x3::IfcRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3>& file, const Ifc4x3::IfcProductRepresentation& shape, const Ifc4x3::IfcPresentationStyle& style); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3>& model, const Ifc4x3::IfcProductRepresentation& shape, const Ifc4x3::IfcPresentationStyle& style);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3>& file, const Ifc4x3::IfcRepresentation& shape, const Ifc4x3::IfcPresentationStyle& style); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3>& model, const Ifc4x3::IfcRepresentation& shape, const Ifc4x3::IfcPresentationStyle& style);
#endif #endif
#ifdef HAS_SCHEMA_4x3_tc1 #ifdef HAS_SCHEMA_4x3_tc1
IFC_PARSE_API Ifc4x3_tc1::IfcPresentationStyle addStyleAssignment(hierarchy_helper<Ifc4x3_tc1>& file, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_tc1::IfcPresentationStyle addStyleAssignment(hierarchy_helper<Ifc4x3_tc1>& model, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x3_tc1::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_tc1>& file, const Ifc4x3_tc1::IfcProductRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_tc1::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_tc1>& model, const Ifc4x3_tc1::IfcProductRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x3_tc1::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_tc1>& file, const Ifc4x3_tc1::IfcRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_tc1::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_tc1>& model, const Ifc4x3_tc1::IfcRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_tc1>& file, const Ifc4x3_tc1::IfcProductRepresentation& shape, const Ifc4x3_tc1::IfcPresentationStyle& style); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_tc1>& model, const Ifc4x3_tc1::IfcProductRepresentation& shape, const Ifc4x3_tc1::IfcPresentationStyle& style);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_tc1>& file, const Ifc4x3_tc1::IfcRepresentation& shape, const Ifc4x3_tc1::IfcPresentationStyle& style); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_tc1>& model, const Ifc4x3_tc1::IfcRepresentation& shape, const Ifc4x3_tc1::IfcPresentationStyle& style);
#endif #endif
#ifdef HAS_SCHEMA_4x3_add1 #ifdef HAS_SCHEMA_4x3_add1
IFC_PARSE_API Ifc4x3_add1::IfcPresentationStyle addStyleAssignment(hierarchy_helper<Ifc4x3_add1>& file, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_add1::IfcPresentationStyle addStyleAssignment(hierarchy_helper<Ifc4x3_add1>& model, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x3_add1::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_add1>& file, const Ifc4x3_add1::IfcProductRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_add1::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_add1>& model, const Ifc4x3_add1::IfcProductRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x3_add1::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_add1>& file, const Ifc4x3_add1::IfcRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_add1::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_add1>& model, const Ifc4x3_add1::IfcRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_add1>& file, const Ifc4x3_add1::IfcProductRepresentation& shape, const Ifc4x3_add1::IfcPresentationStyle& style); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_add1>& model, const Ifc4x3_add1::IfcProductRepresentation& shape, const Ifc4x3_add1::IfcPresentationStyle& style);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_add1>& file, const Ifc4x3_add1::IfcRepresentation& shape, const Ifc4x3_add1::IfcPresentationStyle& style); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_add1>& model, const Ifc4x3_add1::IfcRepresentation& shape, const Ifc4x3_add1::IfcPresentationStyle& style);
#endif #endif
#ifdef HAS_SCHEMA_4x3_add2 #ifdef HAS_SCHEMA_4x3_add2
IFC_PARSE_API Ifc4x3_add2::IfcPresentationStyle addStyleAssignment(hierarchy_helper<Ifc4x3_add2>& file, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_add2::IfcPresentationStyle addStyleAssignment(hierarchy_helper<Ifc4x3_add2>& model, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x3_add2::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_add2>& file, const Ifc4x3_add2::IfcProductRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_add2::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_add2>& model, const Ifc4x3_add2::IfcProductRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API Ifc4x3_add2::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_add2>& file, const Ifc4x3_add2::IfcRepresentation& shape, double r, double g, double b, double a = 1.0); IFC_PARSE_API Ifc4x3_add2::IfcPresentationStyle setSurfaceColour(hierarchy_helper<Ifc4x3_add2>& model, const Ifc4x3_add2::IfcRepresentation& shape, double red, double green, double blue, double alpha = 1.0);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_add2>& file, const Ifc4x3_add2::IfcProductRepresentation& shape, const Ifc4x3_add2::IfcPresentationStyle& style); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_add2>& model, const Ifc4x3_add2::IfcProductRepresentation& shape, const Ifc4x3_add2::IfcPresentationStyle& style);
IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_add2>& file, const Ifc4x3_add2::IfcRepresentation& shape, const Ifc4x3_add2::IfcPresentationStyle& style); IFC_PARSE_API void setSurfaceColour(hierarchy_helper<Ifc4x3_add2>& model, const Ifc4x3_add2::IfcRepresentation& shape, const Ifc4x3_add2::IfcPresentationStyle& style);
#endif #endif
#endif #endif
+72 -69
View File
@@ -178,105 +178,107 @@ namespace impl {
struct is_contiguous_container<std::basic_string<CharT, Traits, Alloc>> : std::true_type {}; struct is_contiguous_container<std::basic_string<CharT, Traits, Alloc>> : std::true_type {};
template <typename T, typename std::enable_if<is_contiguous_container<T>::value && !is_contiguous_container<typename T::value_type>::value, int>::type = 0> template <typename T, typename std::enable_if<is_contiguous_container<T>::value && !is_contiguous_container<typename T::value_type>::value, int>::type = 0>
bool serialize(std::string& val, const T& t) { bool serialize(std::string& buffer, const T& value) {
auto s = sizeof(typename T::value_type) * t.size(); auto byte_count = sizeof(typename T::value_type) * value.size();
val.resize(s + 1); buffer.resize(byte_count + 1);
val[0] = TypeEncoder::encode_type<T>(); buffer[0] = TypeEncoder::encode_type<T>();
memcpy(val.data() + 1, t.data(), s); memcpy(buffer.data() + 1, value.data(), byte_count);
return true; return true;
} }
template <typename T, typename std::enable_if<is_contiguous_container<T>::value&& is_contiguous_container<typename T::value_type>::value, int>::type = 0> template <typename T, typename std::enable_if<is_contiguous_container<T>::value&& is_contiguous_container<typename T::value_type>::value, int>::type = 0>
bool serialize(std::string& val, const T& t) { bool serialize(std::string& buffer, const T& value) {
val = std::string(1, TypeEncoder::encode_type<T>()); buffer = std::string(1, TypeEncoder::encode_type<T>());
for (auto& tt : t) { for (auto& nested_value : value) {
std::string v2; std::string nested_buffer;
serialize(v2, tt); serialize(nested_buffer, nested_value);
std::string len(sizeof(size_t), 0); std::string encoded_length(sizeof(size_t), 0);
size_t s = v2.size() - 1; size_t payload_size = nested_buffer.size() - 1;
memcpy(len.data(), &s, sizeof(size_t)); memcpy(encoded_length.data(), &payload_size, sizeof(size_t));
// @todo horribly inefficient // @todo horribly inefficient
// @todo strip off type label? // @todo strip off type label?
val += len + v2.substr(1); buffer += encoded_length + nested_buffer.substr(1);
} }
return true; return true;
} }
template <typename T, typename std::enable_if<std::is_integral_v<T> || std::is_floating_point_v<T>, int>::type = 0> template <typename T, typename std::enable_if<std::is_integral_v<T> || std::is_floating_point_v<T>, int>::type = 0>
bool serialize(std::string& val, const T& t) { bool serialize(std::string& buffer, const T& value) {
val.resize(sizeof(T) + 1); buffer.resize(sizeof(T) + 1);
val[0] = TypeEncoder::encode_type<T>(); buffer[0] = TypeEncoder::encode_type<T>();
memcpy(val.data() + 1, &t, sizeof(T)); memcpy(buffer.data() + 1, &value, sizeof(T));
return true; return true;
} }
bool serialize(std::string& val, const blank& t); bool serialize(std::string& buffer, const blank& value);
bool serialize(std::string& val, const derived& t); bool serialize(std::string& buffer, const derived& value);
bool serialize(std::string& val, const empty_aggregate_t& t); bool serialize(std::string& buffer, const empty_aggregate_t& value);
bool serialize(std::string& val, const empty_aggregate_of_aggregate_t& t); bool serialize(std::string& buffer, const empty_aggregate_of_aggregate_t& value);
bool serialize(std::string& val, const boost::logic::tribool& t); bool serialize(std::string& buffer, const boost::logic::tribool& value);
bool serialize(std::string& val, const boost::dynamic_bitset<>& t); bool serialize(std::string& buffer, const boost::dynamic_bitset<>& value);
bool serialize(std::string& val, const express::Base& t); bool serialize(std::string& buffer, const express::Base& value);
bool serialize(std::string& val, const enumeration_reference& v); bool serialize(std::string& buffer, const enumeration_reference& value);
bool serialize(std::string& val, const std::vector<express::Base>& t); bool serialize(std::string& buffer, const std::vector<express::Base>& value);
bool serialize(std::string& val, const std::vector<std::vector<express::Base>>& t); bool serialize(std::string& buffer, const std::vector<std::vector<express::Base>>& value);
template <typename T, typename std::enable_if<is_contiguous_container<T>::value && !is_contiguous_container<typename T::value_type>::value, int>::type = 0> template <typename T, typename std::enable_if<is_contiguous_container<T>::value && !is_contiguous_container<typename T::value_type>::value, int>::type = 0>
bool deserialize(ifcopenshell::impl::rocks_db_file_storage*, const std::string& val, T& t, bool prefixed = true) { bool deserialize(ifcopenshell::impl::rocks_db_file_storage* storage, const std::string& buffer, T& value, bool has_type_prefix = true) {
if (prefixed && val[0] != TypeEncoder::encode_type<T>()) { static_cast<void>(storage);
if (has_type_prefix && buffer[0] != TypeEncoder::encode_type<T>()) {
return false; return false;
} }
auto s = (val.size() - (prefixed ? 1 : 0)) / sizeof(typename T::value_type); auto element_count = (buffer.size() - (has_type_prefix ? 1 : 0)) / sizeof(typename T::value_type);
t.resize(s); value.resize(element_count);
memcpy(t.data(), val.data() + (prefixed ? 1 : 0), s * sizeof(typename T::value_type)); memcpy(value.data(), buffer.data() + (has_type_prefix ? 1 : 0), element_count * sizeof(typename T::value_type));
return true; return true;
} }
template <typename T, typename std::enable_if<is_contiguous_container<T>::value && is_contiguous_container<typename T::value_type>::value, int>::type = 0> template <typename T, typename std::enable_if<is_contiguous_container<T>::value && is_contiguous_container<typename T::value_type>::value, int>::type = 0>
bool deserialize(ifcopenshell::impl::rocks_db_file_storage* storage, const std::string& val, T& t) { bool deserialize(ifcopenshell::impl::rocks_db_file_storage* storage, const std::string& buffer, T& value) {
// @todo // @todo
auto ptr = val.data(); auto ptr = buffer.data();
if (*ptr != TypeEncoder::encode_type<T>()) { if (*ptr != TypeEncoder::encode_type<T>()) {
return false; return false;
} }
ptr++; ptr++;
t.clear(); value.clear();
while (ptr < val.data() + val.size()) { while (ptr < buffer.data() + buffer.size()) {
size_t s; size_t payload_size;
memcpy(&s, ptr, sizeof(size_t)); memcpy(&payload_size, ptr, sizeof(size_t));
// @todo view // @todo view
ptr += sizeof(size_t); ptr += sizeof(size_t);
std::string part(ptr, s); std::string part(ptr, payload_size);
t.emplace_back(); value.emplace_back();
deserialize(storage, part, t.back(), false); deserialize(storage, part, value.back(), false);
ptr += s; ptr += payload_size;
} }
return true; return true;
} }
template <typename T, typename std::enable_if<std::is_integral_v<T> || std::is_floating_point_v<T>, int>::type = 0> template <typename T, typename std::enable_if<std::is_integral_v<T> || std::is_floating_point_v<T>, int>::type = 0>
bool deserialize(ifcopenshell::impl::rocks_db_file_storage*, const std::string& val, T & t) { bool deserialize(ifcopenshell::impl::rocks_db_file_storage* storage, const std::string& buffer, T& value) {
if (val[0] != TypeEncoder::encode_type<T>()) { static_cast<void>(storage);
if (buffer[0] != TypeEncoder::encode_type<T>()) {
return false; return false;
} }
memcpy(&t, val.data() + 1, sizeof(T)); memcpy(&value, buffer.data() + 1, sizeof(T));
return true; return true;
} }
bool deserialize(ifcopenshell::impl::rocks_db_file_storage*, const std::string& val, boost::logic::tribool& t); bool deserialize(ifcopenshell::impl::rocks_db_file_storage* storage, const std::string& buffer, boost::logic::tribool& value);
bool deserialize(ifcopenshell::impl::rocks_db_file_storage*, const std::string& val, boost::dynamic_bitset<>& t); bool deserialize(ifcopenshell::impl::rocks_db_file_storage* storage, const std::string& buffer, boost::dynamic_bitset<>& value);
bool deserialize(ifcopenshell::impl::rocks_db_file_storage*, const std::string& val, std::vector<express::Base>& t); bool deserialize(ifcopenshell::impl::rocks_db_file_storage* storage, const std::string& buffer, std::vector<express::Base>& value);
bool deserialize(ifcopenshell::impl::rocks_db_file_storage*, const std::string& val, std::vector<std::vector<express::Base>>& t); bool deserialize(ifcopenshell::impl::rocks_db_file_storage* storage, const std::string& buffer, std::vector<std::vector<express::Base>>& value);
} }
#endif #endif
@@ -292,8 +294,8 @@ class IFC_PARSE_API attribute_value {
union pointer_type { union pointer_type {
const in_memory_attribute_storage* storage_ptr; const in_memory_attribute_storage* storage_ptr;
ifcopenshell::impl::rocks_db_file_storage* db_ptr; ifcopenshell::impl::rocks_db_file_storage* db_ptr;
pointer_type(ifcopenshell::impl::rocks_db_file_storage* db) : db_ptr(db) {} pointer_type(ifcopenshell::impl::rocks_db_file_storage* storage) : db_ptr(storage) {}
pointer_type(const in_memory_attribute_storage* ims) : storage_ptr(ims) {} pointer_type(const in_memory_attribute_storage* storage) : storage_ptr(storage) {}
}; };
private: private:
@@ -306,18 +308,18 @@ public:
, array_((const in_memory_attribute_storage*)nullptr) , array_((const in_memory_attribute_storage*)nullptr)
{} {}
attribute_value(const in_memory_attribute_storage* arr, uint8_t index) attribute_value(const in_memory_attribute_storage* storage, uint8_t index)
: index_(index) : index_(index)
, storage_model_(0) , storage_model_(0)
, array_(arr) , array_(storage)
{} {}
attribute_value(ifcopenshell::impl::rocks_db_file_storage* db, size_t instance_name, const ifcopenshell::declaration* entity_or_type, uint8_t index) attribute_value(ifcopenshell::impl::rocks_db_file_storage* storage, size_t instance_name, const ifcopenshell::declaration* entity_or_type, uint8_t index)
: index_(index) : index_(index)
, storage_model_(1) , storage_model_(1)
, entity_or_type_(entity_or_type) , entity_or_type_(entity_or_type)
, instance_name_(instance_name) , instance_name_(instance_name)
, array_(db) , array_(storage)
{} {}
operator int() const; operator int() const;
@@ -400,7 +402,7 @@ public:
#ifdef IFOPSH_WITH_ROCKSDB #ifdef IFOPSH_WITH_ROCKSDB
// @todo void* is obviously very ugly here // @todo void* is obviously very ugly here
template<typename T> template<typename T>
IFC_PARSE_API void set(void* storage, const ifcopenshell::declaration*, std::size_t identity, std::size_t index, const T& value); IFC_PARSE_API void set(void* storage, const ifcopenshell::declaration* declaration, std::size_t identity, std::size_t index, const T& value);
template<typename T> template<typename T>
IFC_PARSE_API bool has(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, std::size_t index) const; IFC_PARSE_API bool has(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, std::size_t index) const;
@@ -448,9 +450,10 @@ class IFC_PARSE_API instance_data {
populate_derived_(); populate_derived_();
} }
instance_data(ifcopenshell::file* file, const ifcopenshell::declaration* declaration, uint32_t id, rocks_db_attribute_storage&&) instance_data(ifcopenshell::file* file, const ifcopenshell::declaration* declaration, uint32_t id, rocks_db_attribute_storage&& storage)
: file_(file), declaration_(declaration), identity_(counter_++), id_(id), storage_(nullptr) : file_(file), declaration_(declaration), identity_(counter_++), id_(id), storage_(nullptr)
{ {
static_cast<void>(storage);
populate_derived_(); populate_derived_();
} }
@@ -462,9 +465,9 @@ class IFC_PARSE_API instance_data {
*/ */
// No copy-constructor/-assignment anymore because we need the instance for storage model context // No copy-constructor/-assignment anymore because we need the instance for storage model context
instance_data(const instance_data&) = delete; instance_data(const instance_data& other) = delete;
instance_data& operator=(const instance_data&) = delete; instance_data& operator=(const instance_data& other) = delete;
instance_data& operator=(instance_data&&) = delete; instance_data& operator=(instance_data&& other) = delete;
instance_data(instance_data&& other) noexcept = delete; instance_data(instance_data&& other) noexcept = delete;
/* /*
@@ -482,33 +485,33 @@ class IFC_PARSE_API instance_data {
delete storage_; delete storage_;
} }
attribute_value get_attribute_value(size_t index) const; attribute_value get_attribute_value(size_t attribute_index) const;
template<typename T> template<typename T>
void set_attribute_value(std::size_t index, T&& value) { void set_attribute_value(std::size_t attribute_index, T&& value) {
if (storage_) { if (storage_) {
storage_->set(index, value); storage_->set(attribute_index, value);
} }
#ifdef IFOPSH_WITH_ROCKSDB #ifdef IFOPSH_WITH_ROCKSDB
else { else {
rocks_db_attribute_storage{}.set(get_storage_of_type<ifcopenshell::impl::rocks_db_file_storage>(), declaration_, identity_, index, value); rocks_db_attribute_storage{}.set(get_storage_of_type<ifcopenshell::impl::rocks_db_file_storage>(), declaration_, identity_, attribute_index, value);
} }
#endif #endif
} }
template<typename T> template<typename T>
bool has_attribute_value(std::size_t index) const { bool has_attribute_value(std::size_t attribute_index) const {
if (storage_) { if (storage_) {
return storage_->has<T>(index); return storage_->has<T>(attribute_index);
} }
#ifdef IFOPSH_WITH_ROCKSDB #ifdef IFOPSH_WITH_ROCKSDB
else { else {
return rocks_db_attribute_storage{}.has<T>(get_storage_of_type<ifcopenshell::impl::rocks_db_file_storage>(), declaration_, identity_, index); return rocks_db_attribute_storage{}.has<T>(get_storage_of_type<ifcopenshell::impl::rocks_db_file_storage>(), declaration_, identity_, attribute_index);
} }
#endif #endif
} }
void to_string(std::ostream&, bool upper = false) const; void to_string(std::ostream& stream, bool uppercase = false) const;
}; };
#endif #endif
+7 -7
View File
@@ -69,10 +69,10 @@ class IFC_PARSE_API logger {
static void set_product(std::optional<const express::Base> product); static void set_product(std::optional<const express::Base> product);
/// Determines to what stream respectively progress and errors are logged /// Determines to what stream respectively progress and errors are logged
static void set_output(std::wostream* stream1, std::wostream* stream2); static void set_output(std::wostream* progress_stream, std::wostream* error_stream);
/// Determines to what stream respectively progress and errors are logged /// Determines to what stream respectively progress and errors are logged
static void set_output(std::ostream* stream1, std::ostream* stream2); static void set_output(std::ostream* progress_stream, std::ostream* error_stream);
/// Determines the types of log messages to get logged /// Determines the types of log messages to get logged
static void verbosity(Severity severity); static void verbosity(Severity severity);
@@ -84,8 +84,8 @@ class IFC_PARSE_API logger {
static Format output_format(); static Format output_format();
/// Log a message to the output stream /// Log a message to the output stream
static void message(Severity type, const std::string& text, const express::Base& instance = express::Base()); static void message(Severity severity, const std::string& text, const express::Base& instance = express::Base());
static void message(Severity type, const std::exception& exception, const express::Base& instance = express::Base()); static void message(Severity severity, const std::exception& exception, const express::Base& instance = express::Base());
static void notice(const std::string& text, const express::Base& instance = express::Base()) { logger::message(LOG_NOTICE, text, instance); } static void notice(const std::string& text, const express::Base& instance = express::Base()) { logger::message(LOG_NOTICE, text, instance); }
static void warning(const std::string& text, const express::Base& instance = express::Base()) { logger::message(LOG_WARNING, text, instance); } static void warning(const std::string& text, const express::Base& instance = express::Base()) { logger::message(LOG_WARNING, text, instance); }
@@ -95,12 +95,12 @@ class IFC_PARSE_API logger {
static void warning(const std::exception& exception, const express::Base& instance = express::Base()) { message(LOG_WARNING, exception, instance); } static void warning(const std::exception& exception, const express::Base& instance = express::Base()) { message(LOG_WARNING, exception, instance); }
static void error(const std::exception& exception, const express::Base& instance = express::Base()) { message(LOG_ERROR, exception, instance); } static void error(const std::exception& exception, const express::Base& instance = express::Base()) { message(LOG_ERROR, exception, instance); }
static void status(const std::string& message, bool new_line = true); static void status(const std::string& message, bool append_newline = true);
static void progress_bar(int progress); static void progress_bar(int progress_percent);
static std::string get_log(); static std::string get_log();
static void print_performance_stats(); static void print_performance_stats();
static void print_performance_stats_on_element(bool b) { print_perf_stats_on_element_ = b; } static void print_performance_stats_on_element(bool enabled) { print_perf_stats_on_element_ = enabled; }
}; };
#define PERF(x) \ #define PERF(x) \
+11 -11
View File
@@ -47,14 +47,14 @@ public:
// read-only constructor with TransformBack=void // read-only constructor with TransformBack=void
template <typename TB = TransformBack, template <typename TB = TransformBack,
typename std::enable_if<std::is_void<TB>::value, int>::type = 0> typename std::enable_if<std::is_void<TB>::value, int>::type = 0>
map_transformer(BaseMap* map, Transform transform) map_transformer(BaseMap* base_map, Transform transform)
: base_map_(map), transform_(std::move(transform)), transform_back_{} {} : base_map_(base_map), transform_(std::move(transform)), transform_back_{} {}
// read-write constructor with TransformBack provided // read-write constructor with TransformBack provided
template <typename TB = TransformBack, template <typename TB = TransformBack,
typename std::enable_if<!std::is_void<TB>::value, int>::type = 0> typename std::enable_if<!std::is_void<TB>::value, int>::type = 0>
map_transformer(BaseMap* map, Transform transform, TB transform_back) map_transformer(BaseMap* base_map, Transform transform, TB transform_back)
: base_map_(map), transform_(std::move(transform)), transform_back_(std::move(transform_back)) {} : base_map_(base_map), transform_(std::move(transform)), transform_back_(std::move(transform_back)) {}
class iterator { class iterator {
public: public:
@@ -73,8 +73,8 @@ public:
public: public:
iterator() : base_it_(), transform_ptr_(nullptr) {} iterator() : base_it_(), transform_ptr_(nullptr) {}
iterator(base_iterator base_it, Transform* transform_ptr) iterator(base_iterator base_iterator, Transform* transform)
: base_it_(base_it), transform_ptr_(transform_ptr) {} : base_it_(base_iterator), transform_ptr_(transform) {}
// On dereference, return a pair where the key is unchanged and the mapped value // On dereference, return a pair where the key is unchanged and the mapped value
// is the result of applying the transform to the underlying mapped value. // is the result of applying the transform to the underlying mapped value.
@@ -118,15 +118,15 @@ public:
return iterator(base_map_->end(), &transform_); return iterator(base_map_->end(), &transform_);
} }
iterator find(const key_type& k) { iterator find(const key_type& key) {
return iterator(base_map_->find(k), &transform_); return iterator(base_map_->find(key), &transform_);
} }
// @todo still not sure if this is a good idea, do we want to insert into the transformed map? // @todo still not sure if this is a good idea, do we want to insert into the transformed map?
std::pair<iterator, bool> insert(const value_type& val) { std::pair<iterator, bool> insert(const value_type& value) {
static_assert(!read_only, "insert() requires TransformBack"); static_assert(!read_only, "insert() requires TransformBack");
auto p = base_map_->insert({ val.first, transform_back_(val.second) }); auto result = base_map_->insert({ value.first, transform_back_(value.second) });
return { iterator(p.first, &transform_), p.second }; return { iterator(result.first, &transform_), result.second };
} }
size_t erase(const key_type& key) { size_t erase(const key_type& key) {
+6 -6
View File
@@ -58,8 +58,8 @@ public:
iterator() = default; iterator() = default;
explicit iterator(underlying_iterator_variant v) explicit iterator(underlying_iterator_variant iterator_variant)
: it_var(std::move(v)) {} : it_var(std::move(iterator_variant)) {}
iterator(const iterator& other) iterator(const iterator& other)
: it_var(other.it_var), cached_value_ptr_(nullptr) {} : it_var(other.it_var), cached_value_ptr_(nullptr) {}
@@ -107,7 +107,7 @@ public:
variant_map() {} variant_map() {}
template <typename MapT> template <typename MapT>
variant_map(MapT* m) : map_(m) {} variant_map(MapT* map) : map_(map) {}
iterator begin() const{ iterator begin() const{
return std::visit([](auto m) -> iterator { return std::visit([](auto m) -> iterator {
@@ -160,11 +160,11 @@ public:
}, map_); }, map_);
} }
std::pair<iterator, bool> insert(const value_type& val) { std::pair<iterator, bool> insert(const value_type& value) {
return std::visit([this, &val](auto m) -> std::pair<iterator, bool> { return std::visit([this, &value](auto m) -> std::pair<iterator, bool> {
// @todo is monostate still necessary here? // @todo is monostate still necessary here?
if constexpr (!std::is_same_v<std::decay_t<decltype(m)>, std::monostate>) { if constexpr (!std::is_same_v<std::decay_t<decltype(m)>, std::monostate>) {
auto result = m->insert(val); auto result = m->insert(value);
return { iterator(result.first), result.second }; return { iterator(result.first), result.second };
} else { } else {
return { end(), false }; return { end(), false };
+3 -3
View File
@@ -77,11 +77,11 @@ class IFC_PARSE_API spf_lexer {
// void TokenString(size_t offset, std::string& result); // void TokenString(size_t offset, std::string& result);
}; };
IFC_PARSE_API std::vector<express::Base> traverse(const express::Base& instance, int max_level = -1); IFC_PARSE_API std::vector<express::Base> traverse(const express::Base& instance, int max_depth = -1);
IFC_PARSE_API std::vector<express::Base> traverse_breadth_first(const express::Base& instance, int max_level = -1); IFC_PARSE_API std::vector<express::Base> traverse_breadth_first(const express::Base& instance, int max_depth = -1);
} // namespace ifcopenshell } // namespace ifcopenshell
IFC_PARSE_API std::ostream& operator<<(std::ostream& out, const ifcopenshell::file& file); IFC_PARSE_API std::ostream& operator<<(std::ostream& stream, const ifcopenshell::file& file);
#endif #endif
+48 -46
View File
@@ -46,60 +46,60 @@ struct DefaultCodec;
// Specialization for size_t. // Specialization for size_t.
template <> template <>
struct DefaultCodec<size_t> { struct DefaultCodec<size_t> {
std::string encode(const size_t& v) const { std::string encode(const size_t& value) const {
std::string s(sizeof(v), 0); std::string encoded(sizeof(value), 0);
memcpy(s.data(), &v, sizeof(v)); memcpy(encoded.data(), &value, sizeof(value));
return s; return encoded;
} }
size_t decode(const std::string& s) const { size_t decode(const std::string& encoded) const {
size_t v = 0; size_t value = 0;
// @todo take min of sizeof(v), len(s) // @todo take min of sizeof(value), len(encoded)
// @todo unify all serialization primitives // @todo unify all serialization primitives
memcpy(&v, s.data(), sizeof(v)); memcpy(&value, encoded.data(), sizeof(value));
return v; return value;
} }
}; };
// Specialization for uint32_t. // Specialization for uint32_t.
template <> template <>
struct DefaultCodec<uint32_t> { struct DefaultCodec<uint32_t> {
std::string encode(const uint32_t& v) const { std::string encode(const uint32_t& value) const {
std::string s(sizeof(v), 0); std::string encoded(sizeof(value), 0);
memcpy(s.data(), &v, sizeof(v)); memcpy(encoded.data(), &value, sizeof(value));
return s; return encoded;
} }
uint32_t decode(const std::string& s) const { uint32_t decode(const std::string& encoded) const {
uint32_t v = 0; uint32_t value = 0;
// @todo take min of sizeof(v), len(s) // @todo take min of sizeof(value), len(encoded)
// @todo unify all serialization primitives // @todo unify all serialization primitives
memcpy(&v, s.data(), sizeof(v)); memcpy(&value, encoded.data(), sizeof(value));
return v; return value;
} }
}; };
// Specialization for std::vector<int>. // Specialization for std::vector<int>.
template <> template <>
struct DefaultCodec<std::vector<uint32_t>> { struct DefaultCodec<std::vector<uint32_t>> {
std::string encode(const std::vector<uint32_t>& vs) const { std::string encode(const std::vector<uint32_t>& values) const {
std::string s(sizeof(uint32_t) * vs.size(), 0); std::string encoded(sizeof(uint32_t) * values.size(), 0);
memcpy(s.data(), vs.data(), s.size()); memcpy(encoded.data(), values.data(), encoded.size());
return s; return encoded;
} }
std::vector<uint32_t> decode(const std::string& s) const { std::vector<uint32_t> decode(const std::string& encoded) const {
std::vector<uint32_t> vs(s.size() / sizeof(uint32_t), 0); std::vector<uint32_t> values(encoded.size() / sizeof(uint32_t), 0);
memcpy(vs.data(), s.data(), s.size()); memcpy(values.data(), encoded.data(), encoded.size());
return vs; return values;
} }
}; };
// Specialization for std::string (identity) // Specialization for std::string (identity)
template <> template <>
struct DefaultCodec<std::string> { struct DefaultCodec<std::string> {
std::string encode(const std::string& v) const { std::string encode(const std::string& value) const {
return v; return value;
} }
std::string decode(const std::string& s) const { std::string decode(const std::string& encoded) const {
return s; return encoded;
} }
}; };
@@ -114,22 +114,23 @@ std::string key_to_string(const KeyT& key) {
// Convert from a string to a key. For non-string types, we assume numeric keys. // Convert from a string to a key. For non-string types, we assume numeric keys.
template <typename KeyT, typename std::enable_if<!is_std_tuple<KeyT>::value, int>::type = 0> template <typename KeyT, typename std::enable_if<!is_std_tuple<KeyT>::value, int>::type = 0>
KeyT key_from_string(const std::string& s) { KeyT key_from_string(const std::string& key_string) {
// @todo tuples // @todo tuples
if constexpr (std::is_same_v<KeyT, std::string>) { if constexpr (std::is_same_v<KeyT, std::string>) {
return s; return key_string;
} else if constexpr (std::is_integral_v<KeyT>) { } else if constexpr (std::is_integral_v<KeyT>) {
return static_cast<KeyT>(std::stoll(s)); return static_cast<KeyT>(std::stoll(key_string));
} else { } else {
static_assert(sizeof(KeyT) == 0, "key_from_string not implemented for this type"); static_assert(sizeof(KeyT) == 0, "key_from_string not implemented for this type");
} }
} }
template<typename Tuple, std::size_t... Is> template<typename Tuple, std::size_t... Is>
std::string tuple_to_string_impl(const Tuple& t, std::index_sequence<Is...>) { std::string tuple_to_string_impl(const Tuple& tuple_value, std::index_sequence<Is...> indices) {
static_cast<void>(indices);
std::ostringstream oss; std::ostringstream oss;
// Unpack the tuple; add a pipe before each element except the first. // Unpack the tuple; add a pipe before each element except the first.
((oss << (Is == 0 ? "" : "|") << std::to_string(std::get<Is>(t))), ...); ((oss << (Is == 0 ? "" : "|") << std::to_string(std::get<Is>(tuple_value))), ...);
return oss.str(); return oss.str();
} }
@@ -152,14 +153,15 @@ T convert_string(const std::string& token) {
// Helper: Build a tuple from a vector of string tokens. // Helper: Build a tuple from a vector of string tokens.
template <typename TupleT, std::size_t... Is> template <typename TupleT, std::size_t... Is>
TupleT tuple_from_string_impl(const std::vector<std::string>& tokens, std::index_sequence<Is...>) { TupleT tuple_from_string_impl(const std::vector<std::string>& tokens, std::index_sequence<Is...> indices) {
static_cast<void>(indices);
return std::make_tuple(convert_string<std::tuple_element_t<Is, TupleT>>(tokens[Is])...); return std::make_tuple(convert_string<std::tuple_element_t<Is, TupleT>>(tokens[Is])...);
} }
template <typename TupleT, typename std::enable_if<is_std_tuple<TupleT>::value, int>::type = 0> template <typename TupleT, typename std::enable_if<is_std_tuple<TupleT>::value, int>::type = 0>
TupleT key_from_string(const std::string& s) { TupleT key_from_string(const std::string& key_string) {
std::vector<std::string> tokens; std::vector<std::string> tokens;
std::istringstream iss(s); std::istringstream iss(key_string);
std::string token; std::string token;
while (std::getline(iss, token, '|')) { while (std::getline(iss, token, '|')) {
tokens.push_back(token); tokens.push_back(token);
@@ -216,8 +218,8 @@ public:
iterator() : db_(nullptr), prefix_(), codec_(Codec{}), it_(nullptr) {} iterator() : db_(nullptr), prefix_(), codec_(Codec{}), it_(nullptr) {}
iterator(rocksdb::DB* db, const std::string& prefix, iterator(rocksdb::DB* db, const std::string& prefix,
std::unique_ptr<rocksdb::Iterator> iter, Codec codec = Codec{}) std::unique_ptr<rocksdb::Iterator> iterator, Codec codec = Codec{})
: db_(db), prefix_(prefix), codec_(codec), it_(std::move(iter)) : db_(db), prefix_(prefix), codec_(codec), it_(std::move(iterator))
{ {
check_valid(); check_valid();
} }
@@ -341,24 +343,24 @@ public:
#endif #endif
} }
std::pair<iterator, bool> insert(const value_type& val) { std::pair<iterator, bool> insert(const value_type& value) {
#ifdef IFOPSH_WITH_ROCKSDB #ifdef IFOPSH_WITH_ROCKSDB
std::string key_str = key_to_string(val.first); std::string key_str = key_to_string(value.first);
std::string full_key = prefix_ + key_str; std::string full_key = prefix_ + key_str;
std::string existing; std::string existing;
rocksdb::Status s = db_->Get(rocksdb::ReadOptions{}, full_key, &existing); rocksdb::Status s = db_->Get(rocksdb::ReadOptions{}, full_key, &existing);
if (s.ok()) { if (s.ok()) {
// Key already exists. // Key already exists.
return { find(val.first), false }; return { find(value.first), false };
} }
std::string encoded = codec_.encode(val.second); std::string encoded = codec_.encode(value.second);
s = db_->Put(rocksdb::WriteOptions{}, full_key, encoded); s = db_->Put(rocksdb::WriteOptions{}, full_key, encoded);
if (!s.ok()) { if (!s.ok()) {
return { end(), false }; return { end(), false };
} }
#endif #endif
return { find(val.first), true }; return { find(value.first), true };
} }
}; };
#endif #endif
+4 -3
View File
@@ -89,8 +89,8 @@ public:
iterator() : db_(nullptr), prefix_(), it_(nullptr) {} iterator() : db_(nullptr), prefix_(), it_(nullptr) {}
iterator(rocksdb::DB* db, const std::string& prefix, iterator(rocksdb::DB* db, const std::string& prefix,
std::unique_ptr<rocksdb::Iterator> iter) std::unique_ptr<rocksdb::Iterator> iterator)
: db_(db), prefix_(prefix), it_(std::move(iter)) : db_(db), prefix_(prefix), it_(std::move(iterator))
{ {
check_valid(); check_valid();
} }
@@ -214,9 +214,10 @@ public:
} }
size_t erase(const key_type& key) { size_t erase(const key_type& key) {
static_cast<void>(key);
// @todo // @todo
return 0; return 0;
} }
}; };
#endif #endif
+22 -22
View File
@@ -56,8 +56,8 @@ class IFC_PARSE_API parameter_type {
virtual const simple_type* as_simple_type() const { return static_cast<simple_type*>(0); } virtual const simple_type* as_simple_type() const { return static_cast<simple_type*>(0); }
virtual const aggregation_type* as_aggregation_type() const { return static_cast<aggregation_type*>(0); } virtual const aggregation_type* as_aggregation_type() const { return static_cast<aggregation_type*>(0); }
virtual bool is(const std::string& /*name*/) const { return false; } virtual bool is(const std::string& /*type_name*/) const { return false; }
virtual bool is(const ifcopenshell::declaration& /*decl*/) const { return false; } virtual bool is(const ifcopenshell::declaration& /*declaration*/) const { return false; }
}; };
class IFC_PARSE_API named_type : public parameter_type { class IFC_PARSE_API named_type : public parameter_type {
@@ -221,14 +221,14 @@ class IFC_PARSE_API enumeration_type : public declaration {
return enumeration_items_[i].c_str(); return enumeration_items_[i].c_str();
} }
size_t lookup_enum_offset(const std::string& string) const { size_t lookup_enum_offset(const std::string& value_name) const {
size_t index = 0; size_t index = 0;
for (auto it = enumeration_items_.begin(); it != enumeration_items_.end(); ++it, ++index) { for (auto it = enumeration_items_.begin(); it != enumeration_items_.end(); ++it, ++index) {
if (string == *it) { if (value_name == *it) {
return index; return index;
} }
} }
throw ifcopenshell::exception("Unable to find keyword in schema: " + string); throw ifcopenshell::exception("Unable to find keyword in schema: " + value_name);
} }
virtual const enumeration_type* as_enumeration_type() const { return this; } virtual const enumeration_type* as_enumeration_type() const { return this; }
@@ -308,23 +308,23 @@ class IFC_PARSE_API entity : public declaration {
std::string name_; std::string name_;
public: public:
attribute_by_name_cmp(const std::string name) attribute_by_name_cmp(const std::string attribute_name)
: name_(name) {} : name_(attribute_name) {}
bool operator()(const attribute* attr) { bool operator()(const attribute* attribute_definition) {
return attr->name() == name_; return attribute_definition->name() == name_;
} }
}; };
const attribute* attribute_by_index_(size_t& index) const { const attribute* attribute_by_index_(size_t& attribute_index) const {
const attribute* attr = 0; const attribute* attr = 0;
if (supertype_ != nullptr) { if (supertype_ != nullptr) {
attr = supertype_->attribute_by_index_(index); attr = supertype_->attribute_by_index_(attribute_index);
} }
if (attr == 0) { if (attr == 0) {
if (index < attributes_.size()) { if (attribute_index < attributes_.size()) {
attr = attributes_[index]; attr = attributes_[attribute_index];
} }
index -= attributes_.size(); attribute_index -= attributes_.size();
} }
return attr; return attr;
} }
@@ -395,7 +395,7 @@ class IFC_PARSE_API entity : public declaration {
return super_count + attributes_.size(); return super_count + attributes_.size();
} }
ptrdiff_t attribute_index(const attribute* attr) const { ptrdiff_t attribute_index(const attribute* attribute_definition) const {
const entity* current = this; const entity* current = this;
ptrdiff_t index = -1; ptrdiff_t index = -1;
do { do {
@@ -403,7 +403,7 @@ class IFC_PARSE_API entity : public declaration {
index += current->attributes().size(); index += current->attributes().size();
} else { } else {
std::vector<const attribute*>::const_iterator iter; std::vector<const attribute*>::const_iterator iter;
iter = std::find(current->attributes().begin(), current->attributes().end(), attr); iter = std::find(current->attributes().begin(), current->attributes().end(), attribute_definition);
if (iter != current->attributes().end()) { if (iter != current->attributes().end()) {
index = std::distance(current->attributes().begin(), iter); index = std::distance(current->attributes().begin(), iter);
} }
@@ -448,8 +448,8 @@ class IFC_PARSE_API schema_definition {
class declaration_by_name_cmp { class declaration_by_name_cmp {
public: public:
bool operator()(const declaration* decl, const std::string& name) { bool operator()(const declaration* declaration, const std::string& name) {
return decl->name_uc() < name; return declaration->name_uc() < name;
} }
}; };
@@ -484,8 +484,8 @@ class IFC_PARSE_API schema_definition {
return *iter; return *iter;
} }
const declaration* declaration_by_name(size_t name) const { const declaration* declaration_by_name(size_t declaration_index) const {
return declarations_.at(name); return declarations_.at(declaration_index);
} }
const std::vector<const declaration*>& declarations() const { return declarations_; } const std::vector<const declaration*>& declarations() const { return declarations_; }
@@ -497,11 +497,11 @@ class IFC_PARSE_API schema_definition {
const std::string& name() const { return name_; } const std::string& name() const { return name_; }
}; };
IFC_PARSE_API const schema_definition* schema_by_name(const std::string&); IFC_PARSE_API const schema_definition* schema_by_name(const std::string& schema_name);
IFC_PARSE_API std::vector<std::string> schema_names(); IFC_PARSE_API std::vector<std::string> schema_names();
IFC_PARSE_API void register_schema(schema_definition*); IFC_PARSE_API void register_schema(schema_definition* schema);
IFC_PARSE_API void clear_schemas(); IFC_PARSE_API void clear_schemas();
} // namespace ifcopenshell } // namespace ifcopenshell
+9 -8
View File
@@ -38,8 +38,8 @@ private:
Transform transform_; Transform transform_;
public: public:
set_to_map_transformer(BaseSet* map, Transform transform) set_to_map_transformer(BaseSet* base_set, Transform transform)
: base_map_(map), transform_(transform) {} : base_map_(base_set), transform_(transform) {}
class iterator { class iterator {
public: public:
@@ -58,8 +58,8 @@ public:
public: public:
iterator() : base_it_(), transform_ptr_(nullptr) {} iterator() : base_it_(), transform_ptr_(nullptr) {}
iterator(base_iterator base_it, Transform* transform_ptr) iterator(base_iterator base_iterator, Transform* transform)
: base_it_(base_it), transform_ptr_(transform_ptr) {} : base_it_(base_iterator), transform_ptr_(transform) {}
// On dereference, return a pair where the key is the set value and the mapped value // On dereference, return a pair where the key is the set value and the mapped value
// is the result of applying the transform to the underlying value. // is the result of applying the transform to the underlying value.
@@ -102,12 +102,13 @@ public:
return iterator(base_map_->end(), &transform_); return iterator(base_map_->end(), &transform_);
} }
iterator find(const key_type& k) { iterator find(const key_type& key) {
return iterator(base_map_->find(k), &transform_); return iterator(base_map_->find(key), &transform_);
} }
size_t erase(const key_type&) { size_t erase(const key_type& key) {
static_cast<void>(key);
// @todo // @todo
return 0; return 0;
} }
}; };
+1 -1
View File
@@ -28,7 +28,7 @@ namespace ifcopenshell {
IFC_PARSE_API double si_prefix_to_value(const std::string& prefix); IFC_PARSE_API double si_prefix_to_value(const std::string& prefix);
template <typename Schema> template <typename Schema>
IFC_PARSE_API double get_SI_equivalent(const typename Schema::IfcNamedUnit&); IFC_PARSE_API double get_SI_equivalent(const typename Schema::IfcNamedUnit& unit);
} // namespace ifcopenshell } // namespace ifcopenshell
#endif #endif
+6 -6
View File
@@ -35,17 +35,17 @@ class IFC_PARSE_API spf_header {
std::array<std::shared_ptr<instance_data>, 3> header_entities_; std::array<std::shared_ptr<instance_data>, 3> header_entities_;
public: public:
explicit spf_header(ifcopenshell::file* file); explicit spf_header(ifcopenshell::file* owner_file);
~spf_header(); ~spf_header();
void write(std::ostream& out) const; void write(std::ostream& stream) const;
ifcopenshell::file* file() { return file_; } ifcopenshell::file* file() { return file_; }
void file(ifcopenshell::file* file); void file(ifcopenshell::file* owner_file);
void set_file_description(const std::shared_ptr<instance_data>& data); void set_file_description(const std::shared_ptr<instance_data>& description_data);
void set_file_name(const std::shared_ptr<instance_data>& data); void set_file_name(const std::shared_ptr<instance_data>& name_data);
void set_file_schema(const std::shared_ptr<instance_data>& data); void set_file_schema(const std::shared_ptr<instance_data>& schema_data);
const Header_section_schema::file_description file_description() const; const Header_section_schema::file_description file_description() const;
const Header_section_schema::file_name file_name() const; const Header_section_schema::file_name file_name() const;
+42 -42
View File
@@ -57,7 +57,7 @@ public:
// Construct from any one of the underlying iterator types. // Construct from any one of the underlying iterator types.
template <typename Iterator> template <typename Iterator>
variant_iterator(Iterator it) : it_(it) {} variant_iterator(Iterator iterator) : it_(iterator) {}
// Dereference operator. // Dereference operator.
decltype(auto) operator*() const { decltype(auto) operator*() const {
@@ -161,20 +161,20 @@ namespace ifcopenshell {
token() : start_pos(0), token() : start_pos(0),
type(Token_NONE) {} type(Token_NONE) {}
token(size_t start, token_type ty, const std::string& str) token(size_t start_position, token_type token_kind, const std::string& string_value)
: start_pos(start), type(ty), value_string(&str) {} : start_pos(start_position), type(token_kind), value_string(&string_value) {}
token(size_t start, token_type ty, int i) token(size_t start_position, token_type token_kind, int integer_value)
: start_pos(start), type(ty), value_int(i) {} : start_pos(start_position), type(token_kind), value_int(integer_value) {}
token(size_t start, double d) token(size_t start_position, double floating_value)
: start_pos(start), type(Token_FLOAT), value_double(d) {} : start_pos(start_position), type(Token_FLOAT), value_double(floating_value) {}
token(size_t start, char op) token(size_t start_position, char operator_character)
: start_pos(start), type(Token_OPERATOR), value_char(op) {} : start_pos(start_position), type(Token_OPERATOR), value_char(operator_character) {}
token(size_t start, token_type ty, char c) token(size_t start_position, token_type token_kind, char character_value)
: start_pos(start), type(ty), value_char(c) {} : start_pos(start_position), type(token_kind), value_char(character_value) {}
bool is_string(); bool is_string();
bool is_identifier(); bool is_identifier();
@@ -234,19 +234,19 @@ namespace ifcopenshell {
}; };
~parse_context(); ~parse_context();
parse_context(const parse_context&) = delete; parse_context(const parse_context& other) = delete;
parse_context& operator=(const parse_context&) = delete; parse_context& operator=(const parse_context& other) = delete;
parse_context(parse_context&&) = default; parse_context(parse_context&& other) = default;
parse_context& operator=(parse_context&&) = default; parse_context& operator=(parse_context&& other) = default;
parse_context& push(); parse_context& push();
void push(token t); void push(token next_token);
void push(const express::Base& inst); void push(const express::Base& instance);
std::shared_ptr<instance_data> construct(ifcopenshell::file* owner, std::optional<size_t> name, unresolved_references& references_to_resolve, const ifcopenshell::declaration* decl, std::optional<size_t> expected_size, int resolve_reference_index, bool coerce_attribute_count=true); std::shared_ptr<instance_data> construct(ifcopenshell::file* owner_file, std::optional<size_t> instance_name, unresolved_references& references_to_resolve, const ifcopenshell::declaration* declaration, std::optional<size_t> expected_size, int resolve_reference_index, bool coerce_attribute_count = true);
}; };
struct parse_context_pool { struct parse_context_pool {
@@ -310,9 +310,9 @@ namespace ifcopenshell {
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(ifcopenshell::file* f = nullptr) : file(f), schema(nullptr), byid_read_(&byid_, [this](const std::shared_ptr<instance_data>& d) { return express::Base(d); }) {}; in_memory_file_storage(ifcopenshell::file* owner_file = nullptr) : file(owner_file), schema(nullptr), byid_read_(&byid_, [this](const std::shared_ptr<instance_data>& data) { return express::Base(data); }) {};
in_memory_file_storage(const in_memory_file_storage&) = delete; in_memory_file_storage(const in_memory_file_storage& other) = delete;
in_memory_file_storage(const in_memory_file_storage&&) = 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_t::const_iterator {
@@ -325,8 +325,8 @@ namespace ifcopenshell {
type_iterator() : entities_by_type_t::const_iterator() {}; type_iterator() : entities_by_type_t::const_iterator() {};
type_iterator(const entities_by_type_t::const_iterator& iter) type_iterator(const entities_by_type_t::const_iterator& iterator)
: entities_by_type_t::const_iterator(iter) {}; : entities_by_type_t::const_iterator(iterator) {};
entities_by_type_t::key_type const* operator->() const { entities_by_type_t::key_type const* operator->() const {
return &entities_by_type_t::const_iterator::operator->()->first; return &entities_by_type_t::const_iterator::operator->()->first;
@@ -356,19 +356,19 @@ namespace ifcopenshell {
entity_instance_by_name_t byid_read_; entity_instance_by_name_t byid_read_;
template <typename Reader> template <typename Reader>
void load(ifcopenshell::spf_lexer<Reader>* tokens, std::optional<size_t> entity_instance_name, const ifcopenshell::entity* entity, parse_context&, int attribute_index = -1); void load(ifcopenshell::spf_lexer<Reader>* tokens, std::optional<size_t> entity_instance_name, const ifcopenshell::entity* entity, parse_context& context, int attribute_index = -1);
template <typename Reader> template <typename Reader>
void try_read_semicolon(ifcopenshell::spf_lexer<Reader>* tokens) const; void try_read_semicolon(ifcopenshell::spf_lexer<Reader>* tokens) const;
void register_inverse(unsigned, const ifcopenshell::entity* from_entity, int inst_id, int attribute_index); void register_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, int instance_id, int attribute_index);
void unregister_inverse(unsigned, const ifcopenshell::entity* from_entity, const express::Base&, int attribute_index); void unregister_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, const express::Base& entity, int attribute_index);
template <typename Reader> template <typename Reader>
void read_from_stream(Reader* stream, const ifcopenshell::schema_definition*& schema, unsigned int& max_id, const std::set<std::string>& typed_to_bypass); void read_from_stream(Reader* stream, const ifcopenshell::schema_definition*& schema, unsigned int& max_id, const std::set<std::string>& types_to_bypass);
file_open_status good_ = file_open_status::SUCCESS; file_open_status good_ = file_open_status::SUCCESS;
express::Base instance_by_id(int id); express::Base instance_by_id(int instance_id);
void add_type_ref(const express::Base& new_entity) { void add_type_ref(const express::Base& new_entity) {
if (auto* ty = new_entity.declaration().as_entity()) { if (auto* ty = new_entity.declaration().as_entity()) {
@@ -387,12 +387,12 @@ namespace ifcopenshell {
} }
} }
void process_deletion_inverse(const express::Base& inst); void process_deletion_inverse(const express::Base& entity);
template <typename T> template <typename T>
T create(int id=-1); T create(int instance_id = -1);
express::Base create(const ifcopenshell::declaration* decl, int id=-1); express::Base create(const ifcopenshell::declaration* declaration, int instance_id = -1);
}; };
class IFC_PARSE_API rocks_db_file_storage { class IFC_PARSE_API rocks_db_file_storage {
@@ -449,12 +449,12 @@ namespace ifcopenshell {
entities_by_ref_t byref_excl_; entities_by_ref_t byref_excl_;
// @todo naming // @todo naming
rocks_db_file_storage(const std::string& filepath, ifcopenshell::file* file, bool readonly=false); rocks_db_file_storage(const std::string& path, ifcopenshell::file* owner_file, bool read_only = false);
~rocks_db_file_storage(); ~rocks_db_file_storage();
bool read_schema(const ifcopenshell::schema_definition*& schema); bool read_schema(const ifcopenshell::schema_definition*& schema);
express::Base assert_existance(size_t instanceId, instance_ref r); express::Base assert_existance(size_t instance_id, instance_ref reference_type);
// @todo merge iterators (template?) // @todo merge iterators (template?)
class IFC_PARSE_API rocksdb_types_iterator { class IFC_PARSE_API rocksdb_types_iterator {
@@ -492,11 +492,11 @@ namespace ifcopenshell {
{ {
} }
rocksdb_types_iterator(const rocks_db_file_storage* fs) rocksdb_types_iterator(const rocks_db_file_storage* storage)
: storage_(fs) : storage_(storage)
{ {
#ifdef IFOPSH_WITH_ROCKSDB #ifdef IFOPSH_WITH_ROCKSDB
state_ = fs->db->NewIterator(rocksdb::ReadOptions()); state_ = storage->db->NewIterator(rocksdb::ReadOptions());
state_->Seek(prefix_); state_->Seek(prefix_);
if (!state_->Valid() || !state_->key().starts_with(prefix_)) { if (!state_->Valid() || !state_->key().starts_with(prefix_)) {
delete state_; delete state_;
@@ -555,21 +555,21 @@ namespace ifcopenshell {
// @todo rocksdb_instance_iterator? // @todo rocksdb_instance_iterator?
using const_iterator = entity_instance_by_name_t::iterator; using const_iterator = entity_instance_by_name_t::iterator;
void register_inverse(unsigned, const ifcopenshell::entity* from_entity, int inst_id, int attribute_index); void register_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, int instance_id, int attribute_index);
void unregister_inverse(unsigned, const ifcopenshell::entity* from_entity, const express::Base&, int attribute_index); void unregister_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, const express::Base& entity, int attribute_index);
// @todo a bit hard as a map because of value_type being an aggregate // @todo a bit hard as a map because of value_type being an aggregate
void add_type_ref(const express::Base& new_entity); void add_type_ref(const express::Base& new_entity);
void remove_type_ref(const express::Base& new_entity); void remove_type_ref(const express::Base& new_entity);
express::Base instance_by_id(int id); express::Base instance_by_id(int instance_id);
void process_deletion_inverse(const express::Base& inst); void process_deletion_inverse(const express::Base& entity);
template <typename T> template <typename T>
T create(int id=-1); T create(int instance_id = -1);
express::Base create(const ifcopenshell::declaration* decl, int id=-1); express::Base create(const ifcopenshell::declaration* declaration, int instance_id = -1);
}; };
} }
} }
+6 -6
View File
@@ -27,10 +27,10 @@
namespace ifcopenshell { namespace ifcopenshell {
/// Replaces spaces and potentially other problem causing characters with underscores. /// Replaces spaces and potentially other problem causing characters with underscores.
IFC_PARSE_API void sanitate_material_name(std::string& str); IFC_PARSE_API void sanitate_material_name(std::string& material_name);
IFC_PARSE_API void escape_xml(std::string& str); IFC_PARSE_API void escape_xml(std::string& text);
IFC_PARSE_API void unescape_xml(std::string& str); IFC_PARSE_API void unescape_xml(std::string& text);
namespace path { namespace path {
@@ -43,13 +43,13 @@ IFC_PARSE_API bool rename_file(const std::string& old_filename, const std::strin
IFC_PARSE_API std::string to_utf8(const std::wstring& str); IFC_PARSE_API std::string to_utf8(const std::wstring& str);
/// Uses windows.h string conversion functions /// Uses windows.h string conversion functions
IFC_PARSE_API std::wstring from_utf8(const std::string& str); IFC_PARSE_API std::wstring from_utf8(const std::string& value);
#else #else
/// Identity operation /// Identity operation
IFC_PARSE_API inline std::string to_utf8(const std::string& str) { return str; } IFC_PARSE_API inline std::string to_utf8(const std::string& value) { return value; }
/// Identity operation /// Identity operation
IFC_PARSE_API inline std::string from_utf8(const std::string& str) { return str; } IFC_PARSE_API inline std::string from_utf8(const std::string& value) { return value; }
#endif #endif
} // namespace path } // namespace path
+19 -15
View File
@@ -153,9 +153,9 @@ public:
return *this; return *this;
} }
variant_array(const variant_array&) = delete; variant_array(const variant_array& other) = delete;
variant_array(const variant_array&&) = delete; variant_array(const variant_array&& other) = delete;
variant_array& operator= (const variant_array&) = delete; variant_array& operator= (const variant_array& other) = delete;
template<typename T, typename = std::enable_if_t<!std::is_same_v<std::decay_t<T>, variant_array>>> template<typename T, typename = std::enable_if_t<!std::is_same_v<std::decay_t<T>, variant_array>>>
void set(std::size_t index, T&& value) { void set(std::size_t index, T&& value) {
@@ -284,23 +284,27 @@ private:
} }
} }
void destroy_type_at_index(std::size_t, std::integral_constant<std::size_t, 0>) {} void destroy_type_at_index(std::size_t index, std::integral_constant<std::size_t, 0>) {
static_cast<void>(index);
}
template<typename Visitor, std::size_t Index> template<typename Visitor, std::size_t Index>
auto apply_visitor_impl(Visitor&& visitor, std::size_t idx, std::integral_constant<std::size_t, Index>) const { auto apply_visitor_impl(Visitor&& visitor, std::size_t index, std::integral_constant<std::size_t, Index>) const {
if (size_and_indices_[idx + 1] == Index - 1) { if (size_and_indices_[index + 1] == Index - 1) {
using T = typename std::tuple_element_t<Index - 1, ::impl::MapTypes_t<Types...>>; using T = typename std::tuple_element_t<Index - 1, ::impl::MapTypes_t<Types...>>;
if constexpr (::impl::is_unique_ptr<T>::value) { if constexpr (::impl::is_unique_ptr<T>::value) {
return visitor(**reinterpret_cast<T*>(&storage_[idx])); return visitor(**reinterpret_cast<T*>(&storage_[index]));
} else { } else {
return visitor(*reinterpret_cast<T*>(&storage_[idx])); return visitor(*reinterpret_cast<T*>(&storage_[index]));
} }
} }
return apply_visitor_impl(std::forward<Visitor>(visitor), idx, std::integral_constant<std::size_t, Index - 1>{}); return apply_visitor_impl(std::forward<Visitor>(visitor), index, std::integral_constant<std::size_t, Index - 1>{});
} }
template<typename Visitor> template<typename Visitor>
auto apply_visitor_impl(Visitor&&, std::size_t, std::integral_constant<std::size_t, 0>) const { auto apply_visitor_impl(Visitor&& visitor, std::size_t index, std::integral_constant<std::size_t, 0>) const {
static_cast<void>(visitor);
static_cast<void>(index);
throw std::runtime_error("Invalid variant 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::MapTypes_t<Types...>> &>()))>) { if constexpr (!std::is_void_v<decltype(std::declval<Visitor>()(std::declval<typename std::tuple_element_t<0, ::impl::MapTypes_t<Types...>> &>()))>) {
return decltype(std::declval<Visitor>()(std::declval<typename std::tuple_element_t<0, ::impl::MapTypes_t<Types...>> &>())){}; return decltype(std::declval<Visitor>()(std::declval<typename std::tuple_element_t<0, ::impl::MapTypes_t<Types...>> &>())){};
@@ -308,20 +312,20 @@ private:
} }
template <size_t I> template <size_t I>
const char* get_type_name_impl(size_t i) const { const char* get_type_name_impl(size_t type_index) const {
if constexpr (I == 0) { if constexpr (I == 0) {
return ""; return "";
} else { } else {
if (i == I - 1) { if (type_index == I - 1) {
return typeid(std::tuple_element_t<I - 1, std::tuple<Types...>>).name(); return typeid(std::tuple_element_t<I - 1, std::tuple<Types...>>).name();
} else { } else {
return get_type_name_impl<I - 1>(i); return get_type_name_impl<I - 1>(type_index);
} }
} }
} }
const char* get_type_name(size_t i) const { const char* get_type_name(size_t type_index) const {
return get_type_name_impl<sizeof...(Types)>(i); return get_type_name_impl<sizeof...(Types)>(type_index);
} }
}; };