void IfcBSplineSurfaceWithKnots::readStepArguments( const std::vector<std::string>& args, const std::map<int,shared_ptr<IfcPPEntity> >& map )
{
	const int num_args = (int)args.size();
	if( num_args<12 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcBSplineSurfaceWithKnots, expecting 12, having " << num_args << ". Object id: " << getId() << std::endl; throw IfcPPException( strserr.str().c_str() ); }
	#ifdef _DEBUG
	if( num_args>12 ){ std::cout << "Wrong parameter count for entity IfcBSplineSurfaceWithKnots, expecting 12, having " << num_args << ". Object id: " << getId() << std::endl; }
	#endif
	readIntValue( args[0], m_UDegree );
	readIntValue( args[1], m_VDegree );
	readEntityReferenceList2D( args[2], m_ControlPointsList, map );
	m_SurfaceForm = IfcBSplineSurfaceForm::createObjectFromStepData( args[3] );
	if( _stricmp( args[4].c_str(), ".F." ) == 0 ) { m_UClosed = LOGICAL_FALSE; }
	else if( _stricmp( args[4].c_str(), ".T." ) == 0 ) { m_UClosed = LOGICAL_TRUE; }
	else if( _stricmp( args[4].c_str(), ".U." ) == 0 ) { m_UClosed = LOGICAL_UNKNOWN; }
	if( _stricmp( args[5].c_str(), ".F." ) == 0 ) { m_VClosed = LOGICAL_FALSE; }
	else if( _stricmp( args[5].c_str(), ".T." ) == 0 ) { m_VClosed = LOGICAL_TRUE; }
	else if( _stricmp( args[5].c_str(), ".U." ) == 0 ) { m_VClosed = LOGICAL_UNKNOWN; }
	if( _stricmp( args[6].c_str(), ".F." ) == 0 ) { m_SelfIntersect = LOGICAL_FALSE; }
	else if( _stricmp( args[6].c_str(), ".T." ) == 0 ) { m_SelfIntersect = LOGICAL_TRUE; }
	else if( _stricmp( args[6].c_str(), ".U." ) == 0 ) { m_SelfIntersect = LOGICAL_UNKNOWN; }
	readIntList(  args[7], m_UMultiplicities );
	readIntList(  args[8], m_VMultiplicities );
	readTypeOfRealList( args[9], m_UKnots );
	readTypeOfRealList( args[10], m_VKnots );
	m_KnotSpec = IfcKnotType::createObjectFromStepData( args[11] );
}
void IfcBSplineCurveWithKnots::readStepArguments( const std::vector<std::wstring>& args, const boost::unordered_map<int,shared_ptr<IfcPPEntity> >& map )
{
    const int num_args = (int)args.size();
    if( num_args != 8 ) {
        std::stringstream err;
        err << "Wrong parameter count for entity IfcBSplineCurveWithKnots, expecting 8, having " << num_args << ". Entity ID: " << m_id << std::endl;
        throw IfcPPException( err.str().c_str() );
    }
    readIntValue( args[0], m_Degree );
    readEntityReferenceList( args[1], m_ControlPointsList, map );
    m_CurveForm = IfcBSplineCurveForm::createObjectFromSTEP( args[2] );
    if( boost::iequals( args[3], L".F." ) ) {
        m_ClosedCurve = LOGICAL_FALSE;
    }
    else if( boost::iequals( args[3], L".T." ) ) {
        m_ClosedCurve = LOGICAL_TRUE;
    }
    else if( boost::iequals( args[3], L".U." ) ) {
        m_ClosedCurve = LOGICAL_UNKNOWN;
    }
    if( boost::iequals( args[4], L".F." ) ) {
        m_SelfIntersect = LOGICAL_FALSE;
    }
    else if( boost::iequals( args[4], L".T." ) ) {
        m_SelfIntersect = LOGICAL_TRUE;
    }
    else if( boost::iequals( args[4], L".U." ) ) {
        m_SelfIntersect = LOGICAL_UNKNOWN;
    }
    readIntList(  args[5], m_KnotMultiplicities );
    readTypeOfRealList( args[6], m_Knots );
    m_KnotSpec = IfcKnotType::createObjectFromSTEP( args[7] );
}
		shared_ptr<IfcCompoundPlaneAngleMeasure> IfcCompoundPlaneAngleMeasure::readStepData( std::string& arg )
		{
			// read TYPE
			if( arg.compare( "$" ) == 0 ) { return shared_ptr<IfcCompoundPlaneAngleMeasure>(); }
			shared_ptr<IfcCompoundPlaneAngleMeasure> type_object( new IfcCompoundPlaneAngleMeasure() );
			//supertype as attribute: std::vector<int> m_vec
			readIntList(  arg, type_object->m_vec );
			return type_object;
		}
shared_ptr<IfcCompoundPlaneAngleMeasure> IfcCompoundPlaneAngleMeasure::createObjectFromSTEP( const std::wstring& arg )
{
	// read TYPE
	if( arg.compare( L"$" ) == 0 ) { return shared_ptr<IfcCompoundPlaneAngleMeasure>(); }
	else if( arg.compare( L"*" ) == 0 ) { return shared_ptr<IfcCompoundPlaneAngleMeasure>(); }
	shared_ptr<IfcCompoundPlaneAngleMeasure> type_object( new IfcCompoundPlaneAngleMeasure() );
	readIntList( arg, type_object->m_vec );
	return type_object;
}
void IfcIndexedColourMap::readStepArguments( const std::vector<std::wstring>& args, const boost::unordered_map<int,shared_ptr<IfcPPEntity> >& map )
{
	const int num_args = (int)args.size();
	if( num_args != 4 ){ std::stringstream err; err << "Wrong parameter count for entity IfcIndexedColourMap, expecting 4, having " << num_args << ". Entity ID: " << m_id << std::endl; throw IfcPPException( err.str().c_str() ); }
	readEntityReference( args[0], m_MappedTo, map );
	readEntityReference( args[1], m_Overrides, map );
	readEntityReference( args[2], m_Colours, map );
	readIntList(  args[3], m_ColourIndex );
}
void IfcReference::readStepArguments( const std::vector<std::wstring>& args, const boost::unordered_map<int,shared_ptr<IfcPPEntity> >& map )
{
	const int num_args = (int)args.size();
	if( num_args != 5 ){ std::stringstream err; err << "Wrong parameter count for entity IfcReference, expecting 5, having " << num_args << ". Entity ID: " << m_id << std::endl; throw IfcPPException( err.str().c_str() ); }
	m_TypeIdentifier = IfcIdentifier::createObjectFromSTEP( args[0] );
	m_AttributeIdentifier = IfcIdentifier::createObjectFromSTEP( args[1] );
	m_InstanceName = IfcLabel::createObjectFromSTEP( args[2] );
	readIntList(  args[3], m_ListPositions );
	readEntityReference( args[4], m_InnerReference, map );
}
void readIntList2D( const std::wstring& str, std::vector<std::vector<int> >& vec )
{
	// ((1,2,4),(3,23,039),(938,3,-3,6))
	const wchar_t* ch = str.c_str();
	const size_t argsize = str.size();
	if( argsize == 0 )
	{
		return;
	}
	size_t i=0;
	size_t num_par_open=0;
	size_t last_token = 0;
	while( i<argsize )
	{
		if( ch[i] == ',' )
		{
			if( num_par_open == 1 )
			{
				std::vector<int> inner_vec;
				vec.push_back( inner_vec );
				readIntList( str.substr( last_token, i-last_token ), inner_vec );
				last_token = i+1;
			}
		}
		else if( ch[i] == '(' )
		{
			++num_par_open;
		}
		else if( ch[i] == ')' )
		{
			--num_par_open;
			if( num_par_open == 0 )
			{
				std::vector<int> inner_vec;
				vec.push_back( inner_vec );
				readIntList( str.substr( last_token, i-last_token ), inner_vec );
				return;
			}
		}
		++i;
	}
}
		void IfcRationalBSplineSurfaceWithKnots::readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<IfcRoadEntity> >& map )
		{
			const int num_args = (int)args.size();
			if( num_args<13 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcRationalBSplineSurfaceWithKnots, expecting 13, having " << num_args << ". Object id: " << getId() << std::endl; throw IfcRoadException( strserr.str().c_str() ); }
			#ifdef _DEBUG
			if( num_args>13 ){ std::cout << "Wrong parameter count for entity IfcRationalBSplineSurfaceWithKnots, expecting 13, having " << num_args << ". Object id: " << getId() << std::endl; }
			#endif
			readIntValue( args[0], m_UDegree );
			readIntValue( args[1], m_VDegree );
			readEntityReferenceList2D( args[2], m_ControlPointsList, map );
			m_SurfaceForm = IfcBSplineSurfaceForm::readStepData( args[3] );
			m_UClosed = IfcLogical::readStepData( args[4] );
			m_VClosed = IfcLogical::readStepData( args[5] );
			m_SelfIntersect = IfcLogical::readStepData( args[6] );
			readIntList(  args[7], m_UMultiplicities );
			readIntList(  args[8], m_VMultiplicities );
			readTypeOfRealList( args[9], m_UKnots );
			readTypeOfRealList( args[10], m_VKnots );
			m_KnotSpec = IfcKnotType::readStepData( args[11] );
			readTypeOfRealList2D( args[12], m_WeightsData );
		}
		void IfcIndexedColourMap::readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<Ifc4Entity> >& map )
		{
			const int num_args = (int)args.size();
			if( num_args<4 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcIndexedColourMap, expecting 4, having " << num_args << ". Object id: " << getId() << std::endl; throw Ifc4Exception( strserr.str().c_str() ); }
			#ifdef _DEBUG
			if( num_args>4 ){ std::cout << "Wrong parameter count for entity IfcIndexedColourMap, expecting 4, having " << num_args << ". Object id: " << getId() << std::endl; }
			#endif
			readEntityReference( args[0], m_MappedTo, map );
			m_Opacity = IfcNormalisedRatioMeasure::readStepData( args[1] );
			readEntityReference( args[2], m_Colours, map );
			readIntList(  args[3], m_ColourIndex );
		}
		void IfcReference::readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<IfcRoadEntity> >& map )
		{
			const int num_args = (int)args.size();
			if( num_args<5 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcReference, expecting 5, having " << num_args << ". Object id: " << getId() << std::endl; throw IfcRoadException( strserr.str().c_str() ); }
			#ifdef _DEBUG
			if( num_args>5 ){ std::cout << "Wrong parameter count for entity IfcReference, expecting 5, having " << num_args << ". Object id: " << getId() << std::endl; }
			#endif
			m_TypeIdentifier = IfcIdentifier::readStepData( args[0] );
			m_AttributeIdentifier = IfcIdentifier::readStepData( args[1] );
			m_InstanceName = IfcLabel::readStepData( args[2] );
			readIntList(  args[3], m_ListPositions );
			readEntityReference( args[4], m_InnerReference, map );
		}
Exemple #11
0
static void parse(PlanOperator& op, std::ifstream& i) {
   switch (op.getOperatorType()) {
      case OperatorType::TableScan: {
         TableScan& t = static_cast<TableScan&>(op);
         i >> t.name;
         break;
      }
      case OperatorType::MergeJoin: {
         MergeJoin& m = static_cast<MergeJoin&>(op);
         readIntList(m.attributeIdsLeft, i);
         m.cmp = readComparator(i);
         readIntList(m.attributeIdsRight, i);
         std::string opCode;
         i >> opCode;
         std::unique_ptr<PlanOperator> l(std::move(buildOperator(opCode)));
         parse(*l, i);
         m.setLeft(l);
         i >> opCode;
         std::unique_ptr<PlanOperator> r(std::move(buildOperator(opCode)));
         parse(*r, i);
         m.setRight(r);
         break;
      }
      case OperatorType::Select: {
         Select& s = static_cast<Select&>(op);
         readIntList(s.attributeIds, i);
         s.cmp = readComparator(i);
         std::string constant;
         for (unsigned j=0, limit=s.attributeIds.size(); j<limit; ++j) {
            i >> constant;
            s.constants.push_back(constant);
         }
         std::string opCode;
         i >> opCode;
         std::unique_ptr<PlanOperator> c(std::move(buildOperator(opCode)));
         parse(*c, i);
         s.setChild(c);
         break;
      }
      case OperatorType::Project: {
         Project& p = static_cast<Project&>(op);
         readIntList(p.attributeIds, i);
         std::string opCode;
         i >> opCode;
         std::unique_ptr<PlanOperator> c(std::move(buildOperator(opCode)));
         parse(*c, i);
         p.setChild(c);
         break;
      }
      case OperatorType::Sort: {
         Sort& s = static_cast<Sort&>(op);
         readIntList(s.attributeIds, i);
         s.order = readSortOrder(i);
         std::string opCode;
         i >> opCode;
         std::unique_ptr<PlanOperator> c(std::move(buildOperator(opCode)));
         parse(*c, i);
         s.setChild(c);
         break;
      }
      default: throw;
   }
}