mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 21:53:40 +00:00
Use boost::shared_ptr
Fixes https://github.com/IfcOpenShell/IfcOpenShell/issues/17
This commit is contained in:
@@ -294,7 +294,7 @@ void SvgSerializer::finalize() {
|
|||||||
const double cx = xmin * sc;
|
const double cx = xmin * sc;
|
||||||
const double cy = ymin * sc;
|
const double cy = ymin * sc;
|
||||||
|
|
||||||
{std::vector< SHARED_PTR<util::string_buffer::float_item> >::const_iterator it;
|
{std::vector< boost::shared_ptr<util::string_buffer::float_item> >::const_iterator it;
|
||||||
for (it = xcoords.begin(); it != xcoords.end(); ++it) {
|
for (it = xcoords.begin(); it != xcoords.end(); ++it) {
|
||||||
double& v = (*it)->value();
|
double& v = (*it)->value();
|
||||||
v = v * sc - cx;
|
v = v * sc - cx;
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ protected:
|
|||||||
boost::optional<double> section_height;
|
boost::optional<double> section_height;
|
||||||
bool rescale;
|
bool rescale;
|
||||||
std::multimap<IfcSchema::IfcBuildingStorey*, path_object> paths;
|
std::multimap<IfcSchema::IfcBuildingStorey*, path_object> paths;
|
||||||
std::vector< SHARED_PTR<util::string_buffer::float_item> > xcoords;
|
std::vector< boost::shared_ptr<util::string_buffer::float_item> > xcoords;
|
||||||
std::vector< SHARED_PTR<util::string_buffer::float_item> > ycoords;
|
std::vector< boost::shared_ptr<util::string_buffer::float_item> > ycoords;
|
||||||
std::vector< SHARED_PTR<util::string_buffer::float_item> > radii;
|
std::vector< boost::shared_ptr<util::string_buffer::float_item> > radii;
|
||||||
IfcParse::IfcFile* file;
|
IfcParse::IfcFile* file;
|
||||||
public:
|
public:
|
||||||
explicit SvgSerializer(const std::string& out_filename)
|
explicit SvgSerializer(const std::string& out_filename)
|
||||||
@@ -55,9 +55,9 @@ public:
|
|||||||
, rescale(false)
|
, rescale(false)
|
||||||
, file(0)
|
, file(0)
|
||||||
{}
|
{}
|
||||||
virtual void addXCoordinate(const SHARED_PTR<util::string_buffer::float_item>& fi) { xcoords.push_back(fi); }
|
virtual void addXCoordinate(const boost::shared_ptr<util::string_buffer::float_item>& fi) { xcoords.push_back(fi); }
|
||||||
virtual void addYCoordinate(const SHARED_PTR<util::string_buffer::float_item>& fi) { ycoords.push_back(fi); }
|
virtual void addYCoordinate(const boost::shared_ptr<util::string_buffer::float_item>& fi) { ycoords.push_back(fi); }
|
||||||
virtual void addSizeComponent(const SHARED_PTR<util::string_buffer::float_item>& fi) { radii.push_back(fi); }
|
virtual void addSizeComponent(const boost::shared_ptr<util::string_buffer::float_item>& fi) { radii.push_back(fi); }
|
||||||
virtual 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; }
|
virtual 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; }
|
||||||
virtual ~SvgSerializer() {}
|
virtual ~SvgSerializer() {}
|
||||||
virtual void writeHeader();
|
virtual void writeHeader();
|
||||||
|
|||||||
@@ -24,19 +24,19 @@
|
|||||||
|
|
||||||
using namespace util;
|
using namespace util;
|
||||||
|
|
||||||
SHARED_PTR<string_buffer::string_item> string_buffer::add(const std::string& s) {
|
boost::shared_ptr<string_buffer::string_item> string_buffer::add(const std::string& s) {
|
||||||
SHARED_PTR<string_item> i = SHARED_PTR<string_item>(new string_item(s));
|
boost::shared_ptr<string_item> i = boost::shared_ptr<string_item>(new string_item(s));
|
||||||
items.push_back(i);
|
items.push_back(i);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
SHARED_PTR<string_buffer::float_item> string_buffer::add(const double& d) {
|
boost::shared_ptr<string_buffer::float_item> string_buffer::add(const double& d) {
|
||||||
SHARED_PTR<float_item> i = SHARED_PTR<float_item>(new float_item(d));
|
boost::shared_ptr<float_item> i = boost::shared_ptr<float_item>(new float_item(d));
|
||||||
items.push_back(i);
|
items.push_back(i);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
std::string string_buffer::str() const {
|
std::string string_buffer::str() const {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
for (std::vector< SHARED_PTR<item> >::const_iterator it = items.begin(); it != items.end(); ++it) {
|
for (std::vector< boost::shared_ptr<item> >::const_iterator it = items.begin(); it != items.end(); ++it) {
|
||||||
ss << (**it).str();
|
ss << (**it).str();
|
||||||
}
|
}
|
||||||
return ss.str();
|
return ss.str();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "../ifcparse/SharedPointer.h"
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
namespace util {
|
namespace util {
|
||||||
class string_buffer {
|
class string_buffer {
|
||||||
@@ -51,12 +51,12 @@ namespace util {
|
|||||||
std::string str() const { std::stringstream ss; ss << d; return ss.str(); }
|
std::string str() const { std::stringstream ss; ss << d; return ss.str(); }
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
std::vector< SHARED_PTR<item> > items;
|
std::vector< boost::shared_ptr<item> > items;
|
||||||
void clear();
|
void clear();
|
||||||
void assign(const std::vector< SHARED_PTR<item> >& other);
|
void assign(const std::vector< boost::shared_ptr<item> >& other);
|
||||||
public:
|
public:
|
||||||
SHARED_PTR<string_item> add(const std::string& s);
|
boost::shared_ptr<string_item> add(const std::string& s);
|
||||||
SHARED_PTR<float_item> add(const double& d);
|
boost::shared_ptr<float_item> add(const double& d);
|
||||||
std::string str() const;
|
std::string str() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -892,7 +892,7 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcDerivedProfileDef* l, TopoDS_S
|
|||||||
#ifdef USE_IFC4
|
#ifdef USE_IFC4
|
||||||
|
|
||||||
bool IfcGeom::Kernel::convert(const IfcSchema::IfcBSplineSurfaceWithKnots* l, TopoDS_Shape& face) {
|
bool IfcGeom::Kernel::convert(const IfcSchema::IfcBSplineSurfaceWithKnots* l, TopoDS_Shape& face) {
|
||||||
SHARED_PTR< IfcTemplatedEntityListList<IfcSchema::IfcCartesianPoint> > cps = l->ControlPointsList();
|
boost::shared_ptr< IfcTemplatedEntityListList<IfcSchema::IfcCartesianPoint> > cps = l->ControlPointsList();
|
||||||
std::vector<double> uknots = l->UKnots();
|
std::vector<double> uknots = l->UKnots();
|
||||||
std::vector<double> vknots = l->VKnots();
|
std::vector<double> vknots = l->VKnots();
|
||||||
std::vector<int> umults = l->UMultiplicities();
|
std::vector<int> umults = l->UMultiplicities();
|
||||||
|
|||||||
@@ -26,7 +26,8 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "../ifcparse/SharedPointer.h"
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
#include "../ifcparse/IfcUtil.h"
|
#include "../ifcparse/IfcUtil.h"
|
||||||
#include "../ifcparse/IfcException.h"
|
#include "../ifcparse/IfcException.h"
|
||||||
|
|
||||||
|
|||||||
@@ -37,9 +37,9 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <boost/dynamic_bitset.hpp>
|
#include <boost/dynamic_bitset.hpp>
|
||||||
|
|
||||||
#include "../ifcparse/SharedPointer.h"
|
|
||||||
#include "../ifcparse/IfcCharacterDecoder.h"
|
#include "../ifcparse/IfcCharacterDecoder.h"
|
||||||
#include "../ifcparse/IfcUtil.h"
|
#include "../ifcparse/IfcUtil.h"
|
||||||
|
|
||||||
|
|||||||
@@ -26,10 +26,9 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <boost/dynamic_bitset.hpp>
|
#include <boost/dynamic_bitset.hpp>
|
||||||
|
|
||||||
#include "../ifcparse/SharedPointer.h"
|
|
||||||
|
|
||||||
#ifdef USE_IFC4
|
#ifdef USE_IFC4
|
||||||
#include "../ifcparse/Ifc4enum.h"
|
#include "../ifcparse/Ifc4enum.h"
|
||||||
#else
|
#else
|
||||||
@@ -119,7 +118,7 @@ class IfcTemplatedEntityList;
|
|||||||
class IfcEntityList {
|
class IfcEntityList {
|
||||||
std::vector<IfcUtil::IfcBaseClass*> ls;
|
std::vector<IfcUtil::IfcBaseClass*> ls;
|
||||||
public:
|
public:
|
||||||
typedef SHARED_PTR<IfcEntityList> ptr;
|
typedef boost::shared_ptr<IfcEntityList> ptr;
|
||||||
typedef std::vector<IfcUtil::IfcBaseClass*>::const_iterator it;
|
typedef std::vector<IfcUtil::IfcBaseClass*>::const_iterator it;
|
||||||
void push(IfcUtil::IfcBaseClass* l);
|
void push(IfcUtil::IfcBaseClass* l);
|
||||||
void push(const ptr& l);
|
void push(const ptr& l);
|
||||||
@@ -143,7 +142,7 @@ template <class T>
|
|||||||
class IfcTemplatedEntityList {
|
class IfcTemplatedEntityList {
|
||||||
std::vector<T*> ls;
|
std::vector<T*> ls;
|
||||||
public:
|
public:
|
||||||
typedef SHARED_PTR< IfcTemplatedEntityList<T> > ptr;
|
typedef boost::shared_ptr< IfcTemplatedEntityList<T> > ptr;
|
||||||
typedef typename std::vector<T*>::const_iterator it;
|
typedef typename std::vector<T*>::const_iterator it;
|
||||||
void push(T* t) { if (t) { ls.push_back(t); } }
|
void push(T* t) { if (t) { ls.push_back(t); } }
|
||||||
void push(ptr t) { if (t) { for ( typename T::list::it it = t->begin(); it != t->end(); ++it ) push(*it); } }
|
void push(ptr t) { if (t) { for ( typename T::list::it it = t->begin(); it != t->end(); ++it ) push(*it); } }
|
||||||
@@ -177,7 +176,7 @@ class IfcTemplatedEntityListList;
|
|||||||
class IfcEntityListList {
|
class IfcEntityListList {
|
||||||
std::vector< std::vector<IfcUtil::IfcBaseClass*> > ls;
|
std::vector< std::vector<IfcUtil::IfcBaseClass*> > ls;
|
||||||
public:
|
public:
|
||||||
typedef SHARED_PTR< IfcEntityListList > ptr;
|
typedef boost::shared_ptr< IfcEntityListList > ptr;
|
||||||
typedef std::vector< std::vector<IfcUtil::IfcBaseClass*> >::const_iterator outer_it;
|
typedef std::vector< std::vector<IfcUtil::IfcBaseClass*> >::const_iterator outer_it;
|
||||||
typedef std::vector<IfcUtil::IfcBaseClass*>::const_iterator inner_it;
|
typedef std::vector<IfcUtil::IfcBaseClass*>::const_iterator inner_it;
|
||||||
void push(const std::vector<IfcUtil::IfcBaseClass*>& l) {
|
void push(const std::vector<IfcUtil::IfcBaseClass*>& l) {
|
||||||
@@ -231,7 +230,7 @@ template <class T>
|
|||||||
class IfcTemplatedEntityListList {
|
class IfcTemplatedEntityListList {
|
||||||
std::vector< std::vector<T*> > ls;
|
std::vector< std::vector<T*> > ls;
|
||||||
public:
|
public:
|
||||||
typedef typename SHARED_PTR< IfcTemplatedEntityListList<T> > ptr;
|
typedef typename boost::shared_ptr< IfcTemplatedEntityListList<T> > ptr;
|
||||||
typedef typename std::vector< std::vector<T*> >::const_iterator outer_it;
|
typedef typename std::vector< std::vector<T*> >::const_iterator outer_it;
|
||||||
typedef typename std::vector<T*>::const_iterator inner_it;
|
typedef typename std::vector<T*>::const_iterator inner_it;
|
||||||
void push(const std::vector<T*>& t) {ls.push_back(t);}
|
void push(const std::vector<T*>& t) {ls.push_back(t);}
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file is part of IfcOpenShell. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the Lesser GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation, either version 3.0 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* Lesser GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the Lesser GNU General Public License *
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file defines the shared pointer implementation to use, shared pointers *
|
|
||||||
* are used extensively in IfcOpenShell *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#include <tr1/memory>
|
|
||||||
#define SHARED_PTR std::tr1::shared_ptr
|
|
||||||
#else
|
|
||||||
#if _MSC_VER >= 1600
|
|
||||||
// MSVC 2008 does not have shared_ptr by default, but it comes
|
|
||||||
// in a feature pack. Therefore for IDEs prior to MSVC 2010 the
|
|
||||||
// shared_ptr that ships with boost is used.
|
|
||||||
#include <memory>
|
|
||||||
#define SHARED_PTR std::tr1::shared_ptr
|
|
||||||
#else
|
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
#define SHARED_PTR boost::shared_ptr
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
@@ -319,10 +319,6 @@
|
|||||||
RelativePath="..\..\src\ifcparse\IfcWrite.h"
|
RelativePath="..\..\src\ifcparse\IfcWrite.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\ifcparse\SharedPointer.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
</Filter>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
|
|||||||
Reference in New Issue
Block a user