本文整理汇总了C++中InternedStringVectorDataPtr类的典型用法代码示例。如果您正苦于以下问题:C++ InternedStringVectorDataPtr类的具体用法?C++ InternedStringVectorDataPtr怎么用?C++ InternedStringVectorDataPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了InternedStringVectorDataPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: inPlug
IECore::ConstInternedStringVectorDataPtr DeleteSets::computeSetNames( const Gaffer::Context *context, const ScenePlug *parent ) const
{
ConstInternedStringVectorDataPtr inputSetNamesData = inPlug()->setNamesPlug()->getValue();
const std::vector<InternedString> &inputSetNames = inputSetNamesData->readable();
if( inputSetNames.empty() )
{
return inputSetNamesData;
}
InternedStringVectorDataPtr outputSetNamesData = new InternedStringVectorData;
std::vector<InternedString> &outputSetNames = outputSetNamesData->writable();
const std::string names = namesPlug()->getValue();
const bool invert = invertNamesPlug()->getValue();
for( std::vector<InternedString>::const_iterator it = inputSetNames.begin(); it != inputSetNames.end(); ++it )
{
if( StringAlgo::matchMultiple( *it, names ) != (!invert) )
{
outputSetNames.push_back( *it );
}
}
return outputSetNamesData;
}
示例2: filterContext
IECore::ConstInternedStringVectorDataPtr Isolate::computeChildNames( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const
{
ContextPtr tmpContext = filterContext( context );
Context::Scope scopedContext( tmpContext.get() );
if( mayPruneChildren( path, filterPlug()->getValue() ) )
{
// we may need to delete one or more of our children
ConstInternedStringVectorDataPtr inputChildNamesData = inPlug()->childNamesPlug()->getValue();
const vector<InternedString> &inputChildNames = inputChildNamesData->readable();
InternedStringVectorDataPtr outputChildNamesData = new InternedStringVectorData;
vector<InternedString> &outputChildNames = outputChildNamesData->writable();
ScenePath childPath = path;
childPath.push_back( InternedString() ); // for the child name
for( vector<InternedString>::const_iterator it = inputChildNames.begin(), eIt = inputChildNames.end(); it != eIt; it++ )
{
childPath[path.size()] = *it;
tmpContext->set( ScenePlug::scenePathContextName, childPath );
if( filterPlug()->getValue() != Filter::NoMatch )
{
outputChildNames.push_back( *it );
}
}
return outputChildNamesData;
}
else
{
// pass through
return inPlug()->childNamesPlug()->getValue();
}
}
示例3: namePlug
IECore::ConstInternedStringVectorDataPtr Instancer::computeBranchChildNames( const ScenePath &parentPath, const ScenePath &branchPath, const Gaffer::Context *context ) const
{
if( branchPath.size() == 0 )
{
std::string name = namePlug()->getValue();
if( !name.size() )
{
return outPlug()->childNamesPlug()->defaultValue();
}
ConstV3fVectorDataPtr p = sourcePoints( parentPath );
if( !p || !p->readable().size() )
{
return outPlug()->childNamesPlug()->defaultValue();
}
InternedStringVectorDataPtr result = new InternedStringVectorData();
for( size_t i=0; i<p->readable().size(); i++ )
{
result->writable().push_back( boost::lexical_cast<string>( i ) );
}
return result;
}
else
{
ContextPtr ic = instanceContext( context, branchPath );
Context::Scope scopedContext( ic );
return instancePlug()->childNamesPlug()->getValue();
}
}
示例4: InternedStringVectorData
IECore::CompoundDataPtr LinkedScene::linkAttributeData( const SceneInterface *scene )
{
std::string f = scene->fileName();
InternedStringVectorDataPtr r = new InternedStringVectorData();
scene->path( r->writable() );
CompoundDataPtr d = new CompoundData();
d->writable()[g_fileName] = new StringData(f);
d->writable()[g_root] = r;
return d;
}
示例5: targetPlug
void Duplicate::compute( ValuePlug *output, const Context *context ) const
{
if( output == outParentPlug() )
{
ScenePath target;
ScenePlug::stringToPath( targetPlug()->getValue(), target );
string parent;
for( size_t i = 0; i < target.size(); ++i )
{
parent += "/";
if( i < target.size() - 1 )
{
parent += target[i];
}
}
static_cast<StringPlug *>( output )->setValue( parent );
return;
}
else if( output == childNamesPlug() )
{
// get the path to our target.
ScenePath target;
ScenePlug::stringToPath( targetPlug()->getValue(), target );
// throw if the target path doesn't exist in the input. we need to compute the input child names at the
// parent for this, but it's not necessary to represent that in the hash, because it doesn't actually
// affect our result (if we throw we will have no result).
ScenePath parent( target ); parent.pop_back();
ConstInternedStringVectorDataPtr parentChildNamesData = inPlug()->childNames( parent );
vector<InternedString> parentChildNames = parentChildNamesData->readable();
if( find( parentChildNames.begin(), parentChildNames.end(), target.back() ) == parentChildNames.end() )
{
throw Exception( boost::str( boost::format( "Target \"%s\" does not exist" ) % target.back().string() ) );
}
// go ahead and generate our childnames by incrementing a numeric suffix on
// the target name.
std::string stem;
int suffix = numericSuffix( target.back(), 0, &stem );
InternedStringVectorDataPtr childNames = new InternedStringVectorData;
boost::format formatter( "%s%d" );
int copies = copiesPlug()->getValue();
for( int i = 0; i < copies; ++i )
{
childNames->writable().push_back( boost::str( formatter % stem % ++suffix ) );
}
static_cast<InternedStringVectorDataPlug *>( output )->setValue( childNames );
return;
}
BranchCreator::compute( output, context );
}
示例6: scene
IECore::ConstInternedStringVectorDataPtr SceneReader::computeChildNames( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const
{
ConstSceneInterfacePtr s = scene( path );
if( !s )
{
return parent->childNamesPlug()->defaultValue();
}
// get the child names
InternedStringVectorDataPtr resultData = new InternedStringVectorData;
vector<InternedString> &result = resultData->writable();
s->childNames( result );
// filter out any which don't have the right tags
std::string tagsString = tagsPlug()->getValue();
if( !tagsString.empty() )
{
typedef boost::tokenizer<boost::char_separator<char> > Tokenizer;
Tokenizer tagsTokenizer( tagsString, boost::char_separator<char>( " " ) );
vector<InternedString> tags;
std::copy( tagsTokenizer.begin(), tagsTokenizer.end(), back_inserter( tags ) );
vector<InternedString>::iterator newResultEnd = result.begin();
SceneInterface::NameList childTags;
for( vector<InternedString>::const_iterator cIt = result.begin(), cEIt = result.end(); cIt != cEIt; ++cIt )
{
ConstSceneInterfacePtr child = s->child( *cIt );
childTags.clear();
child->readTags( childTags, IECore::SceneInterface::EveryTag );
bool childMatches = false;
for( SceneInterface::NameList::const_iterator tIt = childTags.begin(), tEIt = childTags.end(); tIt != tEIt; ++tIt )
{
if( find( tags.begin(), tags.end(), *tIt ) != tags.end() )
{
childMatches = true;
break;
}
}
if( childMatches )
{
*newResultEnd++ = *cIt;
}
}
result.erase( newResultEnd, result.end() );
}
return resultData;
}
示例7: scene
IECore::ConstInternedStringVectorDataPtr SceneReader::computeSetNames( const Gaffer::Context *context, const ScenePlug *parent ) const
{
ConstSceneInterfacePtr s = scene( ScenePath() );
if( !s )
{
return parent->setNamesPlug()->defaultValue();
}
InternedStringVectorDataPtr result = new InternedStringVectorData();
s->readTags( result->writable(), SceneInterface::LocalTag | SceneInterface::DescendantTag );
return result;
}
示例8: computeChildNames
IECore::ConstInternedStringVectorDataPtr AlembicSource::computeChildNames( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const
{
if( AlembicInputPtr i = inputForPath( path ) )
{
ConstStringVectorDataPtr c = i->childNames();
InternedStringVectorDataPtr result = new InternedStringVectorData;
result->writable().insert( result->writable().end(), c->readable().begin(), c->readable().end() );
return result;
}
else
{
return parent->childNamesPlug()->defaultValue();
}
}
示例9: entryForPath
IECore::ConstInternedStringVectorDataPtr CompoundObjectSource::computeChildNames( const ScenePath &path, const Gaffer::Context *context, const GafferScene::ScenePlug *parent ) const
{
ConstCompoundObjectPtr entry = entryForPath( path );
ConstCompoundObjectPtr children = entry->member<CompoundObject>( "children" );
if( !children )
{
return outPlug()->childNamesPlug()->defaultValue();
}
InternedStringVectorDataPtr result = new InternedStringVectorData;
for( CompoundObject::ObjectMap::const_iterator it = children->members().begin(); it!=children->members().end(); it++ )
{
result->writable().push_back( it->first.value() );
}
return result;
}
示例10: fileNamePlug
IECore::ConstInternedStringVectorDataPtr SceneReader::computeChildNames( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const
{
std::string fileName = fileNamePlug()->getValue();
if( !fileName.size() )
{
return parent->childNamesPlug()->defaultValue();
}
ConstSceneInterfacePtr s = SharedSceneInterfaces::get( fileName );
s = s->scene( path );
InternedStringVectorDataPtr result = new InternedStringVectorData;
s->childNames( result->writable() );
return result;
}
示例11: Context
Gaffer::ContextPtr Instancer::instanceContext( const Gaffer::Context *parentContext, const ScenePath &branchPath ) const
{
if( branchPath.size() == 0 )
{
return 0;
}
ContextPtr result = new Context( *parentContext );
InternedStringVectorDataPtr instancePath = new InternedStringVectorData;
instancePath->writable().insert( instancePath->writable().end(), branchPath.begin() + 1, branchPath.end() );
result->set( ScenePlug::scenePathContextName, instancePath.get() );
result->set( "instancer:id", instanceIndex( branchPath ) );
return result;
}
示例12: inObject
IECore::ConstInternedStringVectorDataPtr CompoundObjectSource::computeSetNames( const Gaffer::Context *context, const GafferScene::ScenePlug *parent ) const
{
ConstCompoundObjectPtr compoundObject = inObject();
if( ConstCompoundObjectPtr sets = compoundObject->member<CompoundObject>( "sets" ) )
{
InternedStringVectorDataPtr resultData = new InternedStringVectorData;
std::vector<InternedString> &result = resultData->writable();
for( CompoundObject::ObjectMap::const_iterator it = sets->members().begin(), eIt = sets->members().end(); it != eIt; ++it )
{
result.push_back( it->first );
}
return resultData;
}
return outPlug()->setNamesPlug()->defaultValue();
}
示例13: inPlug
IECore::ConstInternedStringVectorDataPtr Set::computeSetNames( const Gaffer::Context *context, const ScenePlug *parent ) const
{
ConstInternedStringVectorDataPtr inNamesData = inPlug()->setNamesPlug()->getValue();
const std::string &names = namePlug()->getValue();
if( !names.size() )
{
return inNamesData;
}
if( modePlug()->getValue() == Remove )
{
return inNamesData;
}
vector<InternedString> tokenizedNames;
StringAlgo::tokenize( names, ' ', tokenizedNames );
// specific logic if we have only one item, to avoid the more complex logic of adding two lists together
if( tokenizedNames.size() == 1 ) {
const std::vector<InternedString> &inNames = inNamesData->readable();
if( std::find( inNames.begin(), inNames.end(), tokenizedNames[0] ) != inNames.end() )
{
return inNamesData;
}
InternedStringVectorDataPtr resultData = inNamesData->copy();
resultData->writable().push_back( tokenizedNames[0] );
return resultData;
}
// inserting the new names into the vector
// while making sure we don't have duplicates
InternedStringVectorDataPtr resultData = inNamesData->copy();
std::vector<InternedString> &result = resultData->writable();
result.reserve( result.size() + tokenizedNames.size() );
std::copy( tokenizedNames.begin(), tokenizedNames.end(), std::back_inserter( result ) );
std::sort( result.begin(), result.end() );
std::vector<InternedString>::iterator it;
it = std::unique( result.begin(), result.end() );
result.resize( std::distance( result.begin(), it ) );
return resultData;
}
示例14: namePlug
IECore::ConstInternedStringVectorDataPtr Seeds::computeBranchChildNames( const ScenePath &parentPath, const ScenePath &branchPath, const Gaffer::Context *context ) const
{
if( branchPath.size() == 0 )
{
std::string name = namePlug()->getValue();
if( name.empty() )
{
return outPlug()->childNamesPlug()->defaultValue();
}
InternedStringVectorDataPtr result = new InternedStringVectorData();
result->writable().push_back( name );
return result;
}
else
{
return outPlug()->childNamesPlug()->defaultValue();
}
}
示例15: computeChildNames
IECore::ConstInternedStringVectorDataPtr Grid::computeChildNames( const SceneNode::ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const
{
if( path.size() <= 1 )
{
InternedStringVectorDataPtr resultData = new InternedStringVectorData;
std::vector<InternedString> &result = resultData->writable();
if( path.size() == 0 )
{
result.push_back( namePlug()->getValue() );
}
else
{
result.push_back( g_gridLinesName );
result.push_back( g_centerLinesName );
result.push_back( g_borderLinesName );
}
return resultData;
}
return outPlug()->childNamesPlug()->defaultValue();
}