当前位置: 首页>>代码示例>>C++>>正文


C++ ParameterPtr类代码示例

本文整理汇总了C++中ParameterPtr的典型用法代码示例。如果您正苦于以下问题:C++ ParameterPtr类的具体用法?C++ ParameterPtr怎么用?C++ ParameterPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ParameterPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GeneratorPtr

GeneratorPtr Session::create_generator_from_node(TiXmlElement* element, Region* region){
    fsom::DebugStream << "Attempting to create generator"<<std::endl;
    GeneratorPtr gen = GeneratorPtr(new Generator(Generator::GEN_Sine,dspCreationStruct(region)));
    
    TiXmlElement* basicInfoElement = element->FirstChildElement("BasicInfo");
    if(basicInfoElement){
	fsom::DebugStream << "Generator basic info found"<<std::endl;
	int genType,noiseState;
	std::string path = basicInfoElement->Attribute("Path"); 
	basicInfoElement->QueryIntAttribute("GenType",&genType);
	basicInfoElement->QueryIntAttribute("NoiseState",&noiseState);
	Generator::GeneratorType type = Generator::GeneratorType(genType);
	gen->set_generator_voice(type);
	gen->set_noise_state(noiseState);
	gen->set_file_path(path);
	fsom::DebugStream << "noise state for gen set to "<<noiseState<<std::endl;
	fsom::DebugStream << "gen type = "<<genType<<std::endl;
	
	
	
    }
    
    TiXmlElement * child = element->FirstChildElement("Parameter");
    while(child){
      fsom::DebugStream << "Parameter in generator found"<<std::endl;
      ParameterPtr p = create_parameter_from_node(child, region);
      gen->get_parameter(p->get_name())->set_value(p->get_value());
      child = child->NextSiblingElement("Parameter");
    }
    
    return gen;
}
开发者ID:spearse,项目名称:FSOM,代码行数:32,代码来源:Session.cpp

示例2: if

void V3Manipulator::readParameterOptions( MFnDagNode &nodeFn )
{
	ParameterisedHolderInterface *pHolder = dynamic_cast<ParameterisedHolderInterface *>( nodeFn.userNode() );		
	if( !pHolder ) 
	{
		return;
	}
	
	ParameterPtr parameter = pHolder->plugParameter( m_plug );
	CompoundObjectPtr userData = parameter->userData();
	
	if( CompoundObjectPtr uiData = userData->member<CompoundObject>( "UI" ) )
	{
		// World space parameter values
		if( StringDataPtr wsData = uiData->member<StringData>( "manipSpace" ) )
		{
			if( wsData->readable() == "world" )
			{
				m_worldSpace = true;
			}
			else if( wsData->readable() == "object" )
			{
				m_worldSpace = false;			
			}
			else
			{
				MGlobal::displayWarning( "V3Manipulator: Ignoring invalid v3ManipSpace '"
										 + MString( wsData->readable().c_str() )
										 + "' for parameter '" 
										 + MString( parameter->name().c_str() )
										 + "', using 'object'." );
			}
		}				
	}
}
开发者ID:AtomicFiction,项目名称:cortex,代码行数:35,代码来源:V3Manipulator.cpp

示例3: while

SynthesisModulePtr Session::create_module_from_node(TiXmlElement* element, Region* region){
  fsom::DebugStream << "Attempting to create module from node"<<std::endl;
   TiXmlElement* basicInfoElement = element->FirstChildElement("BasicInfo");
   SynthesisModulePtr module;
  if(basicInfoElement){
   fsom::DebugStream << "Module basic info found"<<std::endl;
   std::string name = basicInfoElement->Attribute("Type");
   module = SynthesisModuleManager::get_instance().create(name,dspCreationStruct(region)); 
    TiXmlElement * child = element->FirstChildElement("Parameter");
    while(child){
      fsom::DebugStream << "Parameter in module found"<<std::endl;
      ParameterPtr p = create_parameter_from_node(child, region);
      module->get_parameter(p->get_name())->set_value(p->get_value());
      child = child->NextSiblingElement("Parameter");
    }
   
   
   return module;
  }
  
  ///WARNING POSSIBLE TO RETURN WITHOUT A VALUE 
  //   SynthesisModulePtr 
  
  
}
开发者ID:spearse,项目名称:FSOM,代码行数:25,代码来源:Session.cpp

示例4: setNeedGradient

void RecurrentLayerGroup::initSubNetwork(
    NeuralNetwork* rootNetwork,
    const ModelConfig& config,
    const std::vector<ParameterType>& parameterTypes,
    bool useGpu) {
  setNeedGradient(true);

  network_.reset(new RecurrentGradientMachine(config_.name(), rootNetwork));
  ParamInitCallback cb = [this, rootNetwork](int paramId, Parameter* para) {
    para->enableSharedType(
        PARAMETER_VALUE,
        rootNetwork->getParameters()[paramId]->getBuf(PARAMETER_VALUE),
        rootNetwork->getParameters()[paramId]->getMat(PARAMETER_VALUE));
    para->enableSharedType(
        PARAMETER_GRADIENT,
        rootNetwork->getParameters()[paramId]->getBuf(PARAMETER_GRADIENT),
        rootNetwork->getParameters()[paramId]->getMat(PARAMETER_GRADIENT));
  };
  network_->init(config, cb, parameterTypes, useGpu);

  for (auto paramId : network_->getParameterIds()) {
    ParameterPtr parameter = rootNetwork->getParameters()[paramId];
    parameter->incShared();
    CHECK_EQ(parameter->getDeviceId(), getDeviceId());
    parameters_.push_back(parameter);
  }
}
开发者ID:Biocodings,项目名称:Paddle,代码行数:27,代码来源:RecurrentLayerGroup.cpp

示例5: getParameterByName

//-----------------------------------------------------------------------------
ParameterPtr Function::resolveLocalParameter(Parameter::Semantic semantic, int index,
										   const String& name,
										   GpuConstantType type)
{
	ParameterPtr param;

	param = getParameterByName(mLocalParameters, name);
	if (param.get() != NULL)
	{
		if (param->getType() == type &&
			param->getSemantic() == semantic &&
			param->getIndex() == index)
		{
			return param;
		}
		else 
		{
			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 
				"Can not resolve local parameter due to type mismatch. Function <" + getName() + ">", 			
				"Function::resolveLocalParameter" );
		}		
	}
		
	param = ParameterPtr(OGRE_NEW Parameter(type, name, semantic, index, Parameter::SPC_UNKNOWN));
	addParameter(mLocalParameters, param);
			
	return param;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:29,代码来源:OgreShaderFunction.cpp

示例6: assert

DSPEffectPtr Session::create_effect_from_node(TiXmlElement* element,Region* region){

  assert(element);
  std::string typeName = element->Attribute("name");
  DSPEffectPtr t =  DSPManager::get_instance().create(typeName,dspCreationStruct(region));
  assert(t);
  TiXmlElement * meta = element->FirstChildElement("MetaData");
  //TODO streamline this process of loading, specific function for loading dspeffect and region meta needed

  const char* tut = meta->Attribute("TutorialLink"); 
  
  t->register_meta("TutorialLink");
  t->set_meta("TutorialLink",std::string(tut));

  TiXmlElement * child = element->FirstChildElement("Parameter");
  while(child){
    ParameterPtr p = create_parameter_from_node(child, region);
    t->get_parameter(p->get_name())->set_value(p->get_value());
    t->get_parameter(p->get_name())->set_breakpoints(p->get_breakpoints());
    child = child->NextSiblingElement("Parameter");
  }
  fsom::DebugStream  << "Loaded effect:" << typeName << std::endl;
  return t;
  
}
开发者ID:spearse,项目名称:FSOM,代码行数:25,代码来源:Session.cpp

示例7: replaceParametersReferences

//-----------------------------------------------------------------------------
void ProgramProcessor::replaceParametersReferences(MergeParameterList& mergedParams, ParameterOperandMap& paramsRefMap)
{
	for (unsigned int i=0; i < mergedParams.size(); ++i)
	{
		MergeParameter& curMergeParameter = mergedParams[i];
		int paramBitMaskOffset = 0;

		for (unsigned int j=0; j < curMergeParameter.getSourceParameterCount(); ++j)
		{
			ParameterPtr	  curSrcParam  = curMergeParameter.getSourceParameter(j);
			ParameterOperandMap::iterator itParamRefs = paramsRefMap.find(curSrcParam.get());

			// Case the source parameter has some references
			if (itParamRefs != paramsRefMap.end())
			{
				OperandPtrVector& srcParamRefs = itParamRefs->second;
				ParameterPtr dstParameter;

				// Case the source parameter is fully contained within the destination merged parameter.
				if (curMergeParameter.getSourceParameterMask(j) == Operand::OPM_ALL)
				{
					dstParameter = curMergeParameter.getDestinationParameter(Operand::OPS_INOUT, i);

					for (unsigned int op=0; op < srcParamRefs.size(); ++op)
					{
						Operand*  srcOperandPtr = srcParamRefs[op];
						int       dstOpMask;

						if (srcOperandPtr->getMask() == Operand::OPM_ALL)
						{
							// Case the merged parameter contains only one source - no point in adding special mask.
							if (curMergeParameter.getSourceParameterCount() == 1)
							{
								dstOpMask = Operand::OPM_ALL;
							}
							else
							{
								dstOpMask = getParameterMaskByType(curSrcParam->getType()) << paramBitMaskOffset;							
							}
						}
						else
						{
							dstOpMask = srcOperandPtr->getMask() << paramBitMaskOffset;
						}

						// Replace the original source operand with a new operand the reference the new merged parameter.						
						*srcOperandPtr = Operand(dstParameter, srcOperandPtr->getSemantic(), dstOpMask);
					}
				}
			}	


			// Update the bit mask offset. 
			paramBitMaskOffset += getParameterFloatCount(curSrcParam->getType());			
		}
	}
}
开发者ID:changsin,项目名称:ogre,代码行数:58,代码来源:OgreShaderProgramProcessor.cpp

示例8: writeOutParameters

//-----------------------------------------------------------------------
void GLSLProgramWriter::writeOutParameters(std::ostream& os, Function* function, GpuProgramType gpuType)
{
	const ShaderParameterList& outParams = function->getOutputParameters();

	ShaderParameterConstIterator itParam = outParams.begin();
	ShaderParameterConstIterator itParamEnd = outParams.end();

	for ( ; itParam != itParamEnd; ++itParam)
	{
		ParameterPtr pParam = *itParam;

		if(gpuType == GPT_VERTEX_PROGRAM)
		{
			// GLSL vertex program has to write always gl_Position (but this is also deprecated after version 130)
			if(pParam->getContent() == Parameter::SPC_POSITION_PROJECTIVE_SPACE)
			{
				mInputToGLStatesMap[pParam->getName()] = "gl_Position";
			}
			else
			{
				// After GLSL 1.20 varying is deprecated
				if(mGLSLVersion <= 120)
				{
					os << "varying\t";
				}
				else
				{
					os << "out\t";
				}

				os << mGpuConstTypeMap[pParam->getType()];
				os << "\t";
				os << pParam->getName();
				if (pParam->isArray() == true)
				{
					os << "[" << pParam->getSize() << "]";	
				}
				os << ";" << std::endl;	
			}
		}
		else if(gpuType == GPT_FRAGMENT_PROGRAM &&
				pParam->getSemantic() == Parameter::SPS_COLOR)
		{					
			// GLSL fragment program has to write always gl_FragColor (but this is also deprecated after version 130)
            // Always add gl_FragColor as an output.  The name is for compatibility.
            if(mGLSLVersion <= 130)
            {
                mInputToGLStatesMap[pParam->getName()] = "gl_FragColor";
            }
            else
            {
                os << "out vec4 fragColour;" << std::endl;
                mInputToGLStatesMap[pParam->getName()] = "fragColour";
            }
        }
    }
}
开发者ID:cartesio88,项目名称:Aura_libs,代码行数:58,代码来源:OgreShaderGLSLProgramWriter.cpp

示例9: buildTexcoordTable

//-----------------------------------------------------------------------------
void ProgramProcessor::buildTexcoordTable(const ShaderParameterList& paramList, ShaderParameterList outParamsTable[4])
{
	ShaderParameterConstIterator it    = paramList.begin();
	ShaderParameterConstIterator itEnd = paramList.end();

	for (; it != itEnd; ++it)
	{
		const ParameterPtr curParam = *it;

		if (curParam->getSemantic() == Parameter::SPS_TEXTURE_COORDINATES)
		{

			switch (curParam->getType())
			{
			case GCT_FLOAT1:
				outParamsTable[0].push_back(curParam);
				break;

			case GCT_FLOAT2:
				outParamsTable[1].push_back(curParam);
				break;

			case GCT_FLOAT3:
				outParamsTable[2].push_back(curParam);
				break;

			case GCT_FLOAT4:
				outParamsTable[3].push_back(curParam);
				break;
            case GCT_SAMPLER1D:
            case GCT_SAMPLER2D:
            case GCT_SAMPLER2DARRAY:
            case GCT_SAMPLER3D:
            case GCT_SAMPLERCUBE:
            case GCT_SAMPLER1DSHADOW:
            case GCT_SAMPLER2DSHADOW:
            case GCT_MATRIX_2X2:
            case GCT_MATRIX_2X3:
            case GCT_MATRIX_2X4:
            case GCT_MATRIX_3X2:
            case GCT_MATRIX_3X3:
            case GCT_MATRIX_3X4:
            case GCT_MATRIX_4X2:
            case GCT_MATRIX_4X3:
            case GCT_MATRIX_4X4:
            case GCT_INT1:
            case GCT_INT2:
            case GCT_INT3:
            case GCT_INT4:
            case GCT_UNKNOWN:
            default:
                break;
			}
		}
	}
}
开发者ID:changsin,项目名称:ogre,代码行数:57,代码来源:OgreShaderProgramProcessor.cpp

示例10: toParameter

ParameterPtr toParameter(char* keyP,
			 int keyLen,
			 char* valP,
			 int valLen)
{
  ParameterPtr parameter = new Parameter();
  parameter->set_key(keyP, keyLen);
  parameter->set_value(valP, valLen);
  return parameter;
}
开发者ID:iand675,项目名称:hs-mesos,代码行数:10,代码来源:parameter.cpp

示例11: writeLocalParameter

//-----------------------------------------------------------------------
void CGProgramWriter::writeLocalParameter(std::ostream& os, ParameterPtr parameter)
{
	os << mGpuConstTypeMap[parameter->getType()];
	os << "\t";	
	os << parameter->getName();		
	if (parameter->isArray() == true)
	{
		os << "[" << parameter->getSize() << "]";	
	}
}
开发者ID:changsin,项目名称:ogre,代码行数:11,代码来源:OgreShaderCGProgramWriter.cpp

示例12: testSerialization

void testSerialization(T min, T max)
{
    YAML::Node node;

    T def = min;

    {
        ParameterPtr p = factory::declareRange<T>("foo", min, max, def, 1);
        p->serialize_yaml(node);
        EXPECT_STREQ(p->name().c_str(), node["name"].as<std::string>().c_str());
        EXPECT_STREQ("range", node["type"].as<std::string>().c_str());
    }

    {
        ParameterPtr p = factory::makeEmpty(node["type"].as<std::string>());
        ASSERT_NE(nullptr, p);
        p->deserialize_yaml(node);

        RangeParameterPtr range = std::dynamic_pointer_cast<RangeParameter>(p);
        ASSERT_NE(nullptr, range);

        EXPECT_STREQ("foo", range->name().c_str());
        EXPECT_EQ(min, range->min<T>());
        EXPECT_EQ(max, range->max<T>());

        auto val = range->as<T>();
        EXPECT_EQ(def, val);
    }

    SerializationBuffer buffer;

    {
        ParameterPtr p = factory::declareRange<T>("foo", min, max, def, 1);
        ParameterSerializer::instance().serialize(*p, buffer);
    }

    {
        StreamablePtr s = ParameterSerializer::instance().deserialize(buffer);
        ASSERT_NE(nullptr, s);

        ParameterPtr p = std::dynamic_pointer_cast<Parameter>(s);
        ASSERT_NE(nullptr, p);

        RangeParameterPtr range = std::dynamic_pointer_cast<RangeParameter>(p);
        ASSERT_NE(nullptr, range);

        EXPECT_STREQ("foo", range->name().c_str());
        EXPECT_EQ(min, range->min<T>());
        EXPECT_EQ(max, range->max<T>());

        auto val = range->as<T>();
        EXPECT_EQ(def, val);
    }
}
开发者ID:cogsys-tuebingen,项目名称:csapex,代码行数:54,代码来源:range_parameter_test.cpp

示例13: addOutputParameter

//-----------------------------------------------------------------------------
void Function::addOutputParameter(ParameterPtr parameter)
{
	// Check that parameter with the same semantic and index in output parameters list.
	if (getParameterBySemantic(mOutputParameters, parameter->getSemantic(), parameter->getIndex()).get() != NULL)
	{
		OGRE_EXCEPT( Exception::ERR_INVALIDPARAMS, 
			"Parameter <" + parameter->getName() + "> has equal sematic parameter in function <" + getName() + ">", 			
			"Function::addOutputParameter" );
	}

	addParameter(mOutputParameters, parameter);
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:13,代码来源:OgreShaderFunction.cpp

示例14: generateLocalSplitParameters

//-----------------------------------------------------------------------------
void ProgramProcessor::generateLocalSplitParameters(Function* func, GpuProgramType progType,
												   MergeParameterList& mergedParams, 
												   ShaderParameterList& splitParams, LocalParameterMap& localParamsMap)
{
	// No split params created.
	if (splitParams.size() == 0)	
		return;	

	// Create the local parameters + map from source to local.
	for (unsigned int i=0; i < splitParams.size(); ++i)
	{
		ParameterPtr srcParameter   = splitParams[i];
		ParameterPtr localParameter = func->resolveLocalParameter(srcParameter->getSemantic(), srcParameter->getIndex(), "lsplit_" + srcParameter->getName(), srcParameter->getType());

		localParamsMap[srcParameter.get()] = localParameter;		
	}	

	int invocationCounter = 0;

	// Establish link between the local parameter to the merged parameter.
	for (unsigned int i=0; i < mergedParams.size(); ++i)
	{
		MergeParameter& curMergeParameter = mergedParams[i];

		for (unsigned int p=0; p < curMergeParameter.getSourceParameterCount(); ++p)
		{
			ParameterPtr srcMergedParameter    = curMergeParameter.getSourceParameter(p);
			LocalParameterMap::iterator itFind = localParamsMap.find(srcMergedParameter.get());

			// Case the source parameter is split parameter.
			if (itFind != localParamsMap.end())
			{
				// Case it is the vertex shader -> assign the local parameter to the output merged parameter.
				if (progType == GPT_VERTEX_PROGRAM)
				{
					FunctionInvocation* curFuncInvocation = OGRE_NEW FunctionInvocation(FFP_FUNC_ASSIGN, FFP_VS_POST_PROCESS, invocationCounter++);
					
					curFuncInvocation->pushOperand(itFind->second, Operand::OPS_IN, curMergeParameter.getSourceParameterMask(p));
					curFuncInvocation->pushOperand(curMergeParameter.getDestinationParameter(Operand::OPS_OUT, i), Operand::OPS_OUT, curMergeParameter.getDestinationParameterMask(p));		
					func->addAtomInstance(curFuncInvocation);		
				}
				else if (progType == GPT_FRAGMENT_PROGRAM)
				{
					FunctionInvocation* curFuncInvocation = OGRE_NEW FunctionInvocation(FFP_FUNC_ASSIGN, FFP_PS_PRE_PROCESS, invocationCounter++);
					
					curFuncInvocation->pushOperand(curMergeParameter.getDestinationParameter(Operand::OPS_IN, i), Operand::OPS_IN, curMergeParameter.getDestinationParameterMask(p));		
					curFuncInvocation->pushOperand(itFind->second, Operand::OPS_OUT, curMergeParameter.getSourceParameterMask(p));
					func->addAtomInstance(curFuncInvocation);		
				}
			}
		}
	}				
}
开发者ID:changsin,项目名称:ogre,代码行数:54,代码来源:OgreShaderProgramProcessor.cpp

示例15: fromParameter

void fromParameter(ParameterPtr parameter,
		   char** keyP,
		   int* keyLenP,
		   char** valueP,
		   int* valueLenP)
{
  std::string* k = parameter->mutable_key();
  std::string* v = parameter->mutable_value();
  *keyP = (char*) k->data();
  *keyLenP = k->size();
  *valueP = (char*) v->data();
  *valueLenP = v->size();
}
开发者ID:iand675,项目名称:hs-mesos,代码行数:13,代码来源:parameter.cpp


注:本文中的ParameterPtr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。