mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
Add support for aggregate of bool
This commit is contained in:
@@ -169,6 +169,10 @@ void IfcWritableEntity::setArgument(int i, Argument* a) {
|
||||
std::vector<int> attr_value = *a;
|
||||
this->setArgument(i, attr_value); }
|
||||
break;
|
||||
case IfcUtil::Argument_AGGREGATE_OF_BOOL: {
|
||||
std::vector<bool> attr_value = *a;
|
||||
this->setArgument(i, attr_value); }
|
||||
break;
|
||||
case IfcUtil::Argument_AGGREGATE_OF_DOUBLE: {
|
||||
std::vector<double> attr_value = *a;
|
||||
this->setArgument(i, attr_value); }
|
||||
@@ -204,6 +208,10 @@ void IfcWritableEntity::setArgument(int i, Argument* a) {
|
||||
std::vector< std::vector<int> > attr_value = *a;
|
||||
this->setArgument(i, attr_value); }
|
||||
break;
|
||||
case IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_BOOL: {
|
||||
std::vector< std::vector<bool> > attr_value = *a;
|
||||
this->setArgument(i, attr_value); }
|
||||
break;
|
||||
case IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_DOUBLE: {
|
||||
std::vector< std::vector<double> > attr_value = *a;
|
||||
this->setArgument(i, attr_value); }
|
||||
@@ -270,19 +278,25 @@ void IfcWritableEntity::setArgument(int i,IfcEntityListList::ptr v){
|
||||
_setArgument(i, boost::none);
|
||||
}
|
||||
}
|
||||
void IfcWritableEntity::setArgument(int i,const std::vector<double>& v){
|
||||
void IfcWritableEntity::setArgument(int i,const std::vector<int>& v){
|
||||
_setArgument(i, v);
|
||||
}
|
||||
void IfcWritableEntity::setArgument(int i,const std::vector< std::vector<double> >& v){
|
||||
void IfcWritableEntity::setArgument(int i,const std::vector<bool>& v){
|
||||
_setArgument(i, v);
|
||||
}
|
||||
void IfcWritableEntity::setArgument(int i,const std::vector<double>& v){
|
||||
_setArgument(i, v);
|
||||
}
|
||||
void IfcWritableEntity::setArgument(int i,const std::vector<std::string>& v){
|
||||
_setArgument(i, v);
|
||||
}
|
||||
void IfcWritableEntity::setArgument(int i,const std::vector<int>& v){
|
||||
void IfcWritableEntity::setArgument(int i,const std::vector< std::vector<int> >& v){
|
||||
_setArgument(i, v);
|
||||
}
|
||||
void IfcWritableEntity::setArgument(int i,const std::vector< std::vector<int> >& v){
|
||||
void IfcWritableEntity::setArgument(int i,const std::vector< std::vector<bool> >& v){
|
||||
_setArgument(i, v);
|
||||
}
|
||||
void IfcWritableEntity::setArgument(int i,const std::vector< std::vector<double> >& v){
|
||||
_setArgument(i, v);
|
||||
}
|
||||
void IfcWritableEntity::setArgument(int i,const std::vector< boost::dynamic_bitset<> >& v){
|
||||
@@ -299,8 +313,10 @@ public:
|
||||
int operator()(const std::string& /*i*/) const { return -1; }
|
||||
int operator()(const boost::dynamic_bitset<>& /*i*/) const { return -1; }
|
||||
int operator()(const std::vector<int>& i) const { return (int)i.size(); }
|
||||
int operator()(const std::vector<bool>& i) const { return (int)i.size(); }
|
||||
int operator()(const std::vector<double>& i) const { return (int)i.size(); }
|
||||
int operator()(const std::vector< std::vector<int> >& i) const { return (int)i.size(); }
|
||||
int operator()(const std::vector< std::vector<bool> >& i) const { return (int)i.size(); }
|
||||
int operator()(const std::vector< std::vector<double> >& i) const { return (int)i.size(); }
|
||||
int operator()(const std::vector<std::string>& i) const { return (int)i.size(); }
|
||||
int operator()(const std::vector< boost::dynamic_bitset<> >& i) const { return (int)i.size(); }
|
||||
@@ -349,6 +365,10 @@ private:
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::string format_bool(bool b) {
|
||||
return b ? ".T." : ".F.";
|
||||
}
|
||||
|
||||
std::string format_binary(const boost::dynamic_bitset<>& b) {
|
||||
std::ostringstream oss;
|
||||
oss.imbue(std::locale::classic());
|
||||
@@ -376,7 +396,7 @@ public:
|
||||
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 bool& i) { data << format_bool(i); }
|
||||
void operator()(const double& i) { data << format_double(i); }
|
||||
void operator()(const boost::dynamic_bitset<>& i) { data << format_binary(i); }
|
||||
void operator()(const std::string& i) {
|
||||
@@ -388,6 +408,7 @@ public:
|
||||
}
|
||||
}
|
||||
void operator()(const std::vector<int>& i);
|
||||
void operator()(const std::vector<bool>& i);
|
||||
void operator()(const std::vector<double>& i);
|
||||
void operator()(const std::vector<std::string>& i);
|
||||
void operator()(const std::vector< boost::dynamic_bitset<> >& i);
|
||||
@@ -411,6 +432,7 @@ public:
|
||||
data << ")";
|
||||
}
|
||||
void operator()(const std::vector< std::vector<int> >& i);
|
||||
void operator()(const std::vector< std::vector<bool> >& i);
|
||||
void operator()(const std::vector< std::vector<double> >& i);
|
||||
void operator()(const IfcEntityListList::ptr& i) {
|
||||
data << "(";
|
||||
@@ -453,6 +475,16 @@ void StringBuilderVisitor::serialize(const std::vector<double>& i) {
|
||||
data << ")";
|
||||
}
|
||||
|
||||
template <>
|
||||
void StringBuilderVisitor::serialize(const std::vector<bool>& i) {
|
||||
data << "(";
|
||||
for (std::vector<bool>::const_iterator it = i.begin(); it != i.end(); ++it) {
|
||||
if (it != i.begin()) data << ",";
|
||||
data << format_bool(*it);
|
||||
}
|
||||
data << ")";
|
||||
}
|
||||
|
||||
template <>
|
||||
void StringBuilderVisitor::serialize(const std::vector< boost::dynamic_bitset<> >& i) {
|
||||
data << "(";
|
||||
@@ -464,6 +496,7 @@ void StringBuilderVisitor::serialize(const std::vector< boost::dynamic_bitset<>
|
||||
}
|
||||
|
||||
void StringBuilderVisitor::operator()(const std::vector<int>& i) { serialize(i); }
|
||||
void StringBuilderVisitor::operator()(const std::vector<bool>& i) { serialize(i); }
|
||||
void StringBuilderVisitor::operator()(const std::vector<double>& i) { serialize(i); }
|
||||
void StringBuilderVisitor::operator()(const std::vector<std::string>& i) { serialize(i); }
|
||||
void StringBuilderVisitor::operator()(const std::vector< boost::dynamic_bitset<> >& i) { serialize(i); }
|
||||
@@ -475,6 +508,14 @@ void StringBuilderVisitor::operator()(const std::vector< std::vector<int> >& i)
|
||||
}
|
||||
data << ")";
|
||||
}
|
||||
void StringBuilderVisitor::operator()(const std::vector< std::vector<bool> >& i) {
|
||||
data << "(";
|
||||
for (std::vector< std::vector<bool> >::const_iterator it = i.begin(); it != i.end(); ++it) {
|
||||
if (it != i.begin()) data << ",";
|
||||
serialize(*it);
|
||||
}
|
||||
data << ")";
|
||||
}
|
||||
void StringBuilderVisitor::operator()(const std::vector< std::vector<double> >& i) {
|
||||
data << "(";
|
||||
for (std::vector< std::vector<double> >::const_iterator it = i.begin(); it != i.end(); ++it) {
|
||||
@@ -495,12 +536,14 @@ IfcWriteArgument::operator std::string() const {
|
||||
}
|
||||
IfcWriteArgument::operator IfcUtil::IfcBaseClass*() const { return as<IfcUtil::IfcBaseClass*>(); }
|
||||
IfcWriteArgument::operator boost::dynamic_bitset<>() const { return as< boost::dynamic_bitset<> >(); }
|
||||
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<bool>() const { return as<std::vector<bool> >(); }
|
||||
IfcWriteArgument::operator std::vector<double>() const { return as<std::vector<double> >(); }
|
||||
IfcWriteArgument::operator std::vector<std::string>() const { return as<std::vector<std::string > >(); }
|
||||
IfcWriteArgument::operator std::vector< boost::dynamic_bitset<> >() const { return as< std::vector< boost::dynamic_bitset<> > >(); }
|
||||
IfcWriteArgument::operator IfcEntityList::ptr() const { return as<IfcEntityList::ptr>(); }
|
||||
IfcWriteArgument::operator std::vector< std::vector<int> >() const { return as<std::vector< std::vector<int> > >(); }
|
||||
IfcWriteArgument::operator std::vector< std::vector<bool> >() const { return as<std::vector< std::vector<bool> > >(); }
|
||||
IfcWriteArgument::operator std::vector< std::vector<double> >() const { return as<std::vector< std::vector<double> > >(); }
|
||||
IfcWriteArgument::operator IfcEntityListList::ptr() const { throw; }
|
||||
bool IfcWriteArgument::isNull() const { return type() == IfcUtil::Argument_NULL; }
|
||||
|
||||
Reference in New Issue
Block a user