Replace Boost shared pointers

Generated with the assistance of an AI coding tool.
This commit is contained in:
Thomas Krijnen
2026-08-08 15:37:53 +02:00
parent 4e49b640a7
commit 8c003110fe
34 changed files with 110 additions and 105 deletions
+3 -3
View File
@@ -23,15 +23,15 @@
#ifdef IFOPSH_WITH_ROCKSDB
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
namespace {
boost::shared_ptr<ifcopenshell::geom::serializer> create_serializer(const ifcopenshell::serializers::document_serializer_context& context) {
std::shared_ptr<ifcopenshell::geom::serializer> create_serializer(const ifcopenshell::serializers::document_serializer_context& context) {
if (context.input_filename.empty()) {
throw ifcopenshell::exception("RocksDB document serializer requires an input filename");
}
return boost::make_shared<RocksDbSerializer>(context.input_filename, context.output_filename, context.skip_supertypes);
return std::make_shared<RocksDbSerializer>(context.input_filename, context.output_filename, context.skip_supertypes);
}
}
@@ -125,7 +125,7 @@ const ifcopenshell::serializers::document_serializer_info* ifcopenshell::seriali
return entry ? &entry->info_ : nullptr;
}
boost::shared_ptr<ifcopenshell::geom::serializer> ifcopenshell::serializers::document_serializer_registry::create(const std::string& format, const document_serializer_context& context) const {
std::shared_ptr<ifcopenshell::geom::serializer> ifcopenshell::serializers::document_serializer_registry::create(const std::string& format, const document_serializer_context& context) const {
const auto schema_name = !context.schema_name.empty() ? context.schema_name :
(context.file ? context.file->schema()->name() : std::string());
auto* registry = const_cast<document_serializer_registry*>(this);
+3 -3
View File
@@ -26,7 +26,7 @@
#include "../plugin/plugin.h"
#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <filesystem>
#include <map>
@@ -64,11 +64,11 @@ struct SERIALIZERS_API document_serializer_context {
class SERIALIZERS_API document_serializer_registry {
public:
typedef boost::function<boost::shared_ptr<serializer>(const document_serializer_context&)> create_fn;
typedef boost::function<std::shared_ptr<serializer>(const document_serializer_context&)> create_fn;
void bind(const document_serializer_info& info, create_fn create, const ifcopenshell::plugin::module& module = ifcopenshell::plugin::module());
const document_serializer_info* find(const std::string& format, const std::string& schema_name = std::string()) const;
boost::shared_ptr<serializer> create(const std::string& format, const document_serializer_context& context) const;
std::shared_ptr<serializer> create(const std::string& format, const document_serializer_context& context) const;
std::vector<document_serializer_info> serializers() const;
private:
+3 -3
View File
@@ -23,7 +23,7 @@
#include "geometry_serializer_plugin.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
namespace ifcopenshell {
namespace serializers {
@@ -37,8 +37,8 @@ plugin::metadata plugin_metadata() {
return geometry_serializer_plugin_metadata("dae");
}
boost::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
return boost::make_shared<collada_serializer>(context.output_temp_filename, context.settings);
std::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
return std::make_shared<collada_serializer>(context.output_temp_filename, context.settings);
}
void register_plugin(geometry_serializer_registry& registry, const plugin::module& module) {
+3 -3
View File
@@ -23,7 +23,7 @@
#include "gltf_serializer.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
namespace ifcopenshell {
namespace serializers {
@@ -37,8 +37,8 @@ plugin::metadata plugin_metadata() {
return geometry_serializer_plugin_metadata("glb");
}
boost::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
return boost::make_shared<gltf_serializer>(context.output_temp_filename, context.settings);
std::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
return std::make_shared<gltf_serializer>(context.output_temp_filename, context.settings);
}
void register_plugin(geometry_serializer_registry& registry, const plugin::module& module) {
+3 -3
View File
@@ -23,7 +23,7 @@
#include "iges_serializer.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
#include <Standard_Version.hxx>
@@ -43,11 +43,11 @@ plugin::metadata plugin_metadata() {
return geometry_serializer_plugin_metadata("igs");
}
boost::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
std::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
#if OCC_VERSION_HEX < 0x60900
IGESControl_Controller::Init();
#endif
return boost::make_shared<iges_serializer>(context.output_temp_filename, context.settings);
return std::make_shared<iges_serializer>(context.output_temp_filename, context.settings);
}
void configure_serializer(geometry_serializer_context& context) {
+4 -4
View File
@@ -23,7 +23,7 @@
#include "../ifcparse/utils.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
#include <filesystem>
@@ -49,7 +49,7 @@ plugin::metadata plugin_metadata() {
return geometry_serializer_plugin_metadata("obj");
}
boost::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
std::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
if (context.output_temp_stream || context.output_stream) {
stream_or_filename obj_filename = context.output_temp_stream
? *context.output_temp_stream
@@ -57,10 +57,10 @@ boost::shared_ptr<geometry_serializer> create_serializer(const geometry_serializ
stream_or_filename mtl_filename = context.output_stream
? *context.output_stream
: stream_or_filename(obj_mtl_filename(context.output_filename));
return boost::make_shared<wavefront_obj_serializer>(
return std::make_shared<wavefront_obj_serializer>(
obj_filename, mtl_filename, context.settings);
}
return boost::make_shared<wavefront_obj_serializer>(context.output_temp_filename, obj_mtl_filename(context.output_filename), context.settings);
return std::make_shared<wavefront_obj_serializer>(context.output_temp_filename, obj_mtl_filename(context.output_filename), context.settings);
}
void configure_serializer(geometry_serializer_context& context) {
@@ -130,7 +130,7 @@ void ifcopenshell::serializers::geometry_serializer_registry::configure(const st
}
}
boost::shared_ptr<ifcopenshell::geom::geometry_serializer> ifcopenshell::serializers::geometry_serializer_registry::create(const std::string& extension, const geometry_serializer_context& context) const {
std::shared_ptr<ifcopenshell::geom::geometry_serializer> ifcopenshell::serializers::geometry_serializer_registry::create(const std::string& extension, const geometry_serializer_context& context) const {
const auto key = geometry_serializer_key(extension);
if (entries_.find(key) == entries_.end()) {
load_geometry_serializer_plugin(const_cast<geometry_serializer_registry&>(*this), extension);
+3 -3
View File
@@ -25,7 +25,7 @@
#include "../plugin/plugin.h"
#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <filesystem>
#include <map>
@@ -61,14 +61,14 @@ struct SERIALIZERS_API geometry_serializer_context {
class SERIALIZERS_API geometry_serializer_registry {
public:
typedef boost::function<boost::shared_ptr<geometry_serializer>(const geometry_serializer_context&)> create_fn;
typedef boost::function<std::shared_ptr<geometry_serializer>(const geometry_serializer_context&)> create_fn;
typedef boost::function<void(geometry_serializer_context&)> configure_fn;
void bind(const geometry_serializer_info& info, create_fn create, configure_fn configure = configure_fn(), const ifcopenshell::plugin::module& module = ifcopenshell::plugin::module());
bool has(const std::string& extension) const;
const geometry_serializer_info* find(const std::string& extension) const;
void configure(const std::string& extension, geometry_serializer_context& context) const;
boost::shared_ptr<geometry_serializer> create(const std::string& extension, const geometry_serializer_context& context) const;
std::shared_ptr<geometry_serializer> create(const std::string& extension, const geometry_serializer_context& context) const;
std::vector<geometry_serializer_info> serializers() const;
private:
+3 -3
View File
@@ -23,7 +23,7 @@
#include "step_serializer.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
namespace ifcopenshell {
namespace serializers {
@@ -37,8 +37,8 @@ plugin::metadata plugin_metadata() {
return geometry_serializer_plugin_metadata("stp");
}
boost::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
return boost::make_shared<step_serializer>(context.output_temp_filename, context.settings);
std::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
return std::make_shared<step_serializer>(context.output_temp_filename, context.settings);
}
void configure_serializer(geometry_serializer_context& context) {
+4 -4
View File
@@ -23,7 +23,7 @@
#include "svg_serializer.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
namespace ifcopenshell {
namespace serializers {
@@ -37,12 +37,12 @@ plugin::metadata plugin_metadata() {
return geometry_serializer_plugin_metadata("svg");
}
boost::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
std::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
if (context.output_temp_stream) {
return boost::make_shared<svg_serializer>(
return std::make_shared<svg_serializer>(
*context.output_temp_stream, context.settings);
}
return boost::make_shared<svg_serializer>(context.output_temp_filename, context.settings);
return std::make_shared<svg_serializer>(context.output_temp_filename, context.settings);
}
void configure_serializer(geometry_serializer_context& context) {
+4 -4
View File
@@ -21,7 +21,7 @@
#include "ttl_wkt_serializer.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
namespace ifcopenshell {
namespace serializers {
@@ -35,12 +35,12 @@ plugin::metadata plugin_metadata() {
return geometry_serializer_plugin_metadata("ttl");
}
boost::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
std::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
if (context.output_temp_stream) {
return boost::make_shared<ttl_wkt_serializer>(
return std::make_shared<ttl_wkt_serializer>(
*context.output_temp_stream, context.settings);
}
return boost::make_shared<ttl_wkt_serializer>(context.output_temp_filename, context.settings);
return std::make_shared<ttl_wkt_serializer>(context.output_temp_filename, context.settings);
}
void configure_serializer(geometry_serializer_context& context) {
+3 -3
View File
@@ -23,7 +23,7 @@
#include "usd_serializer.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
namespace ifcopenshell {
namespace serializers {
@@ -37,8 +37,8 @@ plugin::metadata plugin_metadata() {
return geometry_serializer_plugin_metadata("usd");
}
boost::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
return boost::make_shared<usd_serializer>(context.output_filename, context.settings);
std::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
return std::make_shared<usd_serializer>(context.output_filename, context.settings);
}
void register_plugin(geometry_serializer_registry& registry, const plugin::module& module) {
+2 -2
View File
@@ -9,7 +9,7 @@
#include "../serializers/serializers_api.h"
#include "../serializers/document_serializer_plugin.h"
#include <boost/shared_ptr.hpp>
#include <memory>
class json_serializer : public ifcopenshell::geom::serializer {
public:
@@ -17,7 +17,7 @@ class json_serializer : public ifcopenshell::geom::serializer {
JSON_DIALECT_CREOOX
};
private:
boost::shared_ptr<ifcopenshell::geom::serializer> implementation_;
std::shared_ptr<ifcopenshell::geom::serializer> implementation_;
protected:
std::string json_filename;
@@ -25,12 +25,12 @@
#include "../../ifcparse/macros.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
namespace {
boost::shared_ptr<ifcopenshell::geom::serializer> create_serializer(const ifcopenshell::serializers::document_serializer_context& context) {
return boost::make_shared<POSTFIX_SCHEMA(json_serializer)>(
std::shared_ptr<ifcopenshell::geom::serializer> create_serializer(const ifcopenshell::serializers::document_serializer_context& context) {
return std::make_shared<POSTFIX_SCHEMA(json_serializer)>(
context.file,
context.output_filename,
static_cast<json_serializer::Dialect>(context.dialect));
@@ -23,12 +23,12 @@
#include "../../ifcparse/macros.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
namespace {
boost::shared_ptr<ifcopenshell::geom::serializer> create_serializer(const ifcopenshell::serializers::document_serializer_context& context) {
return boost::make_shared<POSTFIX_SCHEMA(xml_serializer)>(context.file, context.output_filename);
std::shared_ptr<ifcopenshell::geom::serializer> create_serializer(const ifcopenshell::serializers::document_serializer_context& context) {
return std::make_shared<POSTFIX_SCHEMA(xml_serializer)>(context.file, context.output_filename);
}
}
+4 -4
View File
@@ -557,7 +557,7 @@ typedef prefiltered_hlr hlr_engine;
class SERIALIZERS_API svg_serializer : public ifcopenshell::geom::write_only_geometry_serializer {
public:
typedef std::pair<std::string, std::vector<util::string_buffer> > path_object;
typedef std::vector< boost::shared_ptr<util::string_buffer::float_item> > float_item_list;
typedef std::vector< std::shared_ptr<util::string_buffer::float_item> > float_item_list;
enum storey_height_display_types {
SH_NONE, SH_FULL, SH_LEFT
};
@@ -668,9 +668,9 @@ public:
{
apply_settings();
}
void addXCoordinate(const boost::shared_ptr<util::string_buffer::float_item>& fi) { xcoords.push_back(fi); }
void addYCoordinate(const boost::shared_ptr<util::string_buffer::float_item>& fi) { ycoords.push_back(fi); }
void addSizeComponent(const boost::shared_ptr<util::string_buffer::float_item>& fi) { radii.push_back(fi); }
void addXCoordinate(const std::shared_ptr<util::string_buffer::float_item>& fi) { xcoords.push_back(fi); }
void addYCoordinate(const std::shared_ptr<util::string_buffer::float_item>& fi) { ycoords.push_back(fi); }
void addSizeComponent(const std::shared_ptr<util::string_buffer::float_item>& fi) { radii.push_back(fi); }
void growBoundingBox(double x, double y) { if (x < xmin) xmin = x; if (x > xmax) xmax = x; if (y < ymin) ymin = y; if (y > ymax) ymax = y; }
void writeHeader();
void doWriteHeader();
+5 -5
View File
@@ -24,19 +24,19 @@
using namespace util;
boost::shared_ptr<string_buffer::string_item> string_buffer::add(const std::string& s) {
boost::shared_ptr<string_item> i = boost::shared_ptr<string_item>(new string_item(s));
std::shared_ptr<string_buffer::string_item> string_buffer::add(const std::string& s) {
auto i = std::make_shared<string_item>(s);
items.push_back(i);
return i;
}
boost::shared_ptr<string_buffer::float_item> string_buffer::add(const double& d) {
boost::shared_ptr<float_item> i = boost::shared_ptr<float_item>(new float_item(d));
std::shared_ptr<string_buffer::float_item> string_buffer::add(const double& d) {
auto i = std::make_shared<float_item>(d);
items.push_back(i);
return i;
}
std::string string_buffer::str() const {
std::stringstream ss;
for (std::vector< boost::shared_ptr<item> >::const_iterator it = items.begin(); it != items.end(); ++it) {
for (std::vector< std::shared_ptr<item> >::const_iterator it = items.begin(); it != items.end(); ++it) {
ss << (**it).str();
}
return ss.str();
+5 -5
View File
@@ -25,7 +25,7 @@
#include <iomanip>
#include <limits>
#include <boost/shared_ptr.hpp>
#include <memory>
namespace util {
class string_buffer {
@@ -56,12 +56,12 @@ namespace util {
virtual ~float_item() {};
};
private:
std::vector< boost::shared_ptr<item> > items;
std::vector< std::shared_ptr<item> > items;
void clear();
void assign(const std::vector< boost::shared_ptr<item> >& other);
void assign(const std::vector< std::shared_ptr<item> >& other);
public:
boost::shared_ptr<string_item> add(const std::string& s);
boost::shared_ptr<float_item> add(const double& d);
std::shared_ptr<string_item> add(const std::string& s);
std::shared_ptr<float_item> add(const double& d);
bool empty() const { return items.empty(); }
std::string str() const;
};
+2 -2
View File
@@ -9,11 +9,11 @@
#include "../plugin/plugin.h"
#include "../serializers/document_serializer_plugin.h"
#include <boost/shared_ptr.hpp>
#include <memory>
class xml_serializer : public ifcopenshell::geom::serializer {
private:
boost::shared_ptr<ifcopenshell::geom::serializer> implementation_;
std::shared_ptr<ifcopenshell::geom::serializer> implementation_;
protected:
std::string xml_filename;