/* Code generated by IfcQuery EXPRESS generator, www.ifcquery.com */
#include <sstream>
#include <limits>

#include "ifcpp/model/AttributeObject.h"
#include "ifcpp/model/BuildingException.h"
#include "ifcpp/model/BuildingGuid.h"
#include "ifcpp/reader/ReaderUtil.h"
#include "ifcpp/writer/WriterUtil.h"
#include "ifcpp/IFC4/include/IfcMeasureWithUnit.h"
#include "ifcpp/IFC4/include/IfcUnit.h"
#include "ifcpp/IFC4/include/IfcValue.h"

// ENTITY IfcMeasureWithUnit 
IfcMeasureWithUnit::IfcMeasureWithUnit( int id ) { m_entity_id = id; }
IfcMeasureWithUnit::~IfcMeasureWithUnit() {}
shared_ptr<BuildingObject> IfcMeasureWithUnit::getDeepCopy( BuildingCopyOptions& options )
{
	shared_ptr<IfcMeasureWithUnit> copy_self( new IfcMeasureWithUnit() );
	if( m_ValueComponent ) { copy_self->m_ValueComponent = dynamic_pointer_cast<IfcValue>( m_ValueComponent->getDeepCopy(options) ); }
	if( m_UnitComponent ) { copy_self->m_UnitComponent = dynamic_pointer_cast<IfcUnit>( m_UnitComponent->getDeepCopy(options) ); }
	return copy_self;
}
void IfcMeasureWithUnit::getStepLine( std::stringstream& stream ) const
{
	stream << "#" << m_entity_id << "= IFCMEASUREWITHUNIT" << "(";
	if( m_ValueComponent ) { m_ValueComponent->getStepParameter( stream, true ); } else { stream << "$" ; }
	stream << ",";
	if( m_UnitComponent ) { m_UnitComponent->getStepParameter( stream, true ); } else { stream << "$" ; }
	stream << ");";
}
void IfcMeasureWithUnit::getStepParameter( std::stringstream& stream, bool ) const { stream << "#" << m_entity_id; }
const std::wstring IfcMeasureWithUnit::toString() const { return L"IfcMeasureWithUnit"; }
void IfcMeasureWithUnit::readStepArguments( const std::vector<std::wstring>& args, const std::map<int,shared_ptr<BuildingEntity> >& map )
{
	const size_t num_args = args.size();
	if( num_args != 2 ){ std::stringstream err; err << "Wrong parameter count for entity IfcMeasureWithUnit, expecting 2, having " << num_args << ". Entity ID: " << m_entity_id << std::endl; throw BuildingException( err.str().c_str() ); }
	m_ValueComponent = IfcValue::createObjectFromSTEP( args[0], map );
	m_UnitComponent = IfcUnit::createObjectFromSTEP( args[1], map );
}
void IfcMeasureWithUnit::getAttributes( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const
{
	vec_attributes.emplace_back( std::make_pair( "ValueComponent", m_ValueComponent ) );
	vec_attributes.emplace_back( std::make_pair( "UnitComponent", m_UnitComponent ) );
}
void IfcMeasureWithUnit::getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes_inverse ) const
{
}
void IfcMeasureWithUnit::setInverseCounterparts( shared_ptr<BuildingEntity> )
{
}
void IfcMeasureWithUnit::unlinkFromInverseCounterparts()
{
}
