IfcParse dynamic linking, IFCPARSE_NO_REGEX, fixes for three memory leaks (#76)

* CMake: moved setting link directories before all the projects.

* Added IfcParse_Export header for declaring export macro.

* Added IFCPARSE_STATIC_DEFINE macro to all projects.

* Added include for export macro to swig file.

* Added IfcParse_EXPORT macro for all classes in headers generated by express parser.

* Allow removing boost.regex dependency by defining macro IFCPARSE_NO_REGEX.

* Fixed bug in deletion of ICU converter.

* Added export macro to most of the classes across headers

* Fixed memory leak: delete nested IfcAbstractEntity in EntityArgument.

* Fixed memory leak in destructor of IfcWritableEntity (args values).
This commit is contained in:
stgatilov
2016-05-29 18:12:57 +06:00
committed by Thomas Krijnen
parent a298903fdd
commit b5c4eb3b6f
22 changed files with 1784 additions and 1718 deletions
+10 -7
View File
@@ -408,6 +408,13 @@ if(NOT Boost_VERSION LESS 105800)
add_definitions(-DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE) add_definitions(-DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE)
endif() endif()
LINK_DIRECTORIES(${LINK_DIRECTORIES} ${IfcOpenShell_BINARY_DIR} ${OCC_LIBRARY_DIR} ${OPENCOLLADA_LIBRARY_DIR}
${ICU_LIBRARY_DIR} ${Boost_LIBRARY_DIRS}
)
if(NOT WIN32)
LINK_DIRECTORIES(${LINK_DIRECTORIES} /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64)
endif()
# IfcParse # IfcParse
file(GLOB IFCPARSE_H_FILES ../src/ifcparse/*.h) file(GLOB IFCPARSE_H_FILES ../src/ifcparse/*.h)
file(GLOB IFCPARSE_CPP_FILES ../src/ifcparse/*.cpp) file(GLOB IFCPARSE_CPP_FILES ../src/ifcparse/*.cpp)
@@ -422,6 +429,9 @@ endforeach()
set(IFCPARSE_FILES ${IFCPARSE_CPP_FILES} ${IFCPARSE_H_FILES}) set(IFCPARSE_FILES ${IFCPARSE_CPP_FILES} ${IFCPARSE_H_FILES})
# add macro for every project: use IfcParse as static lib
add_definitions(-DIFCPARSE_STATIC_DEFINE)
ADD_LIBRARY(IfcParse STATIC ${IFCPARSE_FILES}) ADD_LIBRARY(IfcParse STATIC ${IFCPARSE_FILES})
IF(UNICODE_SUPPORT) IF(UNICODE_SUPPORT)
@@ -445,13 +455,6 @@ ENDIF()
TARGET_LINK_LIBRARIES(IfcGeom IfcParse) TARGET_LINK_LIBRARIES(IfcGeom IfcParse)
LINK_DIRECTORIES(${LINK_DIRECTORIES} ${IfcOpenShell_BINARY_DIR} ${OCC_LIBRARY_DIR} ${OPENCOLLADA_LIBRARY_DIR}
${ICU_LIBRARY_DIR} ${Boost_LIBRARY_DIRS}
)
if(NOT WIN32)
LINK_DIRECTORIES(${LINK_DIRECTORIES} /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64)
endif()
# IfcConvert # IfcConvert
if (IFCCONVERT_DOUBLE_PRECISION) if (IFCCONVERT_DOUBLE_PRECISION)
add_definitions(-DIFCCONVERT_DOUBLE_PRECISION) add_definitions(-DIFCCONVERT_DOUBLE_PRECISION)
+10 -6
View File
@@ -26,6 +26,8 @@ header = """
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include "../ifcparse/IfcParse_Export.h"
#include "../ifcparse/IfcUtil.h" #include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcException.h" #include "../ifcparse/IfcException.h"
#include "../ifcparse/%(schema_name)senum.h" #include "../ifcparse/%(schema_name)senum.h"
@@ -62,6 +64,8 @@ enum_header = """
#ifndef %(schema_name_upper)sENUM_H #ifndef %(schema_name_upper)sENUM_H
#define %(schema_name_upper)sENUM_H #define %(schema_name_upper)sENUM_H
#include "../ifcparse/IfcParse_Export.h"
#include <boost/optional.hpp> #include <boost/optional.hpp>
#define IfcSchema %(schema_name)s #define IfcSchema %(schema_name)s
@@ -72,10 +76,10 @@ namespace Type {
typedef enum { typedef enum {
%(types)s, UNDEFINED %(types)s, UNDEFINED
} Enum; } Enum;
boost::optional<Enum> Parent(Enum v); IfcParse_EXPORT boost::optional<Enum> Parent(Enum v);
Enum FromString(const std::string& s); IfcParse_EXPORT Enum FromString(const std::string& s);
std::string ToString(Enum v); IfcParse_EXPORT std::string ToString(Enum v);
bool IsSimple(Enum v); IfcParse_EXPORT bool IsSimple(Enum v);
} }
} }
@@ -352,7 +356,7 @@ derived_field_statement = ' {std::set<int> idxs; %(statements)sderived_map[Ty
derived_field_statement_attrs = 'idxs.insert(%d); ' derived_field_statement_attrs = 'idxs.insert(%d); '
simpletype = """%(documentation)s simpletype = """%(documentation)s
class %(name)s : public %(superclass)s { class IfcParse_EXPORT %(name)s : public %(superclass)s {
public: public:
virtual IfcUtil::ArgumentType getArgumentType(unsigned int i) const; virtual IfcUtil::ArgumentType getArgumentType(unsigned int i) const;
virtual Argument* getArgument(unsigned int i) const; virtual Argument* getArgument(unsigned int i) const;
@@ -391,7 +395,7 @@ const char* ToString(%(name)s v);
""" """
entity = """%(documentation)s entity = """%(documentation)s
class %(name)s %(superclass)s{ class IfcParse_EXPORT %(name)s %(superclass)s{
public: public:
%(attributes)s virtual unsigned int getArgumentCount() const { return %(argument_count)d; } %(attributes)s virtual unsigned int getArgumentCount() const { return %(argument_count)d; }
virtual IfcUtil::ArgumentType getArgumentType(unsigned int i) const {%(argument_type_function_body)s} virtual IfcUtil::ArgumentType getArgumentType(unsigned int i) const {%(argument_type_function_body)s}
+772 -770
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+900 -898
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -322,7 +322,7 @@ IfcCharacterEncoder::IfcCharacterEncoder(const std::string& input) {
IfcCharacterEncoder::~IfcCharacterEncoder() { IfcCharacterEncoder::~IfcCharacterEncoder() {
#ifdef HAVE_ICU #ifdef HAVE_ICU
if ( !converter) ucnv_close(converter); if ( converter) ucnv_close(converter);
converter = 0; converter = 0;
#endif #endif
} }
+3 -1
View File
@@ -23,6 +23,8 @@
#include <map> #include <map>
#include <set> #include <set>
#include "../ifcparse/IfcParse_Export.h"
#include "../ifcparse/IfcParse.h" #include "../ifcparse/IfcParse.h"
#include "../ifcparse/IfcSpfHeader.h" #include "../ifcparse/IfcSpfHeader.h"
@@ -30,7 +32,7 @@ namespace IfcParse {
/// This class provides several static convenience functions and variables /// This class provides several static convenience functions and variables
/// and provide access to the entities in an IFC file /// and provide access to the entities in an IFC file
class IfcFile { class IfcParse_EXPORT IfcFile {
public: public:
typedef std::map<IfcSchema::Type::Enum, IfcEntityList::ptr> entities_by_type_t; typedef std::map<IfcSchema::Type::Enum, IfcEntityList::ptr> entities_by_type_t;
typedef std::map<unsigned int, IfcUtil::IfcBaseClass*> entity_by_id_t; typedef std::map<unsigned int, IfcUtil::IfcBaseClass*> entity_by_id_t;
+3 -1
View File
@@ -23,10 +23,12 @@
#include <string> #include <string>
#include <boost/uuid/uuid.hpp> #include <boost/uuid/uuid.hpp>
#include "../ifcparse/IfcParse_Export.h"
namespace IfcParse { namespace IfcParse {
/// A helper class for the creation of IFC GlobalIds. /// A helper class for the creation of IFC GlobalIds.
class IfcGlobalId { class IfcParse_EXPORT IfcGlobalId {
private: private:
std::string string_data, formatted_string; std::string string_data, formatted_string;
boost::uuids::uuid uuid_data; boost::uuids::uuid uuid_data;
+3 -1
View File
@@ -30,6 +30,8 @@
#include <map> #include <map>
#include "../ifcparse/IfcParse_Export.h"
#ifdef USE_IFC4 #ifdef USE_IFC4
#include "../ifcparse/Ifc4.h" #include "../ifcparse/Ifc4.h"
#else #else
@@ -40,7 +42,7 @@
#include "../ifcparse/IfcWrite.h" #include "../ifcparse/IfcWrite.h"
#include "../ifcparse/IfcGlobalId.h" #include "../ifcparse/IfcGlobalId.h"
class IfcHierarchyHelper : public IfcParse::IfcFile { class IfcParse_EXPORT IfcHierarchyHelper : public IfcParse::IfcFile {
public: public:
template <class T> template <class T>
T* addTriplet(double x, double y, double z) { T* addTriplet(double x, double y, double z) {
+3 -1
View File
@@ -22,6 +22,8 @@
#include <string> #include <string>
#include "../ifcparse/IfcParse_Export.h"
#include "../ifcparse/IfcUtil.h" #include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcWrite.h" #include "../ifcparse/IfcWrite.h"
#include "../ifcparse/IfcWritableEntity.h" #include "../ifcparse/IfcWritableEntity.h"
@@ -32,7 +34,7 @@ namespace IfcParse {
// that in the IfcFile class the distinction what entity type to be created is // that in the IfcFile class the distinction what entity type to be created is
// no longer necessary and weird diagonal casts when creating geometry from // no longer necessary and weird diagonal casts when creating geometry from
// IfcLateBoundEntities are eliminated. // IfcLateBoundEntities are eliminated.
class IfcLateBoundEntity : public IfcUtil::IfcBaseEntity { class IfcParse_EXPORT IfcLateBoundEntity : public IfcUtil::IfcBaseEntity {
private: private:
IfcWrite::IfcWritableEntity* writable_entity(); IfcWrite::IfcWritableEntity* writable_entity();
void invalid_argument(unsigned int i, const std::string& t); void invalid_argument(unsigned int i, const std::string& t);
+1 -1
View File
@@ -780,7 +780,7 @@ std::string EntityArgument::toString(bool upper) const {
} }
//return entity->entity->toString(); } //return entity->entity->toString(); }
bool EntityArgument::isNull() const { return false; } bool EntityArgument::isNull() const { return false; }
EntityArgument::~EntityArgument() { delete entity; } EntityArgument::~EntityArgument() { delete entity->entity; delete entity;}
// //
// Reads an Entity from the list of Tokens // Reads an Entity from the list of Tokens
+9 -7
View File
@@ -40,6 +40,8 @@
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/dynamic_bitset.hpp> #include <boost/dynamic_bitset.hpp>
#include "../ifcparse/IfcParse_Export.h"
#include "../ifcparse/IfcCharacterDecoder.h" #include "../ifcparse/IfcCharacterDecoder.h"
#include "../ifcparse/IfcUtil.h" #include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcLogger.h" #include "../ifcparse/IfcLogger.h"
@@ -62,7 +64,7 @@ namespace IfcParse {
/// Provides functions to convert Tokens to binary data /// Provides functions to convert Tokens to binary data
/// Tokens are merely offsets to where they can be read in the file /// Tokens are merely offsets to where they can be read in the file
class TokenFunc { class IfcParse_EXPORT TokenFunc {
private: private:
static bool startsWith(const Token& t, char c); static bool startsWith(const Token& t, char c);
public: public:
@@ -109,7 +111,7 @@ namespace IfcParse {
Token TokenPtr(); Token TokenPtr();
/// A stream of tokens to be read from a IfcSpfStream. /// A stream of tokens to be read from a IfcSpfStream.
class IfcSpfLexer { class IfcParse_EXPORT IfcSpfLexer {
private: private:
IfcCharacterDecoder* decoder; IfcCharacterDecoder* decoder;
unsigned int skipWhitespace(); unsigned int skipWhitespace();
@@ -126,7 +128,7 @@ namespace IfcParse {
/// Argument of type list, e.g. /// Argument of type list, e.g.
/// #1=IfcDirection((1.,0.,0.)); /// #1=IfcDirection((1.,0.,0.));
/// ========== /// ==========
class ArgumentList: public Argument { class IfcParse_EXPORT ArgumentList: public Argument {
private: private:
std::vector<Argument*> list; std::vector<Argument*> list;
void push(Argument* l); void push(Argument* l);
@@ -166,7 +168,7 @@ namespace IfcParse {
/// Argument of type scalar or string, e.g. /// Argument of type scalar or string, e.g.
/// #1=IfcVector(#2,1.0); /// #1=IfcVector(#2,1.0);
/// == === /// == ===
class TokenArgument : public Argument { class IfcParse_EXPORT TokenArgument : public Argument {
private: private:
public: public:
@@ -202,7 +204,7 @@ namespace IfcParse {
/// Argument of an IFC simple type /// Argument of an IFC simple type
/// #1=IfcTrimmedCurve(#2,(IFCPARAMETERVALUE(0.)),(IFCPARAMETERVALUE(1.)),.T.,.PARAMETER.); /// #1=IfcTrimmedCurve(#2,(IFCPARAMETERVALUE(0.)),(IFCPARAMETERVALUE(1.)),.T.,.PARAMETER.);
/// ===================== ===================== /// ===================== =====================
class EntityArgument : public Argument { class IfcParse_EXPORT EntityArgument : public Argument {
private: private:
IfcUtil::IfcBaseClass* entity; IfcUtil::IfcBaseClass* entity;
public: public:
@@ -238,7 +240,7 @@ namespace IfcParse {
/// Entity defined in an IFC file, e.g. /// Entity defined in an IFC file, e.g.
/// #1=IfcDirection((1.,0.,0.)); /// #1=IfcDirection((1.,0.,0.));
/// ============================ /// ============================
class Entity : public IfcAbstractEntity { class IfcParse_EXPORT Entity : public IfcAbstractEntity {
private: private:
mutable ArgumentList* args; mutable ArgumentList* args;
mutable IfcSchema::Type::Enum _type; mutable IfcSchema::Type::Enum _type;
@@ -264,6 +266,6 @@ namespace IfcParse {
} }
std::ostream& operator<< (std::ostream& os, const IfcParse::IfcFile& f); IfcParse_EXPORT std::ostream& operator<< (std::ostream& os, const IfcParse::IfcFile& f);
#endif #endif
+22
View File
@@ -0,0 +1,22 @@
#ifndef IfcParse_EXPORT_H
#define IfcParse_EXPORT_H
#ifdef IFCPARSE_STATIC_DEFINE
#define IfcParse_EXPORT
#else
#ifdef _WIN32
#ifndef IfcParse_EXPORT
#ifdef IfcParse_EXPORTS
#define IfcParse_EXPORT __declspec(dllexport)
#else
#define IfcParse_EXPORT __declspec(dllimport)
#endif
#endif
#elif __linux__
#define IfcParse_EXPORT __attribute__((visibility("default")))
#else
#define IfcParse_EXPORT
#endif
#endif
#endif
+7 -5
View File
@@ -20,12 +20,14 @@
#ifndef IFCSPFHEADER_H #ifndef IFCSPFHEADER_H
#define IFCSPFHEADER_H #define IFCSPFHEADER_H
#include "../ifcparse/IfcParse_Export.h"
#include "../ifcparse/IfcSpfStream.h" #include "../ifcparse/IfcSpfStream.h"
#include "../ifcparse/IfcWrite.h" #include "../ifcparse/IfcWrite.h"
namespace IfcParse { namespace IfcParse {
class HeaderEntity : public IfcAbstractEntity { class IfcParse_EXPORT HeaderEntity : public IfcAbstractEntity {
private: private:
ArgumentList* _list; ArgumentList* _list;
const char * const _datatype; const char * const _datatype;
@@ -103,7 +105,7 @@ public:
} }
}; };
class FileDescription : public HeaderEntity { class IfcParse_EXPORT FileDescription : public HeaderEntity {
public: public:
explicit FileDescription(IfcSpfLexer* = 0); explicit FileDescription(IfcSpfLexer* = 0);
@@ -114,7 +116,7 @@ public:
void implementation_level(const std::string& value) { setArgument(1, value); } void implementation_level(const std::string& value) { setArgument(1, value); }
}; };
class FileName : public HeaderEntity { class IfcParse_EXPORT FileName : public HeaderEntity {
public: public:
explicit FileName(IfcSpfLexer* = 0); explicit FileName(IfcSpfLexer* = 0);
@@ -135,7 +137,7 @@ public:
void authorization(const std::string& value) { setArgument(6, value); } void authorization(const std::string& value) { setArgument(6, value); }
}; };
class FileSchema : public HeaderEntity { class IfcParse_EXPORT FileSchema : public HeaderEntity {
public: public:
explicit FileSchema(IfcSpfLexer* = 0); explicit FileSchema(IfcSpfLexer* = 0);
@@ -144,7 +146,7 @@ public:
void schema_identifiers(const std::vector<std::string>& value) { setArgument(0, value); } void schema_identifiers(const std::vector<std::string>& value) { setArgument(0, value); }
}; };
class IfcSpfHeader { class IfcParse_EXPORT IfcSpfHeader {
private: private:
IfcSpfLexer* _lexer; IfcSpfLexer* _lexer;
FileDescription* _file_description; FileDescription* _file_description;
+3 -1
View File
@@ -30,6 +30,8 @@
#include <fstream> #include <fstream>
#include <string> #include <string>
#include "../ifcparse/IfcParse_Export.h"
// As of IfcOpenShell version 0.3.0 the paging functionality, which // As of IfcOpenShell version 0.3.0 the paging functionality, which
// loads a file on disk into multiple chunks, has been disabled. // loads a file on disk into multiple chunks, has been disabled.
// It proved to be an inefficient way of working with large files, // It proved to be an inefficient way of working with large files,
@@ -46,7 +48,7 @@ namespace IfcParse {
/// which only one is simultaneously kept in memory, for files /// which only one is simultaneously kept in memory, for files
/// that define their entities not in a sequential nature, this is /// that define their entities not in a sequential nature, this is
/// detrimental for the performance of the parser. /// detrimental for the performance of the parser.
class IfcSpfStream { class IfcParse_EXPORT IfcSpfStream {
private: private:
FILE* stream; FILE* stream;
char* buffer; char* buffer;
+2
View File
@@ -111,6 +111,7 @@ bool IfcUtil::valid_binary_string(const std::string& s) {
return true; return true;
} }
#ifndef IFCPARSE_NO_REGEX
boost::regex IfcUtil::wildcard_string_to_regex(std::string str) boost::regex IfcUtil::wildcard_string_to_regex(std::string str)
{ {
// Escape all non-"*?" regex special chars // Escape all non-"*?" regex special chars
@@ -124,6 +125,7 @@ boost::regex IfcUtil::wildcard_string_to_regex(std::string str)
boost::replace_all(str, "*", ".*"); boost::replace_all(str, "*", ".*");
return boost::regex(str); return boost::regex(str);
} }
#endif
void IfcUtil::sanitate_material_name(std::string &str) void IfcUtil::sanitate_material_name(std::string &str)
{ {
+14 -8
View File
@@ -26,6 +26,8 @@
#include <sstream> #include <sstream>
#include <algorithm> #include <algorithm>
#include "../ifcparse/IfcParse_Export.h"
#ifdef USE_IFC4 #ifdef USE_IFC4
#include "../ifcparse/Ifc4enum.h" #include "../ifcparse/Ifc4enum.h"
#else #else
@@ -34,7 +36,9 @@
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/dynamic_bitset.hpp> #include <boost/dynamic_bitset.hpp>
#include <boost/regex.hpp> #ifndef IFCPARSE_NO_REGEX //allow builds without boost.regex
#include <boost/regex.hpp>
#endif
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#define foreach BOOST_FOREACH #define foreach BOOST_FOREACH
@@ -75,7 +79,7 @@ namespace IfcUtil {
const char* ArgumentTypeToString(ArgumentType argument_type); const char* ArgumentTypeToString(ArgumentType argument_type);
class IfcBaseClass { class IfcParse_EXPORT IfcBaseClass {
public: public:
IfcAbstractEntity* entity; IfcAbstractEntity* entity;
virtual bool is(IfcSchema::Type::Enum v) const = 0; virtual bool is(IfcSchema::Type::Enum v) const = 0;
@@ -102,11 +106,11 @@ namespace IfcUtil {
} }
}; };
class IfcBaseEntity : public IfcBaseClass { class IfcParse_EXPORT IfcBaseEntity : public IfcBaseClass {
}; };
// TODO: Investigate whether these should be template classes instead // TODO: Investigate whether these should be template classes instead
class IfcBaseType : public IfcBaseEntity { class IfcParse_EXPORT IfcBaseType : public IfcBaseEntity {
public: public:
unsigned int getArgumentCount() const; unsigned int getArgumentCount() const;
Argument* getArgument(unsigned int i) const; Argument* getArgument(unsigned int i) const;
@@ -116,7 +120,9 @@ namespace IfcUtil {
bool valid_binary_string(const std::string& s); bool valid_binary_string(const std::string& s);
#ifndef IFCPARSE_NO_REGEX
boost::regex wildcard_string_to_regex(std::string str); boost::regex wildcard_string_to_regex(std::string str);
#endif
/// Replaces spaces and potentially other problem causing characters with underscores. /// Replaces spaces and potentially other problem causing characters with underscores.
void sanitate_material_name(std::string &str); void sanitate_material_name(std::string &str);
@@ -127,7 +133,7 @@ namespace IfcUtil {
template <class T> template <class T>
class IfcTemplatedEntityList; class IfcTemplatedEntityList;
class IfcEntityList { class IfcParse_EXPORT IfcEntityList {
std::vector<IfcUtil::IfcBaseClass*> ls; std::vector<IfcUtil::IfcBaseClass*> ls;
public: public:
typedef boost::shared_ptr<IfcEntityList> ptr; typedef boost::shared_ptr<IfcEntityList> ptr;
@@ -185,7 +191,7 @@ public:
template <class T> template <class T>
class IfcTemplatedEntityListList; class IfcTemplatedEntityListList;
class IfcEntityListList { class IfcParse_EXPORT IfcEntityListList {
std::vector< std::vector<IfcUtil::IfcBaseClass*> > ls; std::vector< std::vector<IfcUtil::IfcBaseClass*> > ls;
public: public:
typedef boost::shared_ptr< IfcEntityListList > ptr; typedef boost::shared_ptr< IfcEntityListList > ptr;
@@ -283,7 +289,7 @@ namespace IfcParse {
class IfcFile; class IfcFile;
} }
class Argument { class IfcParse_EXPORT Argument {
public: public:
virtual operator int() const = 0; virtual operator int() const = 0;
virtual operator bool() const = 0; virtual operator bool() const = 0;
@@ -312,7 +318,7 @@ public:
virtual ~Argument() {}; virtual ~Argument() {};
}; };
class IfcAbstractEntity { class IfcParse_EXPORT IfcAbstractEntity {
public: public:
IfcParse::IfcFile* file; IfcParse::IfcFile* file;
virtual IfcEntityList::ptr getInverse(IfcSchema::Type::Enum type, int attribute_index) = 0; virtual IfcEntityList::ptr getInverse(IfcSchema::Type::Enum type, int attribute_index) = 0;
+3 -1
View File
@@ -35,10 +35,12 @@
#include <boost/dynamic_bitset.hpp> #include <boost/dynamic_bitset.hpp>
#include "../ifcparse/IfcParse_Export.h"
#include "IfcUtil.h" #include "IfcUtil.h"
namespace IfcWrite { namespace IfcWrite {
class IfcWritableEntity : public IfcAbstractEntity { class IfcParse_EXPORT IfcWritableEntity : public IfcAbstractEntity {
private: private:
std::map<int,bool> writemask; std::map<int,bool> writemask;
std::map<int,Argument*> args; std::map<int,Argument*> args;
+2
View File
@@ -44,6 +44,8 @@ IfcWritableEntity::IfcWritableEntity(IfcSchema::Type::Enum t) {
} }
IfcWritableEntity::~IfcWritableEntity() { IfcWritableEntity::~IfcWritableEntity() {
delete _id; delete _id;
for (std::map<int,Argument*>::iterator it = args.begin(); it != args.end(); ++it)
delete it->second;
} }
int IfcWritableEntity::setId(int i) { int IfcWritableEntity::setId(int i) {
if (i > 0) { if (i > 0) {
+3 -1
View File
@@ -32,6 +32,8 @@
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/dynamic_bitset.hpp> #include <boost/dynamic_bitset.hpp>
#include "../ifcparse/IfcParse_Export.h"
#include "../ifcparse/IfcUtil.h" #include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcParse.h" #include "../ifcparse/IfcParse.h"
@@ -42,7 +44,7 @@ namespace IfcWrite {
/// IfcParse namespace is that this class has a Boost.Variant member /// IfcParse namespace is that this class has a Boost.Variant member
/// for storing its value, whereas the IfcParse classes only contain /// for storing its value, whereas the IfcParse classes only contain
/// lazy references to byte offsets in the IFC-SPF file. /// lazy references to byte offsets in the IFC-SPF file.
class IfcWriteArgument : public Argument { class IfcParse_EXPORT IfcWriteArgument : public Argument {
public: public:
class EnumerationReference { class EnumerationReference {
public: public:
+1
View File
@@ -199,6 +199,7 @@ namespace IfcUtil {
%} %}
}; };
%include "../ifcparse/IfcParse_Export.h"
%include "../ifcparse/IfcSpfHeader.h" %include "../ifcparse/IfcSpfHeader.h"
%include "../ifcparse/IfcFile.h" %include "../ifcparse/IfcFile.h"
%include "../ifcparse/IfcLateBoundEntity.h" %include "../ifcparse/IfcLateBoundEntity.h"