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


C++ GraphComponent类代码示例

本文整理汇总了C++中GraphComponent的典型用法代码示例。如果您正苦于以下问题:C++ GraphComponent类的具体用法?C++ GraphComponent怎么用?C++ GraphComponent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GraphComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

GraphComponent *GraphComponent::commonAncestor( const GraphComponent *other, IECore::TypeId ancestorType )
{
	set<GraphComponent *> candidates;
	GraphComponent *ancestor = m_parent;
	while( ancestor )
	{
		if( ancestor->isInstanceOf( ancestorType ) )
		{
			candidates.insert( ancestor );
		}
		ancestor = ancestor->m_parent;
	}

	ancestor = other->m_parent;
	while( ancestor )
	{
		if( ancestor->isInstanceOf( ancestorType ) )
		{
			if( candidates.find( ancestor )!=candidates.end() )
			{
				return ancestor;
			}
		}
		ancestor = ancestor->m_parent;
	}
	return 0;

}
开发者ID:dboogert,项目名称:gaffer,代码行数:28,代码来源:GraphComponent.cpp

示例2: ComponentFileName

 string ComponentFileName(size_t cnt, const string &folder, const GraphComponent<Graph>& component) {
     stringstream ss;
     ss << folder << cnt;
     if(component.name().size() > 0)
         ss << "graph_" << component.name();
     ss << ".dot";
     return ss.str();
 }
开发者ID:starostinak,项目名称:ig_quast,代码行数:8,代码来源:visualizers.hpp

示例3: DBG

//==============================================================================
void HostFilterComponent::loadPluginFromFile (const File& file)
{
    DBG ("HostFilterComponent::loadPluginFromFile");

    GraphComponent* graph = main->getGraph ();

    if (graph) graph->loadAndAppendPlugin (file, 100, 100);
}
开发者ID:christianscheuer,项目名称:jivemodular,代码行数:9,代码来源:HostFilterComponent.cpp

示例4: ComponentName

 string ComponentName(const GraphComponent<Graph>& component) {
     cnt_++;
     stringstream ss;
     ss << name_ << "_" << cnt_;
     if(component.name().size() > 0)
         ss << "_" << component.name();
     ss << "." << extension_;
     return ss.str();
 }
开发者ID:starostinak,项目名称:ig_quast,代码行数:9,代码来源:visualizers.hpp

示例5: Visualize

 void Visualize(const GraphComponent<Graph>& component, GraphPrinter<Graph> &printer) {
     printer.open();
     printer.AddVertices(component.vertices().begin(), component.vertices().end());
     for (auto e_it = component.e_begin(); e_it != component.e_end();
             ++e_it) {
         printer.AddEdge(*e_it);
     }
     printer.close();
 }
开发者ID:starostinak,项目名称:ig_quast,代码行数:9,代码来源:visualizers.hpp

示例6: Check

 bool Check(const GraphComponent<Graph> & component) const {
     if (component.v_size() <= min_vertex_number_
             || component.v_size() >= max_vertex_number_)
         return false;
     for (auto iterator = component.e_begin(); iterator != component.e_end();
             ++iterator) {
         if (this->graph().length(*iterator) <= max_length_) {
             return true;
         }
     }
     return false;
 }
开发者ID:starostinak,项目名称:ig_quast,代码行数:12,代码来源:component_filters.hpp

示例7: loadShaderParameters

static void loadShaderParameters( const OSLQuery &query, Gaffer::CompoundPlug *parametersPlug, bool keepExistingValues )
{	
	
	// if we're not preserving existing values then remove all existing parameter plugs - the various
	// plug creators above know that if a plug exists then they should preserve its values.
	
	if( !keepExistingValues )
	{
		parametersPlug->clearChildren();
	}
	
	// make sure we have a plug to represent each parameter, reusing plugs wherever possible.
	
	set<string> validPlugNames;
	for( size_t i = 0; i < query.nparams(); ++i )
	{
		const OSLQuery::Parameter *parameter = query.getparam( i );
		const Plug::Direction direction = parameter->isoutput ? Plug::Out : Plug::In;
		if( direction != parametersPlug->direction() )
		{
			continue;
		} 
		
		if( parameter->name.find( "." ) != string::npos )
		{
			// member of a struct - will be loaded when the struct is loaded
			continue;
		}
		
		const Plug *plug = loadShaderParameter( query, parameter, parametersPlug, keepExistingValues );

		if( plug )
		{
			validPlugNames.insert( parameter->name );
		}
	}
	
	// remove any old plugs which it turned out we didn't need
	
	if( keepExistingValues )
	{
		for( int i = parametersPlug->children().size() - 1; i >= 0; --i )
		{
			GraphComponent *child = parametersPlug->getChild<GraphComponent>( i );
			if( validPlugNames.find( child->getName().string() ) == validPlugNames.end() )
			{
				parametersPlug->removeChild( child );
			}
		}
	}
	
}
开发者ID:JohanAberg,项目名称:gaffer,代码行数:52,代码来源:OSLShader.cpp

示例8: while

void Graph::buildDataStructure ()
{
    int lastReachedVertex = 0;
	
    while (lastReachedVertex < size)
    {
		if (!reachedVertices[lastReachedVertex])
		{
			GraphComponent *component = new GraphComponent(this);
			std::list<int> *connectedVertices = new std::list<int>();
			std::list<int> *nextVertices = new std::list<int>();
			nextVertices->push_back(lastReachedVertex);
			reachedVertices[lastReachedVertex] = true;
			
			while (!nextVertices->empty())
			{
				int vertex = nextVertices->front();
				nextVertices->pop_front();
				
				connectedVertices->push_back(vertex);
				graphComponents[vertex] = component;
				
				Vertices *adjVertices = getAdjacentVertices(vertex,size);
				for (Vertices::iterator it = adjVertices->begin(); it != adjVertices->end(); ++it)
				{
					int adjVertex = *it;
					if (!reachedVertices[adjVertex])
					{
						nextVertices->push_back(adjVertex);
						reachedVertices[adjVertex] = true;
					}
				}
				delete adjVertices;
			}
			
			delete nextVertices;
			
			component->setVertices(connectedVertices);
			graphComponentSet->insert(component);
			
			delete connectedVertices;			
		}
		
		lastReachedVertex++;
    }
	
    for (GraphComponentSet::iterator it = graphComponentSet->begin(); it != graphComponentSet->end(); ++it)
		(*it)->buildDataStructure();
}
开发者ID:Lamarche-Perrin,项目名称:optimal_partition,代码行数:49,代码来源:graph.cpp

示例9: if

void InternalGraph::assignPath(AntPath * pt)
{
    GraphComponent * gc;
    const std::vector<PathElement *> & path = pt->getPath();
    for (int i = 0; i < path.size(); ++ i)
    {
        if (path[i]->request == 0) continue;
        gc = vertices[path[i]->request-1];
        if (gc->getType() == GraphComponent::VMACHINE)
        {
            curNodesRes[path[i]->resource] -= gc->getRequired();
            curNodesRam[path[i]->resource] -= gc->getRequiredRam();
        }
        else if (gc->getType() == GraphComponent::STORAGE) curStoresRes[path[i]->resource] -= gc->getRequired();
    }
}
开发者ID:MargaritaShakhova,项目名称:DataCenters,代码行数:16,代码来源:internalgraph.cpp

示例10: addChildInternal

void GraphComponent::addChildInternal( GraphComponentPtr child )
{
	child->parentChanging( this );
	GraphComponent *previousParent = child->m_parent;
	if( previousParent )
	{
		// remove the child from the previous parent, but don't emit parentChangedSignal.
		// this prevents a parent changed signal with new parent 0 followed by a parent
		// changed signal with the new parent.
		previousParent->removeChildInternal( child, false );
	}
	m_children.push_back( child );
	child->m_parent = this;
	child->setName( child->m_name.value() ); // to force uniqueness
	childAddedSignal()( this, child.get() );
	child->parentChangedSignal()( child.get(), previousParent );
}
开发者ID:dboogert,项目名称:gaffer,代码行数:17,代码来源:GraphComponent.cpp

示例11: WriteSimpleComponent

void WriteSimpleComponent(const GraphComponent<Graph>& gc,
		const string& file_name, shared_ptr<GraphColorer<Graph>> colorer,
		const GraphLabeler<Graph> &labeler) {
    EmptyGraphLinker<Graph> linker;
    ofstream os;
    os.open(file_name);
	omnigraph::visualization::ComponentVisualizer<Graph>(gc.g(), false).Visualize(gc, os, labeler, *colorer, linker);
	os.close();
}
开发者ID:starostinak,项目名称:ig_quast,代码行数:9,代码来源:visualization_utils.hpp

示例12: menuItemSelected

void HostFilterComponent::menuItemSelected (int menuItemID,
                                            int topLevelMenuIndex)
{
    Config* config = Config::getInstance();
    GraphComponent* graph = main->getGraph ();

    switch (topLevelMenuIndex)
    {
    case 0: // CommandCategories::file
        {
            // handle recent plugins selection
            int fileID = menuItemID - CommandIDs::recentPlugins;
            if (fileID >= 0 && fileID < config->recentPlugins.getNumFiles())
            {
                File fileToLoad = config->recentPlugins.getFile (fileID);

                if (graph)
                    graph->loadAndAppendPlugin (config->recentPlugins.getFile (fileID), 100, 100);

                break;
            }

            // handle recent session selection
            fileID = menuItemID - CommandIDs::recentSessions;
            if (fileID >= 0 && fileID < config->recentSessions.getNumFiles())
            {
                MemoryBlock fileData;
                File fileToLoad = config->recentSessions.getFile (fileID);

                if (fileToLoad.existsAsFile()
                    && fileToLoad.loadFileAsData (fileData))
                {
                    getFilter ()->setStateInformation (fileData.getData (), fileData.getSize());

                    Config::getInstance()->addRecentSession (fileToLoad);
                    Config::getInstance()->lastSessionFile = fileToLoad;
                }
            }
            break;
        }
    }

    toFront (true);
}
开发者ID:christianscheuer,项目名称:jivemodular,代码行数:44,代码来源:HostFilterComponent.cpp

示例13: WriteComponent

void WriteComponent(const GraphComponent<Graph>& gc,
		const string& file_name, shared_ptr<GraphColorer<Graph>> colorer,
		const GraphLabeler<Graph> &labeler) {
    EmptyGraphLinker<Graph> linker;
    BorderDecorator<Graph> component_colorer(gc, *colorer, "yellow");
    ofstream os;
    os.open(file_name);
	omnigraph::visualization::ComponentVisualizer<Graph>(gc.g(), true).Visualize(gc, os, labeler, component_colorer, linker);
	os.close();
}
开发者ID:starostinak,项目名称:ig_quast,代码行数:10,代码来源:visualization_utils.hpp

示例14: values

static boost::python::list values( GraphComponent &c )
{
	const GraphComponent::ChildContainer &ch = c.children();
	boost::python::list l;
	for( GraphComponent::ChildContainer::const_iterator it=ch.begin(); it!=ch.end(); it++ )
	{
		l.append( *it );
	}
	return l;
}
开发者ID:cedriclaunay,项目名称:gaffer,代码行数:10,代码来源:GraphComponentBinding.cpp

示例15: addChildInternal

void GraphComponent::addChildInternal( GraphComponentPtr child, size_t index )
{
	child->parentChanging( this );
	GraphComponent *previousParent = child->m_parent;
	if( previousParent )
	{
		// remove the child from the previous parent, but don't emit parentChangedSignal.
		// this prevents a parent changed signal with new parent null followed by a parent
		// changed signal with the new parent.
		previousParent->removeChildInternal( child, false );
	}

	m_children.insert( m_children.begin() + min( index, m_children.size() ), child );
	child->m_parent = this;
	child->setName( child->m_name.value() ); // to force uniqueness
	Signals::emitLazily( m_signals.get(), &Signals::childAddedSignal, this, child.get() );
	child->parentChanged( previousParent );
	Signals::emitLazily( child->m_signals.get(), &Signals::parentChangedSignal, child.get(), previousParent );
}
开发者ID:dmar,项目名称:gaffer,代码行数:19,代码来源:GraphComponent.cpp


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