/* 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/IfcFace.h"
#include "ifcpp/IFC4/include/IfcFaceBound.h"
#include "ifcpp/IFC4/include/IfcPresentationLayerAssignment.h"
#include "ifcpp/IFC4/include/IfcStyledItem.h"
#include "ifcpp/IFC4/include/IfcTextureMap.h"

// ENTITY IfcFace 
IfcFace::IfcFace( int id ) { m_entity_id = id; }
IfcFace::~IfcFace() {}
shared_ptr<BuildingObject> IfcFace::getDeepCopy( BuildingCopyOptions& options )
{
	shared_ptr<IfcFace> copy_self( new IfcFace() );
	for( size_t ii=0; ii<m_Bounds.size(); ++ii )
	{
		auto item_ii = m_Bounds[ii];
		if( item_ii )
		{
			copy_self->m_Bounds.emplace_back( dynamic_pointer_cast<IfcFaceBound>(item_ii->getDeepCopy(options) ) );
		}
	}
	return copy_self;
}
void IfcFace::getStepLine( std::stringstream& stream ) const
{
	stream << "#" << m_entity_id << "= IFCFACE" << "(";
	writeEntityList( stream, m_Bounds );
	stream << ");";
}
void IfcFace::getStepParameter( std::stringstream& stream, bool ) const { stream << "#" << m_entity_id; }
const std::wstring IfcFace::toString() const { return L"IfcFace"; }
void IfcFace::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 != 1 ){ std::stringstream err; err << "Wrong parameter count for entity IfcFace, expecting 1, having " << num_args << ". Entity ID: " << m_entity_id << std::endl; throw BuildingException( err.str().c_str() ); }
	readEntityReferenceList( args[0], m_Bounds, map );
}
void IfcFace::getAttributes( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const
{
	IfcTopologicalRepresentationItem::getAttributes( vec_attributes );
	if( !m_Bounds.empty() )
	{
		shared_ptr<AttributeObjectVector> Bounds_vec_object( new AttributeObjectVector() );
		std::copy( m_Bounds.begin(), m_Bounds.end(), std::back_inserter( Bounds_vec_object->m_vec ) );
		vec_attributes.emplace_back( std::make_pair( "Bounds", Bounds_vec_object ) );
	}
}
void IfcFace::getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes_inverse ) const
{
	IfcTopologicalRepresentationItem::getAttributesInverse( vec_attributes_inverse );
	if( !m_HasTextureMaps_inverse.empty() )
	{
		shared_ptr<AttributeObjectVector> HasTextureMaps_inverse_vec_obj( new AttributeObjectVector() );
		for( size_t i=0; i<m_HasTextureMaps_inverse.size(); ++i )
		{
			if( !m_HasTextureMaps_inverse[i].expired() )
			{
				HasTextureMaps_inverse_vec_obj->m_vec.emplace_back( shared_ptr<IfcTextureMap>( m_HasTextureMaps_inverse[i] ) );
			}
		}
		vec_attributes_inverse.emplace_back( std::make_pair( "HasTextureMaps_inverse", HasTextureMaps_inverse_vec_obj ) );
	}
}
void IfcFace::setInverseCounterparts( shared_ptr<BuildingEntity> ptr_self_entity )
{
	IfcTopologicalRepresentationItem::setInverseCounterparts( ptr_self_entity );
}
void IfcFace::unlinkFromInverseCounterparts()
{
	IfcTopologicalRepresentationItem::unlinkFromInverseCounterparts();
}
