예제 #1
0
void AnimatedScene::createGrid()
{
  size_t objectCount = m_objectCount[0] * m_objectCount[1];
  m_primitives.resize( objectCount );
  m_materials.resize( objectCount );
  m_geoNodes.resize( objectCount );
  m_transforms.resize( objectCount );
  m_animators.resize( objectCount );

  size_t index = 0;
  for ( size_t y = 0; y < m_objectCount[1]; ++y )
  {
    for ( size_t x = 0; x < m_objectCount[0]; ++x )
    {
      m_primitives[index] = createPrimitive( x, y );
      m_materials[index] = createMaterial( x, y );
      m_geoNodes[index] = dp::sg::core::GeoNode::create();
      {
        m_geoNodes[index]->setMaterialEffect( m_materials[index] );
        m_geoNodes[index]->setPrimitive( m_primitives[index] );
      }
      m_transforms[index] = createTransform( x, y );
      {
        m_transforms[index]->addChild( m_geoNodes[index] );
      }
      m_root->addChild( m_transforms[index] );

      ++index;
    }
  }
}
예제 #2
0
/*
 *----------------------------------------------------------
 *      Primitive Sub Menu
 *----------------------------------------------------------
 */
void primitiveMenu(int item)
{
        switch(item){
                case CYLINDER:
                        createPrimitive(CYLINDER);
                        break;
                case LANDMARK:
                        /* createPrimitive(LANDMARK); */
                        createLandMark();
                        break;
                case SPHERE:
                        createPrimitive(SPHERE);
                        break;
                default:
                        break;
        }

        glutPostRedisplay();
}
예제 #3
0
void pushElement( const XMLElement& element ){
	if ( string_equal( element.name(), "epair" ) ) {
		ASSERT_MESSAGE( string_equal( element.name(), "epair" ), PARSE_ERROR );
		Node_getEntity( m_parent )->setKeyValue( element.attribute( "key" ), element.attribute( "value" ) );
	}
	else
	{
		NodeSmartReference node( createPrimitive( element.name() ) );

		m_importer = Node_getXMLImporter( node );

		constructor( subprimitive(), m_importer );

		m_importer->pushElement( element );

		Node_getTraversable( m_parent )->insert( node );
	}
}
예제 #4
0
void AnonModule::addAnonymization(uint16_t id, int len, AnonMethod::Method methodName, const std::string& parameter)
{
	static const struct ipfix_identifier* ident;
	AnonPrimitive* a = createPrimitive(methodName, parameter);
	if (methods.find(id) != methods.end()) {
		methods[id].primitive.push_back(a);
	} else {
		AnonIE ie;
		if (len == -1) {
			if (!(ident = ipfix_id_lookup(id))) {
				msg(MSG_ERROR, "Unknown or unsupported id %i detected.", id);
				return;
			}
			len = ident->length;
		}
		ie.offset = ie.header = ie.packetClass = 0;
		ie.len = len;
		ie.primitive.push_back(a);
		methods[id] = ie;
	}
}
예제 #5
0
void AnonModule::addAnonymization(InformationElement::IeInfo id, int len, AnonMethod::Method methodName, std::vector<map_info> mapping, const std::string& parameter)
{
	static const struct ipfix_identifier* ident;
	AnonPrimitive* a = createPrimitive(methodName, parameter, mapping);
	if (methods.find(id) != methods.end()) {
		methods[id].primitive.push_back(a);
	} else {
		AnonIE ie;
		if (len == -1) {
			if (!(ident = ipfix_id_lookup(id.id, id.enterprise))) {
				msg(MSG_ERROR, "Unknown or unsupported id %s detected.", id.toString().c_str());
				return;
			}
			len = ident->length;
		}
		ie.offset = ie.header = ie.packetClass = 0;
		// attention: if ie.len==0, anonField() assumes that it is a variable length field and the whole information element will be processed
		ie.len = len;
		ie.primitive.push_back(a);
		methods[id] = ie;
	}
}
예제 #6
0
void PredicateParser::parse(const std::string& fullExpression, size_t& fromPos, size_t endPos)
{
    assert(0 != fromPos);
    std::stack<char> unmatched;
    if(mRootParser)
    {
        unmatched.push('{');
        ++fromPos;
    }

    fromPos = skipSpace(fullExpression, fromPos, endPos);
    auto oldFrom = fromPos;
    size_t outerSize = unmatched.size();

    for(; fromPos < endPos && !(mRootParser && unmatched.empty()); ++fromPos)
    {
        char c = fullExpression.at(fromPos);
        if(!matchRange(unmatched, fullExpression, fromPos, endPos) && outerSize == unmatched.size())
        {

            switch(c)
            {
            case '=':
                parseEqual(fullExpression, fromPos);
                break;
            case '!':
                parseNonEqual(fullExpression, fromPos);
                break;
            case '>':
                parseGreat(fullExpression, fromPos);
                break;
            case '<':
                parseLess(fullExpression, fromPos);
                break;
            case '^':
                parseStartsWith(fullExpression, fromPos);
                break;
            case '$':
                parseEndsWith(fullExpression, fromPos);
                break;
            case '*':
                parseContains(fullExpression, fromPos);
                break;
            case '~':
                parseMatch(fullExpression, fromPos);
                break;
            case '&':
                parseAnd(fullExpression, fromPos);
                break;
            case '|':
                parseOr(fullExpression, fromPos);
                break;
            case '+':
                mOperators.emplace_back(OpInfo{OpInfo::Add, fromPos, fromPos + 1, mOperators.size()});
                break;
            case '-':
                {
                    size_t lastOpEnd = mOperators.empty() ? oldFrom : mOperators.back().to;
                    int from = fromPos - 1;
                    bool isMinus = isSpace(fullExpression, from , lastOpEnd - 1, -1);

                    if(isMinus)
                    {
                        mOperators.emplace_back(OpInfo{OpInfo::Minus, fromPos, fromPos + 1, mOperators.size()});
                    }
                    else
                    {
                        mOperators.emplace_back(OpInfo{OpInfo::Sub, fromPos, fromPos + 1, mOperators.size()});
                    }
                    break;
                }
            case '/':
                {
                    auto lastOp = mOperators.empty() ? nullptr : &mOperators.back();
                    size_t lastOpEnd = nullptr == lastOp ? oldFrom : lastOp->to;
                    int from = fromPos - 1;
                    bool allSpace = isSpace(fullExpression, from , lastOpEnd - 1, -1);
                    if(nullptr != lastOp && (lastOp->op >= OpInfo::Match) && (lastOp->op <= OpInfo::iNotMatch) && lastOp->to == (from - 1))
                    {
                        
                    }

                    if((oldFrom != fromPos) && (mOperators.empty() || (mOperators.back().op < OpInfo::Match) && (mOperators.back().op > OpInfo::iNotMatch)))
                    {
                        mOperators.emplace_back(OpInfo{OpInfo::Div, fromPos, fromPos + 1, mOperators.size()});
                    }
                    else
                    {
                        fromPos = skip2(fullExpression, fromPos + 1, '/', endPos) + 1;
                    }
                }
                break;
            case '%':
                mOperators.emplace_back(OpInfo{OpInfo::Mod, fromPos, fromPos + 1, mOperators.size()});
                break;
            default:
                break;
            }
        }//match range
    }//foreach char

    auto newEnd = fromPos - (mRootParser ? 1 : 0);
    if(mOperators.empty() && '(' != fullExpression.at(oldFrom))
    {
        auto pOperand = createPrimitive(fullExpression, oldFrom, newEnd);
        mResult = pOperand;
    }
    else
    {
        auto pPredicate = createPredicate(fullExpression, 0, mOperators.size(), oldFrom, newEnd);
        mResult = pPredicate;
    }
}