/* 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/IfcDirectionSenseEnum.h"
#include "ifcpp/IFC4/include/IfcLayerSetDirectionEnum.h"
#include "ifcpp/IFC4/include/IfcLengthMeasure.h"
#include "ifcpp/IFC4/include/IfcMaterialLayerSet.h"
#include "ifcpp/IFC4/include/IfcMaterialLayerSetUsage.h"
#include "ifcpp/IFC4/include/IfcPositiveLengthMeasure.h"
#include "ifcpp/IFC4/include/IfcRelAssociatesMaterial.h"

// ENTITY IfcMaterialLayerSetUsage 
IfcMaterialLayerSetUsage::IfcMaterialLayerSetUsage( int id ) { m_entity_id = id; }
IfcMaterialLayerSetUsage::~IfcMaterialLayerSetUsage() {}
shared_ptr<BuildingObject> IfcMaterialLayerSetUsage::getDeepCopy( BuildingCopyOptions& options )
{
	shared_ptr<IfcMaterialLayerSetUsage> copy_self( new IfcMaterialLayerSetUsage() );
	if( m_ForLayerSet ) { copy_self->m_ForLayerSet = dynamic_pointer_cast<IfcMaterialLayerSet>( m_ForLayerSet->getDeepCopy(options) ); }
	if( m_LayerSetDirection ) { copy_self->m_LayerSetDirection = dynamic_pointer_cast<IfcLayerSetDirectionEnum>( m_LayerSetDirection->getDeepCopy(options) ); }
	if( m_DirectionSense ) { copy_self->m_DirectionSense = dynamic_pointer_cast<IfcDirectionSenseEnum>( m_DirectionSense->getDeepCopy(options) ); }
	if( m_OffsetFromReferenceLine ) { copy_self->m_OffsetFromReferenceLine = dynamic_pointer_cast<IfcLengthMeasure>( m_OffsetFromReferenceLine->getDeepCopy(options) ); }
	if( m_ReferenceExtent ) { copy_self->m_ReferenceExtent = dynamic_pointer_cast<IfcPositiveLengthMeasure>( m_ReferenceExtent->getDeepCopy(options) ); }
	return copy_self;
}
void IfcMaterialLayerSetUsage::getStepLine( std::stringstream& stream ) const
{
	stream << "#" << m_entity_id << "= IFCMATERIALLAYERSETUSAGE" << "(";
	if( m_ForLayerSet ) { stream << "#" << m_ForLayerSet->m_entity_id; } else { stream << "$"; }
	stream << ",";
	if( m_LayerSetDirection ) { m_LayerSetDirection->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_DirectionSense ) { m_DirectionSense->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_OffsetFromReferenceLine ) { m_OffsetFromReferenceLine->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_ReferenceExtent ) { m_ReferenceExtent->getStepParameter( stream ); } else { stream << "$"; }
	stream << ");";
}
void IfcMaterialLayerSetUsage::getStepParameter( std::stringstream& stream, bool ) const { stream << "#" << m_entity_id; }
const std::wstring IfcMaterialLayerSetUsage::toString() const { return L"IfcMaterialLayerSetUsage"; }
void IfcMaterialLayerSetUsage::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 != 5 ){ std::stringstream err; err << "Wrong parameter count for entity IfcMaterialLayerSetUsage, expecting 5, having " << num_args << ". Entity ID: " << m_entity_id << std::endl; throw BuildingException( err.str().c_str() ); }
	readEntityReference( args[0], m_ForLayerSet, map );
	m_LayerSetDirection = IfcLayerSetDirectionEnum::createObjectFromSTEP( args[1], map );
	m_DirectionSense = IfcDirectionSenseEnum::createObjectFromSTEP( args[2], map );
	m_OffsetFromReferenceLine = IfcLengthMeasure::createObjectFromSTEP( args[3], map );
	m_ReferenceExtent = IfcPositiveLengthMeasure::createObjectFromSTEP( args[4], map );
}
void IfcMaterialLayerSetUsage::getAttributes( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const
{
	IfcMaterialUsageDefinition::getAttributes( vec_attributes );
	vec_attributes.emplace_back( std::make_pair( "ForLayerSet", m_ForLayerSet ) );
	vec_attributes.emplace_back( std::make_pair( "LayerSetDirection", m_LayerSetDirection ) );
	vec_attributes.emplace_back( std::make_pair( "DirectionSense", m_DirectionSense ) );
	vec_attributes.emplace_back( std::make_pair( "OffsetFromReferenceLine", m_OffsetFromReferenceLine ) );
	vec_attributes.emplace_back( std::make_pair( "ReferenceExtent", m_ReferenceExtent ) );
}
void IfcMaterialLayerSetUsage::getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes_inverse ) const
{
	IfcMaterialUsageDefinition::getAttributesInverse( vec_attributes_inverse );
}
void IfcMaterialLayerSetUsage::setInverseCounterparts( shared_ptr<BuildingEntity> ptr_self_entity )
{
	IfcMaterialUsageDefinition::setInverseCounterparts( ptr_self_entity );
}
void IfcMaterialLayerSetUsage::unlinkFromInverseCounterparts()
{
	IfcMaterialUsageDefinition::unlinkFromInverseCounterparts();
}
