/* 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/IfcDataOriginEnum.h"
#include "ifcpp/IFC4/include/IfcDateTime.h"
#include "ifcpp/IFC4/include/IfcExternalReferenceRelationship.h"
#include "ifcpp/IFC4/include/IfcIrregularTimeSeries.h"
#include "ifcpp/IFC4/include/IfcIrregularTimeSeriesValue.h"
#include "ifcpp/IFC4/include/IfcLabel.h"
#include "ifcpp/IFC4/include/IfcText.h"
#include "ifcpp/IFC4/include/IfcTimeSeriesDataTypeEnum.h"
#include "ifcpp/IFC4/include/IfcUnit.h"

// ENTITY IfcIrregularTimeSeries 
IfcIrregularTimeSeries::IfcIrregularTimeSeries( int id ) { m_entity_id = id; }
IfcIrregularTimeSeries::~IfcIrregularTimeSeries() {}
shared_ptr<BuildingObject> IfcIrregularTimeSeries::getDeepCopy( BuildingCopyOptions& options )
{
	shared_ptr<IfcIrregularTimeSeries> copy_self( new IfcIrregularTimeSeries() );
	if( m_Name ) { copy_self->m_Name = dynamic_pointer_cast<IfcLabel>( m_Name->getDeepCopy(options) ); }
	if( m_Description ) { copy_self->m_Description = dynamic_pointer_cast<IfcText>( m_Description->getDeepCopy(options) ); }
	if( m_StartTime ) { copy_self->m_StartTime = dynamic_pointer_cast<IfcDateTime>( m_StartTime->getDeepCopy(options) ); }
	if( m_EndTime ) { copy_self->m_EndTime = dynamic_pointer_cast<IfcDateTime>( m_EndTime->getDeepCopy(options) ); }
	if( m_TimeSeriesDataType ) { copy_self->m_TimeSeriesDataType = dynamic_pointer_cast<IfcTimeSeriesDataTypeEnum>( m_TimeSeriesDataType->getDeepCopy(options) ); }
	if( m_DataOrigin ) { copy_self->m_DataOrigin = dynamic_pointer_cast<IfcDataOriginEnum>( m_DataOrigin->getDeepCopy(options) ); }
	if( m_UserDefinedDataOrigin ) { copy_self->m_UserDefinedDataOrigin = dynamic_pointer_cast<IfcLabel>( m_UserDefinedDataOrigin->getDeepCopy(options) ); }
	if( m_Unit ) { copy_self->m_Unit = dynamic_pointer_cast<IfcUnit>( m_Unit->getDeepCopy(options) ); }
	for( size_t ii=0; ii<m_Values.size(); ++ii )
	{
		auto item_ii = m_Values[ii];
		if( item_ii )
		{
			copy_self->m_Values.emplace_back( dynamic_pointer_cast<IfcIrregularTimeSeriesValue>(item_ii->getDeepCopy(options) ) );
		}
	}
	return copy_self;
}
void IfcIrregularTimeSeries::getStepLine( std::stringstream& stream ) const
{
	stream << "#" << m_entity_id << "= IFCIRREGULARTIMESERIES" << "(";
	if( m_Name ) { m_Name->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_Description ) { m_Description->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_StartTime ) { m_StartTime->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_EndTime ) { m_EndTime->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_TimeSeriesDataType ) { m_TimeSeriesDataType->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_DataOrigin ) { m_DataOrigin->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_UserDefinedDataOrigin ) { m_UserDefinedDataOrigin->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_Unit ) { m_Unit->getStepParameter( stream, true ); } else { stream << "$" ; }
	stream << ",";
	writeEntityList( stream, m_Values );
	stream << ");";
}
void IfcIrregularTimeSeries::getStepParameter( std::stringstream& stream, bool ) const { stream << "#" << m_entity_id; }
const std::wstring IfcIrregularTimeSeries::toString() const { return L"IfcIrregularTimeSeries"; }
void IfcIrregularTimeSeries::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 != 9 ){ std::stringstream err; err << "Wrong parameter count for entity IfcIrregularTimeSeries, expecting 9, having " << num_args << ". Entity ID: " << m_entity_id << std::endl; throw BuildingException( err.str().c_str() ); }
	m_Name = IfcLabel::createObjectFromSTEP( args[0], map );
	m_Description = IfcText::createObjectFromSTEP( args[1], map );
	m_StartTime = IfcDateTime::createObjectFromSTEP( args[2], map );
	m_EndTime = IfcDateTime::createObjectFromSTEP( args[3], map );
	m_TimeSeriesDataType = IfcTimeSeriesDataTypeEnum::createObjectFromSTEP( args[4], map );
	m_DataOrigin = IfcDataOriginEnum::createObjectFromSTEP( args[5], map );
	m_UserDefinedDataOrigin = IfcLabel::createObjectFromSTEP( args[6], map );
	m_Unit = IfcUnit::createObjectFromSTEP( args[7], map );
	readEntityReferenceList( args[8], m_Values, map );
}
void IfcIrregularTimeSeries::getAttributes( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const
{
	IfcTimeSeries::getAttributes( vec_attributes );
	if( !m_Values.empty() )
	{
		shared_ptr<AttributeObjectVector> Values_vec_object( new AttributeObjectVector() );
		std::copy( m_Values.begin(), m_Values.end(), std::back_inserter( Values_vec_object->m_vec ) );
		vec_attributes.emplace_back( std::make_pair( "Values", Values_vec_object ) );
	}
}
void IfcIrregularTimeSeries::getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes_inverse ) const
{
	IfcTimeSeries::getAttributesInverse( vec_attributes_inverse );
}
void IfcIrregularTimeSeries::setInverseCounterparts( shared_ptr<BuildingEntity> ptr_self_entity )
{
	IfcTimeSeries::setInverseCounterparts( ptr_self_entity );
}
void IfcIrregularTimeSeries::unlinkFromInverseCounterparts()
{
	IfcTimeSeries::unlinkFromInverseCounterparts();
}
