More logger changes

This commit is contained in:
Thomas Krijnen
2026-06-11 21:04:44 +02:00
parent 0c993d3292
commit 347a3c80bb
28 changed files with 418 additions and 284 deletions
+16 -12
View File
@@ -27,6 +27,7 @@
#include "storage.h"
#include "file_open_status.h"
#include <functional>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/random_access_index.hpp>
#include <boost/multi_index/sequenced_index.hpp>
@@ -96,6 +97,7 @@ private:
const IfcParse::schema_definition* schema_;
IfcParse::impl::in_memory_file_storage storage_;
IfcParse::file_open_status good_ = IfcParse::file_open_status::SUCCESS;
std::reference_wrapper<Logger> logger_;
int progress_;
IfcParse::unresolved_references references_to_resolve_;
int yielded_header_instances_ = 0;
@@ -144,13 +146,13 @@ private:
void pushPage(const std::string& page);
InstanceStreamer();
InstanceStreamer(Logger& logger = Logger::Root());
InstanceStreamer(const std::string& fn, bool mmap=false);
InstanceStreamer(const std::string& fn, bool mmap=false, Logger& logger = Logger::Root());
InstanceStreamer(void* data, int length);
InstanceStreamer(void* data, int length, Logger& logger = Logger::Root());
InstanceStreamer(const IfcParse::schema_definition* schema, IfcParse::IfcSpfLexer* lexer);
InstanceStreamer(const IfcParse::schema_definition* schema, IfcParse::IfcSpfLexer* lexer, Logger& logger = Logger::Root());
void bypassTypes(const std::set<std::string>& type_names);
@@ -199,6 +201,7 @@ public:
private:
file_open_status good_ = file_open_status::SUCCESS;
std::reference_wrapper<Logger> logger_;
const IfcParse::schema_definition* schema_;
const IfcParse::declaration* ifcroot_type_;
@@ -229,7 +232,7 @@ public:
/// </summary>
/// <param name="path">UTF-8 file path to an IFC-SPF file</param>
/// <param name="mmap">Whether to use memory-mapped I/O</param>
IfcFile(const std::string& path, bool mmap);
IfcFile(const std::string& path, bool mmap, Logger& logger = Logger::Root());
#endif
/// <summary>
/// Constructs an IfcFile object from a file path, supports IFC-SPF and the IfcOpenShell-specific RocksDB format.
@@ -237,23 +240,23 @@ public:
/// <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="readonly">Whether to open in read-only mode, only supported on RocksDB databases</param>
IfcFile(const std::string& path, filetype ty=FT_AUTODETECT, bool readonly=false);
IfcFile(const std::string& path, filetype ty=FT_AUTODETECT, bool readonly=false, Logger& logger = Logger::Root());
/// <summary>
/// Constructs an IfcFile object from a stream containing IFC-SPF data.
/// </summary>
IfcFile(std::istream& stream, int length);
IfcFile(std::istream& stream, int length, Logger& logger = Logger::Root());
/// <summary>
/// Constructs an IfcFile object from a memory buffer containing IFC-SPF data.
/// </summary>
IfcFile(void* data, int length);
IfcFile(void* data, int length, Logger& logger = Logger::Root());
/// <summary>
/// Constructs an IfcFile object from a given IFC SPF stream.
/// </summary>
/// <param name="stream">A pointer to an IfcParse::FileReader object representing the input IFC SPF data stream.</param>
IfcFile(IfcParse::FileReader* stream);
IfcFile(IfcParse::FileReader* stream, Logger& logger = Logger::Root());
/// <summary>
/// Constructs an IfcFile object with the specified schema, file type, and file path.
@@ -262,12 +265,12 @@ public:
/// <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="path">The file system path to the IFC file. Defaults to an empty string.</param>
IfcFile(const IfcParse::schema_definition* schema = IfcParse::schema_by_name("IFC4"), filetype ty = FT_AUTODETECT, const std::string& path = "");
IfcFile(const IfcParse::schema_definition* schema = IfcParse::schema_by_name("IFC4"), filetype ty = FT_AUTODETECT, const std::string& path = "", Logger& logger = Logger::Root());
/// <summary>
/// Constructs an unitialized IfcFile object. Call initialize() later on. Allows to specify which types to bypass during load.
/// </summary>
IfcFile(const uninitialized_tag&);
IfcFile(const uninitialized_tag&, Logger& logger = Logger::Root());
bool initialize(const std::string& path, filetype ty = FT_AUTODETECT, bool readonly = false);
#ifdef USE_MMAP
@@ -281,6 +284,7 @@ public:
~IfcFile();
IfcParse::file_open_status good() const { return good_; }
Logger& logger() const { return logger_.get(); }
/// Returns the first entity in the range of instances contained in the model,
/// in arbitrary order
@@ -443,7 +447,7 @@ public:
};
#ifdef WITH_IFCXML
IFC_PARSE_API IfcFile* parse_ifcxml(const std::string& filename);
IFC_PARSE_API IfcFile* parse_ifcxml(const std::string& filename, Logger& logger = Logger::Root());
#endif
namespace impl {