/* 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/IfcActorSelect.h"
#include "ifcpp/IFC4/include/IfcDateTime.h"
#include "ifcpp/IFC4/include/IfcLabel.h"
#include "ifcpp/IFC4/include/IfcLibraryInformation.h"
#include "ifcpp/IFC4/include/IfcLibraryReference.h"
#include "ifcpp/IFC4/include/IfcRelAssociatesLibrary.h"
#include "ifcpp/IFC4/include/IfcText.h"
#include "ifcpp/IFC4/include/IfcURIReference.h"

// ENTITY IfcLibraryInformation 
IfcLibraryInformation::IfcLibraryInformation( int id ) { m_entity_id = id; }
IfcLibraryInformation::~IfcLibraryInformation() {}
shared_ptr<BuildingObject> IfcLibraryInformation::getDeepCopy( BuildingCopyOptions& options )
{
	shared_ptr<IfcLibraryInformation> copy_self( new IfcLibraryInformation() );
	if( m_Name ) { copy_self->m_Name = dynamic_pointer_cast<IfcLabel>( m_Name->getDeepCopy(options) ); }
	if( m_Version ) { copy_self->m_Version = dynamic_pointer_cast<IfcLabel>( m_Version->getDeepCopy(options) ); }
	if( m_Publisher ) { copy_self->m_Publisher = dynamic_pointer_cast<IfcActorSelect>( m_Publisher->getDeepCopy(options) ); }
	if( m_VersionDate ) { copy_self->m_VersionDate = dynamic_pointer_cast<IfcDateTime>( m_VersionDate->getDeepCopy(options) ); }
	if( m_Location ) { copy_self->m_Location = dynamic_pointer_cast<IfcURIReference>( m_Location->getDeepCopy(options) ); }
	if( m_Description ) { copy_self->m_Description = dynamic_pointer_cast<IfcText>( m_Description->getDeepCopy(options) ); }
	return copy_self;
}
void IfcLibraryInformation::getStepLine( std::stringstream& stream ) const
{
	stream << "#" << m_entity_id << "= IFCLIBRARYINFORMATION" << "(";
	if( m_Name ) { m_Name->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_Version ) { m_Version->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_Publisher ) { m_Publisher->getStepParameter( stream, true ); } else { stream << "$" ; }
	stream << ",";
	if( m_VersionDate ) { m_VersionDate->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_Location ) { m_Location->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_Description ) { m_Description->getStepParameter( stream ); } else { stream << "$"; }
	stream << ");";
}
void IfcLibraryInformation::getStepParameter( std::stringstream& stream, bool ) const { stream << "#" << m_entity_id; }
const std::wstring IfcLibraryInformation::toString() const { return L"IfcLibraryInformation"; }
void IfcLibraryInformation::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 != 6 ){ std::stringstream err; err << "Wrong parameter count for entity IfcLibraryInformation, expecting 6, having " << num_args << ". Entity ID: " << m_entity_id << std::endl; throw BuildingException( err.str().c_str() ); }
	m_Name = IfcLabel::createObjectFromSTEP( args[0], map );
	m_Version = IfcLabel::createObjectFromSTEP( args[1], map );
	m_Publisher = IfcActorSelect::createObjectFromSTEP( args[2], map );
	m_VersionDate = IfcDateTime::createObjectFromSTEP( args[3], map );
	m_Location = IfcURIReference::createObjectFromSTEP( args[4], map );
	m_Description = IfcText::createObjectFromSTEP( args[5], map );
}
void IfcLibraryInformation::getAttributes( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const
{
	IfcExternalInformation::getAttributes( vec_attributes );
	vec_attributes.emplace_back( std::make_pair( "Name", m_Name ) );
	vec_attributes.emplace_back( std::make_pair( "Version", m_Version ) );
	vec_attributes.emplace_back( std::make_pair( "Publisher", m_Publisher ) );
	vec_attributes.emplace_back( std::make_pair( "VersionDate", m_VersionDate ) );
	vec_attributes.emplace_back( std::make_pair( "Location", m_Location ) );
	vec_attributes.emplace_back( std::make_pair( "Description", m_Description ) );
}
void IfcLibraryInformation::getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes_inverse ) const
{
	IfcExternalInformation::getAttributesInverse( vec_attributes_inverse );
	if( !m_LibraryInfoForObjects_inverse.empty() )
	{
		shared_ptr<AttributeObjectVector> LibraryInfoForObjects_inverse_vec_obj( new AttributeObjectVector() );
		for( size_t i=0; i<m_LibraryInfoForObjects_inverse.size(); ++i )
		{
			if( !m_LibraryInfoForObjects_inverse[i].expired() )
			{
				LibraryInfoForObjects_inverse_vec_obj->m_vec.emplace_back( shared_ptr<IfcRelAssociatesLibrary>( m_LibraryInfoForObjects_inverse[i] ) );
			}
		}
		vec_attributes_inverse.emplace_back( std::make_pair( "LibraryInfoForObjects_inverse", LibraryInfoForObjects_inverse_vec_obj ) );
	}
	if( !m_HasLibraryReferences_inverse.empty() )
	{
		shared_ptr<AttributeObjectVector> HasLibraryReferences_inverse_vec_obj( new AttributeObjectVector() );
		for( size_t i=0; i<m_HasLibraryReferences_inverse.size(); ++i )
		{
			if( !m_HasLibraryReferences_inverse[i].expired() )
			{
				HasLibraryReferences_inverse_vec_obj->m_vec.emplace_back( shared_ptr<IfcLibraryReference>( m_HasLibraryReferences_inverse[i] ) );
			}
		}
		vec_attributes_inverse.emplace_back( std::make_pair( "HasLibraryReferences_inverse", HasLibraryReferences_inverse_vec_obj ) );
	}
}
void IfcLibraryInformation::setInverseCounterparts( shared_ptr<BuildingEntity> ptr_self_entity )
{
	IfcExternalInformation::setInverseCounterparts( ptr_self_entity );
}
void IfcLibraryInformation::unlinkFromInverseCounterparts()
{
	IfcExternalInformation::unlinkFromInverseCounterparts();
}
