Example #1
0
FileNode *
FileNode::Lookup(const char *componentName, const char *fileName)
{
    // do this first before we take out the lock
    FileNode *partial = Lookup( fileName );

    Lock lock( &gMapLock );

    // fullName is "[componentName]::[fileName]"
    string fullName = componentName;
    fullName += "::";
    fullName += fileName;

    FileNodeMap::const_iterator it = gFileMap.find( fullName );

    if(it != gFileMap.end())
    {
	return it->second;
    } else
    {
	FileNode *node = new FileNode( componentName, fileName );
	gFileMap.insert( make_pair( fullName, node ));

	// partial node never publishes, but it can forward publications from
	// the fully specified nodes..
	partial->addPublisher( node );

	return node;
    }
}