本文整理汇总了C++中ConstStringVectorDataPtr::readable方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstStringVectorDataPtr::readable方法的具体用法?C++ ConstStringVectorDataPtr::readable怎么用?C++ ConstStringVectorDataPtr::readable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConstStringVectorDataPtr
的用法示例。
在下文中一共展示了ConstStringVectorDataPtr::readable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hashEngine
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 );
}
示例2: channelName
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 "";
}
示例3: compute
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 );
}
示例4: 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();
}
}
示例5: c
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()
);
}
示例6: processChannelData
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: imageHash
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;
}
示例8: 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 );
}
}
}
示例9: imageHash
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;
}
示例10: image
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;
}
示例11: scopedContext
const Warp::Engine *UVWarp::computeEngine( const std::string &channelName, const Imath::V2i &tileOrigin, const Gaffer::Context *context ) const
{
const Box2i tileBound( tileOrigin, tileOrigin + V2i( ImagePlug::tileSize() ) );
const Box2i validTileBound = intersection( tileBound, uvPlug()->dataWindowPlug()->getValue() );
ConstStringVectorDataPtr channelNames = uvPlug()->channelNamesPlug()->getValue();
ContextPtr tmpContext = new Context( *context, Context::Borrowed );
Context::Scope scopedContext( tmpContext.get() );
ConstFloatVectorDataPtr uData = ImagePlug::blackTile();
if( channelExists( channelNames->readable(), "R" ) )
{
tmpContext->set<std::string>( ImagePlug::channelNameContextName, "R" );
uData = uvPlug()->channelDataPlug()->getValue();
}
ConstFloatVectorDataPtr vData = ImagePlug::blackTile();
if( channelExists( channelNames->readable(), "G" ) )
{
tmpContext->set<std::string>( ImagePlug::channelNameContextName, "G" );
vData = uvPlug()->channelDataPlug()->getValue();
}
ConstFloatVectorDataPtr aData = ImagePlug::whiteTile();
if( channelExists( channelNames->readable(), "A" ) )
{
tmpContext->set<std::string>( ImagePlug::channelNameContextName, "A" );
aData = uvPlug()->channelDataPlug()->getValue();
}
return new Engine(
inPlug()->formatPlug()->getValue().getDisplayWindow(),
tileBound,
validTileBound,
uData,
vData,
aData
);
}
示例12: computeChannelNames
IECore::ConstStringVectorDataPtr OSLImage::computeChannelNames( const Gaffer::Context *context, const GafferImage::ImagePlug *parent ) const
{
ConstStringVectorDataPtr channelNamesData = inPlug()->channelNamesPlug()->getValue();
set<string> result( channelNamesData->readable().begin(), channelNamesData->readable().end() );
const Box2i dataWindow = inPlug()->dataWindowPlug()->getValue();
if( !dataWindow.isEmpty() )
{
ContextPtr c = new Context( *context, Context::Borrowed );
c->set( ImagePlug::tileOriginContextName, ImagePlug::tileOrigin( dataWindow.min ) );
Context::Scope s( c.get() );
ConstCompoundDataPtr shading = runTimeCast<const CompoundData>( shadingPlug()->getValue() );
for( CompoundDataMap::const_iterator it = shading->readable().begin(), eIt = shading->readable().end(); it != eIt; ++it )
{
result.insert( it->first );
}
}
return new StringVectorData( vector<string>( result.begin(), result.end() ) );
}
示例13: hashEngine
void VectorWarp::hashEngine( const Imath::V2i &tileOrigin, const Gaffer::Context *context, IECore::MurmurHash &h ) const
{
Warp::hashEngine( tileOrigin, context, h );
h.append( tileOrigin );
ConstStringVectorDataPtr channelNames;
{
ImagePlug::GlobalScope c( context );
channelNames = vectorPlug()->channelNamesPlug()->getValue();
vectorPlug()->dataWindowPlug()->hash( h );
inPlug()->formatPlug()->hash( h );
}
ImagePlug::ChannelDataScope channelDataScope( context );
if( ImageAlgo::channelExists( channelNames->readable(), "R" ) )
{
channelDataScope.setChannelName( "R" );
vectorPlug()->channelDataPlug()->hash( h );
}
if( ImageAlgo::channelExists( channelNames->readable(), "G" ) )
{
channelDataScope.setChannelName( "G" );
vectorPlug()->channelDataPlug()->hash( h );
}
if( ImageAlgo::channelExists( channelNames->readable(), "A" ) )
{
channelDataScope.setChannelName( "A" );
vectorPlug()->channelDataPlug()->hash( h );
}
vectorModePlug()->hash( h );
vectorUnitsPlug()->hash( h );
}
示例14: plugDirtied
void PathFilter::plugDirtied( const Gaffer::Plug *plug )
{
if( plug == pathsPlug() )
{
//\todo: share this logic with Switch::variesWithContext()
Plug* sourcePlug = pathsPlug()->source();
if( sourcePlug->direction() == Plug::Out && IECore::runTimeCast<const ComputeNode>( sourcePlug->node() ) )
{
// pathsPlug() is receiving data from a plug whose value is context varying, meaning
// we need to use the intermediate pathMatcherPlug() in computeMatch() instead:
m_pathMatcher = nullptr;
}
else
{
// pathsPlug() value is not context varying, meaning we can save on graph evaluations
// by just precomputing it here and directly using it in computeMatch():
ConstStringVectorDataPtr paths = pathsPlug()->getValue();
m_pathMatcher = new PathMatcherData;
m_pathMatcher->writable().init( paths->readable().begin(), paths->readable().end() );
}
}
}
示例15: 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 );
}