#include "IfcEntityInstanceData.h" #include "IfcBaseClass.h" // @todo is size() still needed? class SizeVisitor { public: typedef int result_type; int operator()(const Blank& /*i*/) const { return -1; } int operator()(const Derived& /*i*/) const { return -1; } int operator()(const int& /*i*/) const { return -1; } int operator()(const bool& /*i*/) const { return -1; } int operator()(const boost::logic::tribool& /*i*/) const { return -1; } int operator()(const double& /*i*/) const { return -1; } int operator()(const std::string& /*i*/) const { return -1; } int operator()(const boost::dynamic_bitset<>& /*i*/) const { return -1; } int operator()(const empty_aggregate_t& /*unused*/) const { return 0; } int operator()(const empty_aggregate_of_aggregate_t& /*unused*/) const { return 0; } int operator()(const std::vector& i) const { return (int)i.size(); } int operator()(const std::vector& i) const { return (int)i.size(); } int operator()(const std::vector>& i) const { return (int)i.size(); } int operator()(const std::vector>& i) const { return (int)i.size(); } int operator()(const std::vector& i) const { return (int)i.size(); } int operator()(const std::vector>& i) const { return (int)i.size(); } int operator()(const EnumerationReference& /*i*/) const { return -1; } int operator()(const IfcUtil::IfcBaseClass* const& /*i*/) const { return -1; } int operator()(const aggregate_of_instance::ptr& i) const { return i->size(); } int operator()(const aggregate_of_aggregate_of_instance::ptr& i) const { return i->size(); } }; AttributeValue::operator int() const { return array_->get(index_); } AttributeValue::operator bool() const { return array_->get(index_); } AttributeValue::operator double() const { return array_->get(index_); } AttributeValue::operator boost::logic::tribool() const { if (array_->has(index_)) { return array_->get(index_); } return array_->get(index_); } AttributeValue::operator std::string() const { if (array_->has(index_)) { // @todo this is silly, but the way things currently work, // @todo also we don't really need to store a reference to the enumeration type, when this same type is already stored on the definition of the entity and no other value can be provided. return array_->get(index_).value(); } return array_->get(index_); } AttributeValue::operator boost::dynamic_bitset<>() const { return array_->get>(index_); } AttributeValue::operator IfcUtil::IfcBaseClass* () const { return array_->get(index_); } AttributeValue::operator std::vector() const { return array_->get>(index_); } AttributeValue::operator std::vector() const { return array_->get>(index_); } AttributeValue::operator std::vector() const { return array_->get>(index_); } AttributeValue::operator std::vector>() const { return array_->get>>(index_); } AttributeValue::operator boost::shared_ptr() const { return array_->get>(index_); } AttributeValue::operator std::vector>() const { return array_->get>>(index_); } AttributeValue::operator std::vector>() const { return array_->get>>(index_); } AttributeValue::operator boost::shared_ptr() const { return array_->get>(index_); } bool AttributeValue::isNull() const { return array_->has(index_); } unsigned int AttributeValue::size() const { return array_->apply_visitor(SizeVisitor{}, index_); } IfcUtil::ArgumentType AttributeValue::type() const { return static_cast(array_->index(index_)); }