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


C++ ConstStringVectorDataPtr类代码示例

本文整理汇总了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 );
		}
	}
}
开发者ID:ImageEngine,项目名称:gaffer,代码行数:26,代码来源:ColorProcessor.cpp

示例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;
}
开发者ID:CRiant,项目名称:gaffer,代码行数:32,代码来源:ImagePlug.cpp

示例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;
}
开发者ID:ImageEngine,项目名称:gaffer,代码行数:29,代码来源:ImagePlug.cpp

示例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 "";
}
开发者ID:cedriclaunay,项目名称:gaffer,代码行数:30,代码来源:ImageSampler.cpp

示例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 );
}
开发者ID:HughMacdonald,项目名称:gaffer,代码行数:32,代码来源:UVWarp.cpp

示例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;
		}
	}
}
开发者ID:nicoduce,项目名称:gaffer,代码行数:34,代码来源:Unpremultiply.cpp

示例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;
}
开发者ID:sonyomega,项目名称:gaffer,代码行数:35,代码来源:ImagePlug.cpp

示例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 );
}
开发者ID:mattigruener,项目名称:gaffer,代码行数:13,代码来源:PathFilter.cpp

示例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();
	}
}
开发者ID:JohanAberg,项目名称:gaffer,代码行数:14,代码来源:AlembicSource.cpp

示例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()
	);
}
开发者ID:boberfly,项目名称:gaffer,代码行数:50,代码来源:VectorWarp.cpp

示例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;
}
开发者ID:Eryckz,项目名称:gaffer,代码行数:46,代码来源:ImagePlug.cpp

示例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 );
}
开发者ID:ImageEngine,项目名称:gaffer,代码行数:46,代码来源:ColorProcessor.cpp

示例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;
		}
	}
}
开发者ID:JohanAberg,项目名称:gaffer,代码行数:19,代码来源:ChannelMaskPlug.cpp

示例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 );
	}
}
开发者ID:cnpinto,项目名称:gaffer,代码行数:19,代码来源:OSLImage.cpp

示例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 );
}
开发者ID:boberfly,项目名称:gaffer,代码行数:42,代码来源:CopyChannels.cpp


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