Use boost::shared_ptr

Fixes https://github.com/IfcOpenShell/IfcOpenShell/issues/17
This commit is contained in:
aothms
2016-01-25 14:42:41 +01:00
parent 9b13ed3f38
commit ed8cc620ea
10 changed files with 26 additions and 71 deletions
+2 -1
View File
@@ -26,7 +26,8 @@
#include <iostream>
#include <algorithm>
#include "../ifcparse/SharedPointer.h"
#include <boost/shared_ptr.hpp>
#include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcException.h"
+1 -1
View File
@@ -37,9 +37,9 @@
#include <cstring>
#include <map>
#include <boost/shared_ptr.hpp>
#include <boost/dynamic_bitset.hpp>
#include "../ifcparse/SharedPointer.h"
#include "../ifcparse/IfcCharacterDecoder.h"
#include "../ifcparse/IfcUtil.h"
+5 -6
View File
@@ -26,10 +26,9 @@
#include <sstream>
#include <algorithm>
#include <boost/shared_ptr.hpp>
#include <boost/dynamic_bitset.hpp>
#include "../ifcparse/SharedPointer.h"
#ifdef USE_IFC4
#include "../ifcparse/Ifc4enum.h"
#else
@@ -119,7 +118,7 @@ class IfcTemplatedEntityList;
class IfcEntityList {
std::vector<IfcUtil::IfcBaseClass*> ls;
public:
typedef SHARED_PTR<IfcEntityList> ptr;
typedef boost::shared_ptr<IfcEntityList> ptr;
typedef std::vector<IfcUtil::IfcBaseClass*>::const_iterator it;
void push(IfcUtil::IfcBaseClass* l);
void push(const ptr& l);
@@ -143,7 +142,7 @@ template <class T>
class IfcTemplatedEntityList {
std::vector<T*> ls;
public:
typedef SHARED_PTR< IfcTemplatedEntityList<T> > ptr;
typedef boost::shared_ptr< IfcTemplatedEntityList<T> > ptr;
typedef typename std::vector<T*>::const_iterator it;
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); } }
@@ -177,7 +176,7 @@ class IfcTemplatedEntityListList;
class IfcEntityListList {
std::vector< std::vector<IfcUtil::IfcBaseClass*> > ls;
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<IfcUtil::IfcBaseClass*>::const_iterator inner_it;
void push(const std::vector<IfcUtil::IfcBaseClass*>& l) {
@@ -231,7 +230,7 @@ template <class T>
class IfcTemplatedEntityListList {
std::vector< std::vector<T*> > ls;
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<T*>::const_iterator inner_it;
void push(const std::vector<T*>& t) {ls.push_back(t);}
-41
View File
@@ -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