本文整理汇总了C++中ConstStringVectorDataPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ConstStringVectorDataPtr类的具体用法?C++ ConstStringVectorDataPtr怎么用?C++ ConstStringVectorDataPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConstStringVectorDataPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hashColorData
void ColorProcessor::hashColorData( const Gaffer::Context *context, IECore::MurmurHash &h ) const
{
ConstStringVectorDataPtr channelNamesData;
{
ImagePlug::GlobalScope globalScope( context );
channelNamesData = inPlug()->channelNamesPlug()->getValue();
}
const vector<string> &channelNames = channelNamesData->readable();
const string &layerName = context->get<string>( g_layerNameKey );
ImagePlug::ChannelDataScope channelDataScope( context );
for( const auto &baseName : { "R", "G", "B" } )
{
string channelName = ImageAlgo::channelName( layerName, baseName );
if( ImageAlgo::channelExists( channelNames, channelName ) )
{
channelDataScope.setChannelName( channelName );
inPlug()->channelDataPlug()->hash( h );
}
else
{
ImagePlug::blackTile()->hash( h );
}
}
}
示例2: dataWindowPlug
IECore::MurmurHash ImagePlug::imageHash() const
{
const Box2i dataWindow = dataWindowPlug()->getValue();
ConstStringVectorDataPtr channelNamesData = channelNamesPlug()->getValue();
const vector<string> &channelNames = channelNamesData->readable();
MurmurHash result = formatPlug()->hash();
result.append( dataWindowPlug()->hash() );
result.append( metadataPlug()->hash() );
result.append( channelNamesPlug()->hash() );
V2i minTileOrigin = tileOrigin( dataWindow.min );
V2i maxTileOrigin = tileOrigin( dataWindow.max );
ContextPtr context = new Context( *Context::current(), Context::Borrowed );
Context::Scope scope( context.get() );
for( vector<string>::const_iterator it = channelNames.begin(), eIt = channelNames.end(); it!=eIt; it++ )
{
context->set( ImagePlug::channelNameContextName, *it );
for( int tileOriginY = minTileOrigin.y; tileOriginY<=maxTileOrigin.y; tileOriginY += tileSize() )
{
for( int tileOriginX = minTileOrigin.x; tileOriginX<=maxTileOrigin.x; tileOriginX += tileSize() )
{
context->set( ImagePlug::tileOriginContextName, V2i( tileOriginX, tileOriginY ) );
channelDataPlug()->hash( result );
}
}
}
return result;
}
示例3: dataWindowPlug
IECore::MurmurHash ImagePlug::imageHash() const
{
const Box2i dataWindow = dataWindowPlug()->getValue();
ConstStringVectorDataPtr channelNamesData = channelNamesPlug()->getValue();
const vector<string> &channelNames = channelNamesData->readable();
MurmurHash result = formatPlug()->hash();
result.append( dataWindowPlug()->hash() );
result.append( metadataPlug()->hash() );
result.append( channelNamesPlug()->hash() );
ImageAlgo::parallelGatherTiles(
this, channelNames,
// Tile
[] ( const ImagePlug *imagePlug, const string &channelName, const V2i &tileOrigin )
{
return imagePlug->channelDataPlug()->hash();
},
// Gather
[ &result ] ( const ImagePlug *imagePlug, const string &channelName, const V2i &tileOrigin, const IECore::MurmurHash &tileHash )
{
result.append( tileHash );
},
dataWindow,
ImageAlgo::BottomToTop
);
return result;
}
示例4: colorPlug
std::string ImageSampler::channelName( const Gaffer::ValuePlug *output ) const
{
std::string name;
const Color4fPlug *c = colorPlug();
if( output == c->getChild( 0 ) )
{
name = "R";
}
else if( output == c->getChild( 1 ) )
{
name = "G";
}
else if( output == c->getChild( 2 ) )
{
name = "B";
}
else if( output == c->getChild( 3 ) )
{
name = "A";
}
ConstStringVectorDataPtr channelNames = imagePlug()->channelNamesPlug()->getValue();
if( find( channelNames->readable().begin(), channelNames->readable().end(), name ) != channelNames->readable().end() )
{
return name;
}
return "";
}
示例5: uvPlug
void UVWarp::hashEngine( const std::string &channelName, const Imath::V2i &tileOrigin, const Gaffer::Context *context, IECore::MurmurHash &h ) const
{
Warp::hashEngine( channelName, tileOrigin, context, h );
h.append( tileOrigin );
uvPlug()->dataWindowPlug()->hash( h );
ConstStringVectorDataPtr channelNames = uvPlug()->channelNamesPlug()->getValue();
ContextPtr tmpContext = new Context( *context, Context::Borrowed );
Context::Scope scopedContext( tmpContext.get() );
if( channelExists( channelNames->readable(), "R" ) )
{
tmpContext->set<std::string>( ImagePlug::channelNameContextName, "R" );
uvPlug()->channelDataPlug()->hash( h );
}
if( channelExists( channelNames->readable(), "G" ) )
{
tmpContext->set<std::string>( ImagePlug::channelNameContextName, "G" );
uvPlug()->channelDataPlug()->hash( h );
}
if( channelExists( channelNames->readable(), "A" ) )
{
tmpContext->set<std::string>( ImagePlug::channelNameContextName, "A" );
uvPlug()->channelDataPlug()->hash( h );
}
inPlug()->formatPlug()->hash( h );
}
示例6: alphaChannelPlug
void Unpremultiply::processChannelData( const Gaffer::Context *context, const ImagePlug *parent, const std::string &channel, FloatVectorDataPtr outData ) const
{
std::string alphaChannel = alphaChannelPlug()->getValue();
if ( channel == alphaChannel )
{
return;
}
ConstStringVectorDataPtr inChannelNamesPtr = inPlug()->channelNamesPlug()->getValue();
const std::vector<std::string> &inChannelNames = inChannelNamesPtr->readable();
if ( std::find( inChannelNames.begin(), inChannelNames.end(), alphaChannel ) == inChannelNames.end() )
{
std::ostringstream channelError;
channelError << "Channel '" << alphaChannel << "' does not exist";
throw( IECore::Exception( channelError.str() ) );
}
ContextPtr tmpContext = new Context( *context, Context::Borrowed );
tmpContext->set( ImagePlug::channelNameContextName, alphaChannel );
Context::Scope scopedContext( tmpContext.get() );
const std::vector<float> &a = inPlug()->channelDataPlug()->getValue()->readable();
std::vector<float> &out = outData->writable();
std::vector<float>::const_iterator aIt = a.begin();
for ( std::vector<float>::iterator outIt = out.begin(), outItEnd = out.end(); outIt != outItEnd; ++outIt, ++aIt )
{
if ( *aIt != 0.0f )
{
*outIt /= *aIt;
}
}
}
示例7: formatPlug
IECore::ImagePrimitivePtr ImagePlug::image() const
{
Format format = formatPlug()->getValue();
Box2i dataWindow = dataWindowPlug()->getValue();
Box2i newDataWindow( Imath::V2i(0) );
if( dataWindow.isEmpty() )
{
dataWindow = Box2i( Imath::V2i(0) );
}
else
{
newDataWindow = format.yDownToFormatSpace( dataWindow );
}
ImagePrimitivePtr result = new ImagePrimitive( newDataWindow, format.getDisplayWindow() );
ConstStringVectorDataPtr channelNamesData = channelNamesPlug()->getValue();
const vector<string> &channelNames = channelNamesData->readable();
vector<float *> imageChannelData;
for( vector<string>::const_iterator it = channelNames.begin(), eIt = channelNames.end(); it!=eIt; it++ )
{
FloatVectorDataPtr cd = new FloatVectorData;
vector<float> &c = cd->writable();
c.resize( result->variableSize( PrimitiveVariable::Vertex ), 0.0f );
result->variables[*it] = PrimitiveVariable( PrimitiveVariable::Vertex, cd );
imageChannelData.push_back( &(c[0]) );
}
parallel_for( blocked_range2d<size_t>( 0, dataWindow.size().x+1, tileSize(), 0, dataWindow.size().y+1, tileSize() ),
GafferImage::Detail::CopyTiles( imageChannelData, channelNames, channelDataPlug(), dataWindow, Context::current(), tileSize()) );
return result;
}
示例8: pathsPlug
void PathFilter::compute( Gaffer::ValuePlug *output, const Gaffer::Context *context ) const
{
if( output == pathMatcherPlug() )
{
ConstStringVectorDataPtr paths = pathsPlug()->getValue();
PathMatcherDataPtr pathMatcherData = new PathMatcherData;
pathMatcherData->writable().init( paths->readable().begin(), paths->readable().end() );
static_cast<PathMatcherDataPlug *>( output )->setValue( pathMatcherData );
return;
}
Filter::compute( output, context );
}
示例9: 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();
}
}
示例10: tileBound
const Warp::Engine *VectorWarp::computeEngine( const Imath::V2i &tileOrigin, const Gaffer::Context *context ) const
{
const Box2i tileBound( tileOrigin, tileOrigin + V2i( ImagePlug::tileSize() ) );
Box2i validTileBound;
ConstStringVectorDataPtr channelNames;
Box2i displayWindow;
{
ImagePlug::GlobalScope c( context );
validTileBound = BufferAlgo::intersection( tileBound, vectorPlug()->dataWindowPlug()->getValue() );
channelNames = vectorPlug()->channelNamesPlug()->getValue();
displayWindow = inPlug()->formatPlug()->getValue().getDisplayWindow();
}
ImagePlug::ChannelDataScope channelDataScope( context );
ConstFloatVectorDataPtr xData = ImagePlug::blackTile();
if( ImageAlgo::channelExists( channelNames->readable(), "R" ) )
{
channelDataScope.setChannelName( "R" );
xData = vectorPlug()->channelDataPlug()->getValue();
}
ConstFloatVectorDataPtr yData = ImagePlug::blackTile();
if( ImageAlgo::channelExists( channelNames->readable(), "G" ) )
{
channelDataScope.setChannelName( "G" );
yData = vectorPlug()->channelDataPlug()->getValue();
}
ConstFloatVectorDataPtr aData = ImagePlug::whiteTile();
if( ImageAlgo::channelExists( channelNames->readable(), "A" ) )
{
channelDataScope.setChannelName( "A" );
aData = vectorPlug()->channelDataPlug()->getValue();
}
return new Engine(
displayWindow,
tileBound,
validTileBound,
xData,
yData,
aData,
(VectorMode)vectorModePlug()->getValue(),
(VectorUnits)vectorUnitsPlug()->getValue()
);
}
示例11: formatPlug
IECore::ImagePrimitivePtr ImagePlug::image() const
{
Format format = formatPlug()->getValue();
Box2i dataWindow = dataWindowPlug()->getValue();
Box2i newDataWindow( Imath::V2i(0) );
if( dataWindow.isEmpty() )
{
dataWindow = Box2i( Imath::V2i(0) );
}
else
{
newDataWindow = format.yDownToFormatSpace( dataWindow );
}
// use the default format if we don't have an explicit one.
/// \todo: remove this once FormatPlug is handling it for
/// us during ExecutableNode::execute (see issue #887).
if( format.getDisplayWindow().isEmpty() )
{
format = Context::current()->get<Format>( Format::defaultFormatContextName, Format() );
}
ImagePrimitivePtr result = new ImagePrimitive( newDataWindow, format.getDisplayWindow() );
ConstCompoundObjectPtr metadata = metadataPlug()->getValue();
compoundObjectToCompoundData( metadata.get(), result->blindData() );
ConstStringVectorDataPtr channelNamesData = channelNamesPlug()->getValue();
const vector<string> &channelNames = channelNamesData->readable();
vector<float *> imageChannelData;
for( vector<string>::const_iterator it = channelNames.begin(), eIt = channelNames.end(); it!=eIt; it++ )
{
FloatVectorDataPtr cd = new FloatVectorData;
vector<float> &c = cd->writable();
c.resize( result->variableSize( PrimitiveVariable::Vertex ), 0.0f );
result->variables[*it] = PrimitiveVariable( PrimitiveVariable::Vertex, cd );
imageChannelData.push_back( &(c[0]) );
}
parallel_for( blocked_range3d<size_t>( 0, imageChannelData.size(), 1, 0, dataWindow.size().x+1, tileSize(), 0, dataWindow.size().y+1, tileSize() ),
GafferImage::Detail::CopyTiles( imageChannelData, channelNames, channelDataPlug(), dataWindow, Context::current(), tileSize()) );
return result;
}
示例12: compute
void ColorProcessor::compute( Gaffer::ValuePlug *output, const Gaffer::Context *context ) const
{
if( output == colorDataPlug() )
{
ConstStringVectorDataPtr channelNamesData;
{
ImagePlug::GlobalScope globalScope( context );
channelNamesData = inPlug()->channelNamesPlug()->getValue();
}
const vector<string> &channelNames = channelNamesData->readable();
const string &layerName = context->get<string>( g_layerNameKey );
FloatVectorDataPtr rgb[3];
{
ImagePlug::ChannelDataScope channelDataScope( context );
int i = 0;
for( const auto &baseName : { "R", "G", "B" } )
{
string channelName = ImageAlgo::channelName( layerName, baseName );
if( ImageAlgo::channelExists( channelNames, channelName ) )
{
channelDataScope.setChannelName( channelName );
rgb[i] = inPlug()->channelDataPlug()->getValue()->copy();
}
else
{
rgb[i] = ImagePlug::blackTile()->copy();
}
i++;
}
}
processColorData( context, rgb[0].get(), rgb[1].get(), rgb[2].get() );
ObjectVectorPtr result = new ObjectVector();
result->members().push_back( rgb[0] );
result->members().push_back( rgb[1] );
result->members().push_back( rgb[2] );
static_cast<ObjectPlug *>( output )->setValue( result );
return;
}
ImageProcessor::compute( output, context );
}
示例13: getValue
void ChannelMaskPlug::maskChannels( std::vector<std::string> &inChannels ) const
{
ConstStringVectorDataPtr channelNamesData = getValue();
const std::vector<std::string> &maskChannels = channelNamesData->readable();
// Intersect the inChannels and the maskChannels in place.
std::vector<std::string>::iterator cIt( inChannels.begin() );
while ( cIt != inChannels.end() )
{
if ( std::find( maskChannels.begin(), maskChannels.end(), (*cIt) ) == maskChannels.end() )
{
cIt = inChannels.erase( cIt );
}
else
{
++cIt;
}
}
}
示例14: inPlug
void OSLImage::hashShading( const Gaffer::Context *context, IECore::MurmurHash &h ) const
{
const V2i tileOrigin = context->get<V2i>( ImagePlug::tileOriginContextName );
h.append( tileOrigin );
inPlug()->formatPlug()->hash( h );
ConstStringVectorDataPtr channelNamesData = inPlug()->channelNamesPlug()->getValue();
const vector<string> &channelNames = channelNamesData->readable();
for( vector<string>::const_iterator it = channelNames.begin(), eIt = channelNames.end(); it != eIt; ++it )
{
h.append( inPlug()->channelDataHash( *it, tileOrigin ) );
}
const OSLShader *shader = runTimeCast<const OSLShader>( shaderPlug()->source<Plug>()->node() );
if( shader )
{
shader->stateHash( h );
}
}
示例15: channelsPlug
void CopyChannels::compute( Gaffer::ValuePlug *output, const Gaffer::Context *context ) const
{
if( output == mappingPlug() )
{
const string channelMatchPatterns = channelsPlug()->getValue();
CompoundObjectPtr result = new CompoundObject();
StringVectorDataPtr channelNamesData = new StringVectorData;
result->members()["__channelNames"] = channelNamesData;
vector<string> &channelNames = channelNamesData->writable();
size_t i = 0;
for( ImagePlugIterator it( inPlugs() ); !it.done(); ++i, ++it )
{
/// \todo We need this check because an unconnected input
/// has a default channelNames value of [ "R", "G", "B" ],
/// when it should have an empty default instead. Fix
/// the ImagePlug constructor and remove the check.
if( !(*it)->getInput<Plug>() )
{
continue;
}
ConstStringVectorDataPtr inputChannelNamesData = (*it)->channelNamesPlug()->getValue();
const vector<string> &inputChannelNames = inputChannelNamesData->readable();
for( vector<string>::const_iterator cIt = inputChannelNames.begin(), ceIt = inputChannelNames.end(); cIt != ceIt; ++cIt )
{
if( i > 0 && !StringAlgo::matchMultiple( *cIt, channelMatchPatterns ) )
{
continue;
}
if( find( channelNames.begin(), channelNames.end(), *cIt ) == channelNames.end() )
{
channelNames.push_back( *cIt );
}
result->members()[*cIt] = new IntData( i );
}
}
static_cast<CompoundObjectPlug *>( output )->setValue( result );
return;
}
ImageProcessor::compute( output, context );
}