/* 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/IfcBinary.h"
#include "ifcpp/IFC4/include/IfcBlobTexture.h"
#include "ifcpp/IFC4/include/IfcBoolean.h"
#include "ifcpp/IFC4/include/IfcCartesianTransformationOperator2D.h"
#include "ifcpp/IFC4/include/IfcIdentifier.h"
#include "ifcpp/IFC4/include/IfcSurfaceStyleWithTextures.h"
#include "ifcpp/IFC4/include/IfcTextureCoordinate.h"

// ENTITY IfcBlobTexture 
IfcBlobTexture::IfcBlobTexture( int id ) { m_entity_id = id; }
IfcBlobTexture::~IfcBlobTexture() {}
shared_ptr<BuildingObject> IfcBlobTexture::getDeepCopy( BuildingCopyOptions& options )
{
	shared_ptr<IfcBlobTexture> copy_self( new IfcBlobTexture() );
	if( m_RepeatS ) { copy_self->m_RepeatS = dynamic_pointer_cast<IfcBoolean>( m_RepeatS->getDeepCopy(options) ); }
	if( m_RepeatT ) { copy_self->m_RepeatT = dynamic_pointer_cast<IfcBoolean>( m_RepeatT->getDeepCopy(options) ); }
	if( m_Mode ) { copy_self->m_Mode = dynamic_pointer_cast<IfcIdentifier>( m_Mode->getDeepCopy(options) ); }
	if( m_TextureTransform ) { copy_self->m_TextureTransform = dynamic_pointer_cast<IfcCartesianTransformationOperator2D>( m_TextureTransform->getDeepCopy(options) ); }
	for( size_t ii=0; ii<m_Parameter.size(); ++ii )
	{
		auto item_ii = m_Parameter[ii];
		if( item_ii )
		{
			copy_self->m_Parameter.emplace_back( dynamic_pointer_cast<IfcIdentifier>(item_ii->getDeepCopy(options) ) );
		}
	}
	if( m_RasterFormat ) { copy_self->m_RasterFormat = dynamic_pointer_cast<IfcIdentifier>( m_RasterFormat->getDeepCopy(options) ); }
	if( m_RasterCode ) { copy_self->m_RasterCode = dynamic_pointer_cast<IfcBinary>( m_RasterCode->getDeepCopy(options) ); }
	return copy_self;
}
void IfcBlobTexture::getStepLine( std::stringstream& stream ) const
{
	stream << "#" << m_entity_id << "= IFCBLOBTEXTURE" << "(";
	if( m_RepeatS ) { m_RepeatS->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_RepeatT ) { m_RepeatT->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_Mode ) { m_Mode->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_TextureTransform ) { stream << "#" << m_TextureTransform->m_entity_id; } else { stream << "$"; }
	stream << ",";
	stream << "(";
	for( size_t ii = 0; ii < m_Parameter.size(); ++ii )
	{
		if( ii > 0 )
		{
			stream << ",";
		}
		const shared_ptr<IfcIdentifier>& type_object = m_Parameter[ii];
		if( type_object )
		{
			type_object->getStepParameter( stream, false );
		}
		else
		{
			stream << "$";
		}
	}
	stream << ")";
	stream << ",";
	if( m_RasterFormat ) { m_RasterFormat->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_RasterCode ) { m_RasterCode->getStepParameter( stream ); } else { stream << "$"; }
	stream << ");";
}
void IfcBlobTexture::getStepParameter( std::stringstream& stream, bool ) const { stream << "#" << m_entity_id; }
const std::wstring IfcBlobTexture::toString() const { return L"IfcBlobTexture"; }
void IfcBlobTexture::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 != 7 ){ std::stringstream err; err << "Wrong parameter count for entity IfcBlobTexture, expecting 7, having " << num_args << ". Entity ID: " << m_entity_id << std::endl; throw BuildingException( err.str().c_str() ); }
	m_RepeatS = IfcBoolean::createObjectFromSTEP( args[0], map );
	m_RepeatT = IfcBoolean::createObjectFromSTEP( args[1], map );
	m_Mode = IfcIdentifier::createObjectFromSTEP( args[2], map );
	readEntityReference( args[3], m_TextureTransform, map );
	readTypeOfStringList( args[4], m_Parameter );
	m_RasterFormat = IfcIdentifier::createObjectFromSTEP( args[5], map );
	m_RasterCode = IfcBinary::createObjectFromSTEP( args[6], map );
}
void IfcBlobTexture::getAttributes( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const
{
	IfcSurfaceTexture::getAttributes( vec_attributes );
	vec_attributes.emplace_back( std::make_pair( "RasterFormat", m_RasterFormat ) );
	vec_attributes.emplace_back( std::make_pair( "RasterCode", m_RasterCode ) );
}
void IfcBlobTexture::getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes_inverse ) const
{
	IfcSurfaceTexture::getAttributesInverse( vec_attributes_inverse );
}
void IfcBlobTexture::setInverseCounterparts( shared_ptr<BuildingEntity> ptr_self_entity )
{
	IfcSurfaceTexture::setInverseCounterparts( ptr_self_entity );
}
void IfcBlobTexture::unlinkFromInverseCounterparts()
{
	IfcSurfaceTexture::unlinkFromInverseCounterparts();
}
