2012-08-11 13:24:08 +00:00
|
|
|
/********************************************************************************
|
2012-07-19 13:07:55 +00:00
|
|
|
* *
|
|
|
|
|
* 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/>. *
|
|
|
|
|
* *
|
|
|
|
|
********************************************************************************/
|
|
|
|
|
|
2012-11-04 16:26:33 +00:00
|
|
|
#include "../ifcparse/IfcParse.h"
|
|
|
|
|
#include "../ifcparse/IfcWrite.h"
|
|
|
|
|
#include "../ifcparse/IfcWritableEntity.h"
|
|
|
|
|
#include "../ifcparse/IfcCharacterDecoder.h"
|
2012-07-19 13:07:55 +00:00
|
|
|
|
|
|
|
|
using namespace IfcWrite;
|
|
|
|
|
|
|
|
|
|
IfcWritableEntity::IfcWritableEntity(Ifc2x3::Type::Enum t) {
|
|
|
|
|
_type = t;
|
|
|
|
|
_id = 0;
|
2012-08-11 13:24:08 +00:00
|
|
|
file = 0;
|
2012-07-19 13:07:55 +00:00
|
|
|
}
|
2013-08-04 04:49:08 +00:00
|
|
|
IfcWritableEntity::~IfcWritableEntity() {
|
|
|
|
|
delete _id;
|
|
|
|
|
}
|
2012-07-19 13:07:55 +00:00
|
|
|
int IfcWritableEntity::setId(int i) {
|
2012-08-11 13:24:08 +00:00
|
|
|
return *(_id = new int(i > 0 ? i : file->FreshId()));
|
2012-07-19 13:07:55 +00:00
|
|
|
}
|
|
|
|
|
IfcWritableEntity::IfcWritableEntity(IfcAbstractEntity* e)
|
|
|
|
|
{
|
2012-08-11 13:24:08 +00:00
|
|
|
file = e->file;
|
2012-07-19 13:07:55 +00:00
|
|
|
_type = e->type();
|
2013-08-04 04:49:08 +00:00
|
|
|
delete _id;
|
2012-07-19 13:07:55 +00:00
|
|
|
_id = new int(e->id());
|
|
|
|
|
|
|
|
|
|
const unsigned int count = e->getArgumentCount();
|
|
|
|
|
for ( unsigned int i = 0; i < count; ++ i ) {
|
|
|
|
|
args[i] = e->getArgument(i);
|
|
|
|
|
writemask[i] = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// TODO: Reove redundancy with IfcParse::Entity
|
|
|
|
|
IfcEntities IfcWritableEntity::getInverse(Ifc2x3::Type::Enum c) {
|
|
|
|
|
IfcEntities l = IfcEntities(new IfcEntityList());
|
|
|
|
|
int id = _id ? *_id : setId();
|
2012-08-11 13:24:08 +00:00
|
|
|
IfcEntities all = file->EntitiesByReference(id);
|
2012-07-19 13:07:55 +00:00
|
|
|
if ( ! all ) return l;
|
|
|
|
|
for( IfcEntityList::it it = all->begin(); it != all->end();++ it ) {
|
|
|
|
|
if ( c == Ifc2x3::Type::ALL || (*it)->is(c) ) {
|
|
|
|
|
l->push(*it);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
}
|
|
|
|
|
IfcEntities IfcWritableEntity::getInverse(Ifc2x3::Type::Enum c, int i, const std::string& a) {
|
|
|
|
|
IfcEntities l = IfcEntities(new IfcEntityList());
|
|
|
|
|
IfcEntities all = getInverse(c);
|
|
|
|
|
for( IfcEntityList::it it = all->begin(); it != all->end();++ it ) {
|
|
|
|
|
const std::string s = *(*it)->entity->getArgument(i);
|
|
|
|
|
if ( s == a ) {
|
|
|
|
|
l->push(*it);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string IfcWritableEntity::datatype() { return Ifc2x3::Type::ToString(_type); }
|
2012-11-04 16:26:33 +00:00
|
|
|
ArgumentPtr IfcWritableEntity::getArgument (unsigned int i) { if ( i >= getArgumentCount() ) throw IfcParse::IfcException("Argument not set"); return args[i]; }
|
2012-07-19 13:07:55 +00:00
|
|
|
unsigned int IfcWritableEntity::getArgumentCount() {return args.size(); }
|
|
|
|
|
Ifc2x3::Type::Enum IfcWritableEntity::type() const { return _type; }
|
|
|
|
|
bool IfcWritableEntity::is(Ifc2x3::Type::Enum v) const { return _type == v; }
|
|
|
|
|
std::string IfcWritableEntity::toString(bool upper) {
|
|
|
|
|
std::stringstream ss;
|
|
|
|
|
std::string dt = datatype();
|
|
|
|
|
if ( upper ) {
|
|
|
|
|
for (std::string::iterator p = dt.begin(); p != dt.end(); ++p ) *p = toupper(*p);
|
|
|
|
|
}
|
|
|
|
|
if ( _id ) ss << "#" << *_id;
|
|
|
|
|
ss << "=" << dt << "(";
|
|
|
|
|
for ( std::map<int,ArgumentPtr>::const_iterator it = args.begin(); it != args.end(); ++ it ) {
|
|
|
|
|
if ( it != args.begin() ) ss << ",";
|
|
|
|
|
const ArgumentPtr a = it->second;
|
|
|
|
|
ss << it->second->toString(upper);
|
|
|
|
|
}
|
|
|
|
|
ss << ")";
|
|
|
|
|
return ss.str();
|
|
|
|
|
}
|
2013-08-04 04:49:08 +00:00
|
|
|
unsigned int IfcWritableEntity::id() {
|
|
|
|
|
if ( !_id ) {
|
|
|
|
|
_id = new int(file->FreshId());
|
|
|
|
|
}
|
|
|
|
|
return *_id;
|
|
|
|
|
}
|
2012-07-19 13:07:55 +00:00
|
|
|
bool IfcWritableEntity::isWritable() { return true; }
|
|
|
|
|
bool IfcWritableEntity::arg_writable(int i) {
|
|
|
|
|
std::map<int,bool>::const_iterator it = writemask.find(i);
|
|
|
|
|
if ( it == writemask.end() ) return false;
|
|
|
|
|
else return it->second;
|
|
|
|
|
}
|
|
|
|
|
void IfcWritableEntity::arg_writable(int i, bool b) {
|
|
|
|
|
writemask[i] = b;
|
|
|
|
|
}
|
2013-08-04 04:49:08 +00:00
|
|
|
|
|
|
|
|
template <typename T> void IfcWritableEntity::_setArgument(int i, const T& t) {
|
2012-08-11 13:24:08 +00:00
|
|
|
if ( arg_writable(i) ) delete args[i];
|
2013-08-04 04:49:08 +00:00
|
|
|
IfcWriteArgument* arg = new IfcWriteArgument(this);
|
|
|
|
|
args[i] = arg;
|
|
|
|
|
arg->set(t);
|
2012-08-11 13:24:08 +00:00
|
|
|
arg_writable(i,true);
|
|
|
|
|
}
|
2013-08-04 04:49:08 +00:00
|
|
|
|
|
|
|
|
void IfcWritableEntity::setArgument(int i) {
|
|
|
|
|
_setArgument(i, boost::none);
|
|
|
|
|
}
|
2012-11-10 09:36:34 +00:00
|
|
|
void IfcWritableEntity::setArgumentDerived(int i) {
|
2013-08-04 04:49:08 +00:00
|
|
|
_setArgument(i, IfcWriteArgument::Derived());
|
2012-11-10 09:36:34 +00:00
|
|
|
}
|
2012-07-19 13:07:55 +00:00
|
|
|
void IfcWritableEntity::setArgument(int i,int v) {
|
2013-08-04 04:49:08 +00:00
|
|
|
_setArgument(i, v);
|
2012-11-04 16:26:33 +00:00
|
|
|
}
|
|
|
|
|
void IfcWritableEntity::setArgument(int i,bool v) {
|
2013-08-04 04:49:08 +00:00
|
|
|
_setArgument(i, v);
|
2012-07-19 13:07:55 +00:00
|
|
|
}
|
|
|
|
|
void IfcWritableEntity::setArgument(int i,int v, const char* c){
|
2013-08-04 04:49:08 +00:00
|
|
|
_setArgument(i, IfcWriteArgument::EnumerationReference(v, c));
|
2012-07-19 13:07:55 +00:00
|
|
|
}
|
|
|
|
|
void IfcWritableEntity::setArgument(int i,const std::string& v){
|
2013-08-04 04:49:08 +00:00
|
|
|
_setArgument(i, v);
|
2012-07-19 13:07:55 +00:00
|
|
|
}
|
|
|
|
|
void IfcWritableEntity::setArgument(int i,double v){
|
2013-08-04 04:49:08 +00:00
|
|
|
_setArgument(i, v);
|
2012-07-19 13:07:55 +00:00
|
|
|
}
|
|
|
|
|
void IfcWritableEntity::setArgument(int i,IfcUtil::IfcSchemaEntity v){
|
2013-08-04 04:49:08 +00:00
|
|
|
if ( v ) {
|
|
|
|
|
_setArgument(i, v);
|
|
|
|
|
} else {
|
|
|
|
|
_setArgument(i, boost::none);
|
|
|
|
|
}
|
2012-07-19 13:07:55 +00:00
|
|
|
}
|
|
|
|
|
void IfcWritableEntity::setArgument(int i,IfcEntities v){
|
2013-08-04 04:49:08 +00:00
|
|
|
if ( v.get() ) {
|
|
|
|
|
_setArgument(i, v);
|
|
|
|
|
} else {
|
|
|
|
|
_setArgument(i, boost::none);
|
|
|
|
|
}
|
2012-07-19 13:07:55 +00:00
|
|
|
}
|
|
|
|
|
void IfcWritableEntity::setArgument(int i,const std::vector<double>& v){
|
2013-08-04 04:49:08 +00:00
|
|
|
_setArgument(i, v);
|
2012-07-19 13:07:55 +00:00
|
|
|
}
|
|
|
|
|
void IfcWritableEntity::setArgument(int i,const std::vector<std::string>& v){
|
2013-08-04 04:49:08 +00:00
|
|
|
_setArgument(i, v);
|
2012-07-19 13:07:55 +00:00
|
|
|
}
|
|
|
|
|
void IfcWritableEntity::setArgument(int i,const std::vector<int>& v){
|
2013-08-04 04:49:08 +00:00
|
|
|
_setArgument(i, v);
|
2012-07-19 13:07:55 +00:00
|
|
|
}
|
|
|
|
|
|
2013-08-04 04:49:08 +00:00
|
|
|
class SizeVisitor : public boost::static_visitor<int> {
|
|
|
|
|
public:
|
|
|
|
|
int operator()(const boost::none_t& i) const { return -1; }
|
|
|
|
|
int operator()(const IfcWriteArgument::Derived& i) const { return -1; }
|
|
|
|
|
int operator()(const int& i) const { return -1; }
|
|
|
|
|
int operator()(const bool& i) const { return -1; }
|
|
|
|
|
int operator()(const double& i) const { return -1; }
|
|
|
|
|
int operator()(const std::string& i) const { return i.size(); }
|
|
|
|
|
int operator()(const std::vector<int>& i) const { return i.size(); }
|
|
|
|
|
int operator()(const std::vector<double>& i) const { return i.size(); }
|
|
|
|
|
int operator()(const std::vector<std::string>& i) const { return i.size(); }
|
|
|
|
|
int operator()(const IfcWriteArgument::EnumerationReference& i) const { return -1; }
|
|
|
|
|
int operator()(const IfcUtil::IfcSchemaEntity& i) const { return -1; }
|
|
|
|
|
int operator()(const IfcEntities& i) const { return i->Size(); }
|
|
|
|
|
};
|
2012-11-10 09:36:34 +00:00
|
|
|
|
2013-08-04 04:49:08 +00:00
|
|
|
class StringBuilderVisitor : public boost::static_visitor<void> {
|
|
|
|
|
private:
|
|
|
|
|
std::ostringstream& data;
|
|
|
|
|
template <typename T> void serialize(const std::vector<T>& i) {
|
|
|
|
|
data << "(";
|
|
|
|
|
for (typename std::vector<T>::const_iterator it = i.begin(); it != i.end(); ++it) {
|
|
|
|
|
if (it != i.begin()) data << ",";
|
|
|
|
|
data << *it;
|
2012-07-19 13:07:55 +00:00
|
|
|
}
|
2013-08-04 04:49:08 +00:00
|
|
|
data << ")";
|
2012-07-19 13:07:55 +00:00
|
|
|
}
|
2013-08-04 04:49:08 +00:00
|
|
|
// The REAL token definition from the IFC SPF standard does not necessarily match
|
|
|
|
|
// the output of the C++ ostream formatting operation.
|
|
|
|
|
// REAL = [ SIGN ] DIGIT { DIGIT } "." { DIGIT } [ "E" [ SIGN ] DIGIT { DIGIT } ] .
|
|
|
|
|
std::string format_double(const double& d) {
|
|
|
|
|
std::ostringstream oss;
|
|
|
|
|
oss << d;
|
|
|
|
|
const std::string str = oss.str();
|
|
|
|
|
oss.str("");
|
|
|
|
|
std::string::size_type e = str.find('e');
|
|
|
|
|
if (e == std::string::npos) {
|
|
|
|
|
e = str.find('E');
|
|
|
|
|
}
|
|
|
|
|
const std::string mantissa = str.substr(0,e);
|
|
|
|
|
oss << mantissa;
|
|
|
|
|
if (mantissa.find('.') == std::string::npos) {
|
|
|
|
|
oss << ".";
|
|
|
|
|
}
|
|
|
|
|
if (e != std::string::npos) {
|
|
|
|
|
oss << "E";
|
|
|
|
|
oss << str.substr(e+1);
|
|
|
|
|
}
|
|
|
|
|
return oss.str();
|
2012-07-19 13:07:55 +00:00
|
|
|
}
|
2013-08-04 04:49:08 +00:00
|
|
|
void serialize_double(const std::vector<double>& i) {
|
|
|
|
|
data << "(";
|
|
|
|
|
for (std::vector<double>::const_iterator it = i.begin(); it != i.end(); ++it) {
|
|
|
|
|
if (it != i.begin()) data << ",";
|
|
|
|
|
data << format_double(*it);
|
|
|
|
|
}
|
|
|
|
|
data << ")";
|
2012-11-04 16:26:33 +00:00
|
|
|
}
|
2013-08-04 04:49:08 +00:00
|
|
|
bool upper;
|
|
|
|
|
public:
|
|
|
|
|
StringBuilderVisitor(std::ostringstream& stream, bool upper = false)
|
|
|
|
|
: data(stream), upper(upper) {}
|
|
|
|
|
void operator()(const boost::none_t& i) { data << "$"; }
|
|
|
|
|
void operator()(const IfcWriteArgument::Derived& i) { data << "*"; }
|
|
|
|
|
void operator()(const int& i) { data << i; }
|
|
|
|
|
void operator()(const bool& i) { data << (i ? ".T." : ".F."); }
|
|
|
|
|
void operator()(const double& i) { data << format_double(i); }
|
|
|
|
|
void operator()(const std::string& i) {
|
|
|
|
|
std::string s = i;
|
|
|
|
|
if (upper) s = IfcCharacterEncoder(s);
|
|
|
|
|
data << s;
|
2012-11-04 16:26:33 +00:00
|
|
|
}
|
2013-08-04 04:49:08 +00:00
|
|
|
void operator()(const std::vector<int>& i) { serialize(i); }
|
|
|
|
|
void operator()(const std::vector<double>& i) { serialize_double(i); }
|
|
|
|
|
void operator()(const std::vector<std::string>& i) { serialize(i); }
|
|
|
|
|
void operator()(const IfcWriteArgument::EnumerationReference& i) {
|
|
|
|
|
data << "." << i.enumeration_value << ".";
|
2012-11-04 16:26:33 +00:00
|
|
|
}
|
2013-08-04 04:49:08 +00:00
|
|
|
void operator()(const IfcUtil::IfcSchemaEntity& i) {
|
|
|
|
|
IfcAbstractEntity* e = i->entity;
|
2012-07-19 13:07:55 +00:00
|
|
|
if ( Ifc2x3::Type::IsSimple(e->type()) ) {
|
2013-08-04 04:49:08 +00:00
|
|
|
data << e->toString(upper);
|
2012-07-19 13:07:55 +00:00
|
|
|
} else {
|
2013-08-04 04:49:08 +00:00
|
|
|
data << "#" << e->id();
|
|
|
|
|
}
|
2012-07-19 13:07:55 +00:00
|
|
|
}
|
2013-08-04 04:49:08 +00:00
|
|
|
void operator()(const IfcEntities& i) {
|
|
|
|
|
data << "(";
|
|
|
|
|
for (IfcEntityList::it it = i->begin(); it != i->end(); ++it) {
|
|
|
|
|
if (it != i->begin()) data << ",";
|
|
|
|
|
(*this)(*it);
|
|
|
|
|
}
|
|
|
|
|
data << ")";
|
|
|
|
|
}
|
|
|
|
|
operator std::string() { return data.str(); }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
IfcWriteArgument::operator int() const { return as<int>(); }
|
|
|
|
|
IfcWriteArgument::operator bool() const { return as<bool>(); }
|
|
|
|
|
IfcWriteArgument::operator double() const { return as<double>(); }
|
|
|
|
|
IfcWriteArgument::operator std::string() const { return as<std::string>(); }
|
|
|
|
|
IfcWriteArgument::operator std::vector<double>() const { return as<std::vector<double> >(); }
|
|
|
|
|
IfcWriteArgument::operator std::vector<int>() const { return as<std::vector<int> >(); }
|
|
|
|
|
IfcWriteArgument::operator std::vector<std::string>() const { return as<std::vector<std::string > >(); }
|
|
|
|
|
IfcWriteArgument::operator IfcUtil::IfcSchemaEntity() const { return as<IfcUtil::IfcSchemaEntity>(); }
|
|
|
|
|
IfcWriteArgument::operator IfcEntities() const { return as<IfcEntities>(); }
|
|
|
|
|
bool IfcWriteArgument::isNull() const { return argumentType() == argument_type_null; }
|
|
|
|
|
ArgumentPtr IfcWriteArgument::operator [] (unsigned int i) const { throw IfcParse::IfcException("Invalid cast"); }
|
|
|
|
|
std::string IfcWriteArgument::toString(bool upper) const {
|
|
|
|
|
std::ostringstream str;
|
|
|
|
|
StringBuilderVisitor v(str, upper);
|
|
|
|
|
container.apply_visitor(v);
|
|
|
|
|
return v;
|
|
|
|
|
}
|
|
|
|
|
unsigned int IfcWriteArgument::Size() const {
|
|
|
|
|
SizeVisitor v;
|
|
|
|
|
const int size = container.apply_visitor(v);
|
|
|
|
|
if (size == -1) {
|
|
|
|
|
throw IfcParse::IfcException("Invalid cast");
|
|
|
|
|
} else {
|
|
|
|
|
return size;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
IfcWriteArgument::argument_type IfcWriteArgument::argumentType() const {
|
|
|
|
|
return static_cast<argument_type>(container.which());
|
2012-07-19 13:07:55 +00:00
|
|
|
}
|
|
|
|
|
|
2012-11-04 16:26:33 +00:00
|
|
|
IfcEntities IfcSelectHelperEntity::getInverse(Ifc2x3::Type::Enum,int,const std::string &) {throw IfcParse::IfcException("Invalid cast");}
|
|
|
|
|
IfcEntities IfcSelectHelperEntity::getInverse(Ifc2x3::Type::Enum) {throw IfcParse::IfcException("Invalid cast");}
|
2012-07-19 13:07:55 +00:00
|
|
|
std::string IfcSelectHelperEntity::datatype() { return Ifc2x3::Type::ToString(_type); }
|
|
|
|
|
ArgumentPtr IfcSelectHelperEntity::getArgument(unsigned int i) {
|
2012-11-04 16:26:33 +00:00
|
|
|
if ( i != 0 ) throw IfcParse::IfcException("Invalid cast");
|
2012-07-19 13:07:55 +00:00
|
|
|
return arg;
|
|
|
|
|
}
|
|
|
|
|
unsigned int IfcSelectHelperEntity::getArgumentCount() { return 1; }
|
|
|
|
|
Ifc2x3::Type::Enum IfcSelectHelperEntity::type() const { return _type; }
|
|
|
|
|
bool IfcSelectHelperEntity::is(Ifc2x3::Type::Enum t) const { return _type == t; }
|
|
|
|
|
std::string IfcSelectHelperEntity::toString(bool upper) {
|
|
|
|
|
std::stringstream ss;
|
|
|
|
|
std::string dt = datatype();
|
|
|
|
|
if ( upper ) {
|
|
|
|
|
for (std::string::iterator p = dt.begin(); p != dt.end(); ++p ) *p = toupper(*p);
|
|
|
|
|
}
|
|
|
|
|
ss << dt << "(" << arg->toString(upper) << ")";
|
|
|
|
|
return ss.str();
|
|
|
|
|
}
|
2012-11-04 16:26:33 +00:00
|
|
|
unsigned int IfcSelectHelperEntity::id() { throw IfcParse::IfcException("Invalid cast"); }
|
|
|
|
|
bool IfcSelectHelperEntity::isWritable() { throw IfcParse::IfcException("Invalid cast"); }
|
2012-07-19 13:07:55 +00:00
|
|
|
|
|
|
|
|
IfcSelectHelper::IfcSelectHelper(const std::string& v, Ifc2x3::Type::Enum t) {
|
2013-08-04 04:49:08 +00:00
|
|
|
IfcWriteArgument* a = new IfcWriteArgument(0);
|
|
|
|
|
a->set(v);
|
2012-07-19 13:07:55 +00:00
|
|
|
this->entity = new IfcSelectHelperEntity(t,a);
|
|
|
|
|
}
|
|
|
|
|
IfcSelectHelper::IfcSelectHelper(const char* const v, Ifc2x3::Type::Enum t) {
|
2013-08-04 04:49:08 +00:00
|
|
|
IfcWriteArgument* a = new IfcWriteArgument(0);
|
|
|
|
|
a->set<std::string>(v);
|
2012-07-19 13:07:55 +00:00
|
|
|
this->entity = new IfcSelectHelperEntity(t,a);
|
|
|
|
|
}
|
|
|
|
|
IfcSelectHelper::IfcSelectHelper(int v, Ifc2x3::Type::Enum t) {
|
2013-08-04 04:49:08 +00:00
|
|
|
IfcWriteArgument* a = new IfcWriteArgument(0);
|
|
|
|
|
a->set(v);
|
2012-07-19 13:07:55 +00:00
|
|
|
this->entity = new IfcSelectHelperEntity(t,a);
|
|
|
|
|
}
|
2012-09-09 11:55:53 +00:00
|
|
|
IfcSelectHelper::IfcSelectHelper(double v, Ifc2x3::Type::Enum t) {
|
2013-08-04 04:49:08 +00:00
|
|
|
IfcWriteArgument* a = new IfcWriteArgument(0);
|
|
|
|
|
a->set(v);
|
2012-07-19 13:07:55 +00:00
|
|
|
this->entity = new IfcSelectHelperEntity(t,a);
|
|
|
|
|
}
|
|
|
|
|
IfcSelectHelper::IfcSelectHelper(bool v, Ifc2x3::Type::Enum t) {
|
2013-08-04 04:49:08 +00:00
|
|
|
IfcWriteArgument* a = new IfcWriteArgument(0);
|
|
|
|
|
a->set(v);
|
2012-07-19 13:07:55 +00:00
|
|
|
this->entity = new IfcSelectHelperEntity(t,a);
|
|
|
|
|
}
|
|
|
|
|
bool IfcSelectHelper::is(Ifc2x3::Type::Enum t) const { return entity->is(t); }
|
2012-08-11 13:24:08 +00:00
|
|
|
Ifc2x3::Type::Enum IfcSelectHelper::type() const { return entity->type(); }
|
|
|
|
|
|
|
|
|
|
EntityBuffer* EntityBuffer::i = 0;
|
|
|
|
|
EntityBuffer* EntityBuffer::instance() {
|
|
|
|
|
if ( ! i ) {
|
|
|
|
|
i = new EntityBuffer();
|
|
|
|
|
i->buffer = IfcEntities(new IfcEntityList());
|
|
|
|
|
}
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
IfcEntities EntityBuffer::Get() {
|
|
|
|
|
return instance()->buffer;
|
|
|
|
|
}
|
|
|
|
|
void EntityBuffer::Clear() {
|
|
|
|
|
instance()->buffer = IfcEntities(new IfcEntityList());
|
|
|
|
|
}
|
|
|
|
|
void EntityBuffer::Add(IfcUtil::IfcSchemaEntity e) {
|
|
|
|
|
instance()->buffer->push(e);
|
|
|
|
|
}
|