Skip to content

Commit a421f48

Browse files
author
Luke Brooks
committed
Removes IfcFile::Dup in favour of accessing one of the
`IfcFile::Init` methods via the Python wrapper.
1 parent ddef0da commit a421f48

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

src/ifcparse/IfcFile.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class IFC_PARSE_API IfcFile {
106106
/// attributes as a flat list. NB: includes the root instance specified
107107
/// in the first function argument.
108108
IfcEntityList::ptr traverse(IfcUtil::IfcBaseClass* instance, int max_level=-1);
109-
109+
110110
#ifdef USE_MMAP
111111
bool Init(const std::string& fn, bool mmap=false);
112112
#else
@@ -116,7 +116,7 @@ class IFC_PARSE_API IfcFile {
116116
bool Init(void* data, int len);
117117
bool Init(IfcParse::IfcSpfStream* f);
118118

119-
//bool Dup(const std::string& data);
119+
bool Init(const std::string& data, unsigned int unused);
120120

121121
IfcEntityList::ptr getInverse(int instance_id, IfcSchema::Type::Enum type, int attribute_index);
122122

src/ifcparse/IfcParse.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,19 +1252,14 @@ void IfcEntityInstanceData::setArgument(unsigned int i, Argument* a, IfcUtil::Ar
12521252
// Parses the IFC file in fn
12531253
// Creates the maps
12541254
//
1255-
/*
1256-
* bool IfcFile::Dup(const std::string& data) {
1257-
* return IfcFile::Init(new IfcSpfStream(data, (unsigned int) 0));
1258-
* }
1259-
*/
12601255

12611256
#ifdef USE_MMAP
12621257
bool IfcFile::Init(const std::string& fn, bool mmap) {
12631258
return IfcFile::Init(new IfcSpfStream(fn, mmap));
12641259
}
12651260
#else
12661261
bool IfcFile::Init(const std::string& fn) {
1267-
return IfcFile::Init(new IfcSpfStream(fn, (unsigned int) 0));
1262+
//return IfcFile::Init(new IfcSpfStream(fn, (unsigned int) 0));
12681263
return IfcFile::Init(new IfcSpfStream(fn));
12691264
}
12701265
#endif
@@ -1275,6 +1270,9 @@ bool IfcFile::Init(std::istream& f, int len) {
12751270
bool IfcFile::Init(void* data, int len) {
12761271
return IfcFile::Init(new IfcSpfStream(data,len));
12771272
}
1273+
bool IfcFile::Init(const std::string& data, unsigned int unused) {
1274+
return IfcFile::Init(new IfcSpfStream(data, (unsigned int) 0));
1275+
}
12781276

12791277

12801278
bool IfcFile::Init(IfcParse::IfcSpfStream* s) {

src/ifcwrap/IfcParseWrapper.i

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,21 +394,21 @@ private:
394394

395395
// The IfcFile* returned by open() is to be freed by SWIG/Python
396396
%newobject open;
397-
//%newobject read;
397+
%newobject read;
398398

399399
%inline %{
400400
IfcParse::IfcFile* open(const std::string& fn) {
401401
IfcParse::IfcFile* f = new IfcParse::IfcFile();
402402
f->Init(fn);
403403
return f;
404404
}
405-
/*
406-
IfcParse::IfcFile* read(const std::string& fn) {
405+
IfcParse::IfcFile* read(const std::string& data) {
407406
IfcParse::IfcFile* f = new IfcParse::IfcFile();
408-
f->Dup(fn);
407+
std::string copiedData;
408+
copiedData = data;
409+
f->Init((void *)copiedData.c_str(), data.length());
409410
return f;
410411
}
411-
*/
412412
const char* schema_identifier() {
413413
return IfcSchema::Identifier;
414414
}

0 commit comments

Comments
 (0)