@@ -110,86 +110,106 @@ void IfcParse::IfcLateBoundEntity::invalid_argument(unsigned int i, const std::s
110110 const std::string arg_name = IfcSchema::Type::GetAttributeName (_type,i);
111111 throw IfcException (t + " is not a valid type for '" + arg_name + " '" );
112112}
113- void IfcParse::IfcLateBoundEntity::setArgument (unsigned int i) {
113+ void IfcParse::IfcLateBoundEntity::setArgumentAsNull (unsigned int i) {
114114 bool is_optional = IfcSchema::Type::GetAttributeOptional (_type, i);
115115 if (is_optional) {
116116 writable_entity ()->setArgument (i);
117117 } else invalid_argument (i," NULL" );
118118}
119- void IfcParse::IfcLateBoundEntity::setArgument (unsigned int i, int v) {
119+ void IfcParse::IfcLateBoundEntity::setArgumentAsInt (unsigned int i, int v) {
120120 IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType (_type,i);
121121 if (arg_type == Argument_INT) {
122122 writable_entity ()->setArgument (i,v);
123123 } else if ( (arg_type == Argument_BOOL) && ( (v == 0 ) || (v == 1 ) ) ) {
124124 writable_entity ()->setArgument (i, v == 1 );
125125 } else invalid_argument (i," INTEGER" );
126126}
127- void IfcParse::IfcLateBoundEntity::setArgument (unsigned int i, bool v) {
127+ void IfcParse::IfcLateBoundEntity::setArgumentAsBool (unsigned int i, bool v) {
128128 IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType (_type,i);
129129 if (arg_type == Argument_BOOL) {
130130 writable_entity ()->setArgument (i,v);
131131 } else invalid_argument (i," BOOLEAN" );
132132}
133- void IfcParse::IfcLateBoundEntity::setArgument (unsigned int i, double v) {
133+ void IfcParse::IfcLateBoundEntity::setArgumentAsDouble (unsigned int i, double v) {
134134 IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType (_type,i);
135135 if (arg_type == Argument_DOUBLE) {
136136 writable_entity ()->setArgument (i,v);
137137 } else invalid_argument (i," REAL" );
138138}
139- void IfcParse::IfcLateBoundEntity::setArgument (unsigned int i, const std::string& a) {
139+ void IfcParse::IfcLateBoundEntity::setArgumentAsString (unsigned int i, const std::string& a) {
140140 IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType (_type,i);
141141 if (arg_type == Argument_STRING) {
142142 writable_entity ()->setArgument (i,a);
143143 } else if (arg_type == Argument_ENUMERATION) {
144144 std::pair<const char *, int > enum_data = IfcSchema::Type::GetEnumerationIndex (IfcSchema::Type::GetAttributeEntity (_type, i), a);
145145 writable_entity ()->setArgument (i, enum_data.second , enum_data.first );
146146 } else if (arg_type == Argument_BINARY) {
147- boost::dynamic_bitset<> bits (a);
148- writable_entity ()->setArgument (i, bits);
147+ if (valid_binary_string (a)) {
148+ boost::dynamic_bitset<> bits (a);
149+ writable_entity ()->setArgument (i, bits);
150+ } else {
151+ throw IfcException (" String not a valid binary representation" );
152+ }
149153 } else invalid_argument (i," STRING" );
150154}
151- void IfcParse::IfcLateBoundEntity::setArgument (unsigned int i, const std::vector<int >& v) {
155+ void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfInt (unsigned int i, const std::vector<int >& v) {
152156 IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType (_type,i);
153157 if (arg_type == Argument_AGGREGATE_OF_INT) {
154158 writable_entity ()->setArgument (i,v);
155159 } else invalid_argument (i," AGGREGATE OF INT" );
156160}
157- void IfcParse::IfcLateBoundEntity::setArgument (unsigned int i, const std::vector<double >& v) {
161+ void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfDouble (unsigned int i, const std::vector<double >& v) {
158162 IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType (_type,i);
159163 if (arg_type == Argument_AGGREGATE_OF_DOUBLE) {
160164 writable_entity ()->setArgument (i,v);
161165 } else invalid_argument (i," AGGREGATE OF DOUBLE" );
162166}
163- void IfcParse::IfcLateBoundEntity::setArgument (unsigned int i, const std::vector<std::string>& v) {
167+ void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfString (unsigned int i, const std::vector<std::string>& v) {
164168 IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType (_type,i);
165169 if (arg_type == Argument_AGGREGATE_OF_STRING) {
166170 writable_entity ()->setArgument (i,v);
167171 } else if (arg_type == Argument_AGGREGATE_OF_BINARY) {
168172 std::vector< boost::dynamic_bitset<> > bits;
169173 bits.reserve (v.size ());
170174 for (std::vector<std::string>::const_iterator it = v.begin (); it != v.end (); ++it) {
171- bits.push_back (boost::dynamic_bitset<>(*it));
175+ if (valid_binary_string (*it)) {
176+ bits.push_back (boost::dynamic_bitset<>(*it));
177+ } else {
178+ throw IfcException (" String not a valid binary representation" );
179+ }
172180 }
173181 writable_entity ()->setArgument (i, bits);
174182 } else invalid_argument (i," AGGREGATE OF STRING" );
175183}
176- void IfcParse::IfcLateBoundEntity::setArgument (unsigned int i, IfcParse::IfcLateBoundEntity* v) {
184+ void IfcParse::IfcLateBoundEntity::setArgumentAsEntityInstance (unsigned int i, IfcParse::IfcLateBoundEntity* v) {
177185 IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType (_type,i);
178186 if (arg_type == Argument_ENTITY_INSTANCE) {
179187 writable_entity ()->setArgument (i,v);
180188 } else invalid_argument (i," ENTITY INSTANCE" );
181189}
182- void IfcParse::IfcLateBoundEntity::setArgument (unsigned int i, IfcEntityList::ptr v) {
190+ void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfEntityInstance (unsigned int i, IfcEntityList::ptr v) {
183191 IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType (_type,i);
184192 if (arg_type == Argument_AGGREGATE_OF_ENTITY_INSTANCE) {
185193 writable_entity ()->setArgument (i,v);
186194 } else invalid_argument (i," AGGREGATE OF ENTITY INSTANCE" );
187195}
188- std::pair<IfcUtil::ArgumentType,Argument*> IfcParse::IfcLateBoundEntity::get_argument (unsigned i) {
189- return std::pair<IfcUtil::ArgumentType,Argument*>(getArgumentType (i),getArgument (i));
196+ void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfAggregateOfInt (unsigned int i, const std::vector< std::vector<int > >& v) {
197+ IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType (_type,i);
198+ if (arg_type == Argument_AGGREGATE_OF_AGGREGATE_OF_INT) {
199+ writable_entity ()->setArgument (i,v);
200+ } else invalid_argument (i," AGGREGATE OF AGGREGATE OF INT" );
190201}
191- std::pair<IfcUtil::ArgumentType,Argument*> IfcParse::IfcLateBoundEntity::get_argument (const std::string& a) {
192- return get_argument (IfcSchema::Type::GetAttributeIndex (_type,a));
202+ void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfAggregateOfDouble (unsigned int i, const std::vector< std::vector<double > >& v) {
203+ IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType (_type,i);
204+ if (arg_type == Argument_AGGREGATE_OF_AGGREGATE_OF_DOUBLE) {
205+ writable_entity ()->setArgument (i,v);
206+ } else invalid_argument (i," AGGREGATE OF AGGREGATE OF DOUBLE" );
207+ }
208+ void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfAggregateOfEntityInstance (unsigned int i, IfcEntityListList::ptr v) {
209+ IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType (_type,i);
210+ if (arg_type == Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE) {
211+ writable_entity ()->setArgument (i,v);
212+ } else invalid_argument (i," AGGREGATE OF AGGREGATE OF ENTITY INSTANCE" );
193213}
194214unsigned IfcParse::IfcLateBoundEntity::getArgumentIndex (const std::string& a) const {
195215 return IfcSchema::Type::GetAttributeIndex (_type,a);
0 commit comments