本文整理汇总了C++中ParameterPtr::name方法的典型用法代码示例。如果您正苦于以下问题:C++ ParameterPtr::name方法的具体用法?C++ ParameterPtr::name怎么用?C++ ParameterPtr::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterPtr
的用法示例。
在下文中一共展示了ParameterPtr::name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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'." );
}
}
}
}
示例2: 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);
}
}
示例3: init
void FunctionStatement::init(void *parser, bool ref,
const vector<ParameterPtr> ¶ms,
StatementListStatementPtr body,
bool has_call_to_get_args) {
m_ref = ref;
m_params = params;
m_body = body;
m_hasCallToGetArgs = has_call_to_get_args;
const CallInfo* cit1;
void* vt1;
if (get_call_info_no_eval(cit1, vt1, m_name)) {
m_invalid =
get_call_info_builtin(cit1, vt1, m_name->data(), m_name->hash()) ? -1 : 1;
}
bool seenOptional = false;
set<string> names;
m_callInfo.m_argCount = m_closureCallInfo.m_argCount = m_params.size();
for (unsigned int i = 0; i < m_params.size(); i++) {
ParameterPtr param = m_params[i];
std::string name = param->name();
if (names.find(name) != names.end()) {
raise_notice("%s:%d %s() has 2 parameters with the same name: $%s",
m_loc.file, m_loc.line0, m_name.c_str(), name.c_str());
} else {
names.insert(name);
}
if (!seenOptional) {
if (param->isOptional()) {
seenOptional = true;
}
} else if (!param->isOptional()) {
/*
raise_notice("%s:%d %s() has required parameter after optional one: $%s",
m_loc.file, m_loc.line0, m_name.c_str(), name.c_str());
*/
param->addNullDefault(parser);
}
if (param->isRef()) {
m_callInfo.m_refFlags |= 1 << i;
m_closureCallInfo.m_refFlags |= 1 << i;
}
if (param->getIdx() == -1) {
param->setIdx(declareVariable(name));
}
}
}
示例4: handler
ParameterHandlerPtr CompoundParameterHandler::handler( const ParameterPtr child, bool createIfMissing )
{
HandlerMap::const_iterator it = m_handlers.find( child );
if( it!=m_handlers.end() )
{
return it->second;
}
ParameterHandlerPtr h = 0;
if( createIfMissing )
{
IECore::ConstBoolDataPtr noHostMapping = child->userData()->member<BoolData>( "noHostMapping" );
if( !noHostMapping || !noHostMapping->readable() )
{
h = ParameterHandler::create( child );
if( !h )
{
IECore::msg( IECore::Msg::Warning, "Gaffer::CompoundParameterHandler", boost::format( "Unable to create handler for parameter \"%s\" of type \"%s\"" ) % child->name() % child->typeName() );
}
}
}
m_handlers[child] = h;
return h;
}