示例#1
0
// --------------------------------------------------------------------------------------------------------
void KFileTreeWidget::setCurrentDir ( const std::string & dirName )
{
    std::string absDirPath;
    
    if (dirName[0] == '.' && current_dir_node) 
    {
        // path relative to the current directory should begin with a dot
        absDirPath = current_dir_node->getAbsPathName() + "/" + dirName;
    }
    else
    {
        absDirPath = kFileAbsPathName(dirName);
    }

    if (kFileIsDir(absDirPath) && (current_dir_node == NULL || (current_dir_node->getAbsPathName() != absDirPath)))
    {
        removeAllPickables();
        if (current_dir_node) 
        {
            delete current_dir_node;
        }
        current_dir_node = new KFileTreeDirCurrent(absDirPath);
        
        addPickable(up_node);
        addPickable(current_dir_node);
        current_dir_node->createTree();
        up_node->setCurrentDir(current_dir_node);
        initializeIds();
        deleteDisplayList();
        
        notifyReceivers (current_dir_node->getAbsPathName(), KDL_NOTIFICATION_TYPE_OPEN_DIRECTORY);
    }
}
	void setSpace( ca::ISpace* space )
	{
		if( !space )
		{
			CORAL_THROW( co::IllegalArgumentException, "NULL space" );
		}
		
		_space = space;
		initializeIds();
	}
	void onSubscribed(  const std::string& bytes,  const std::string& ids, const std::string& modelName  )
	{
		ca::IModelRef model = getModel( modelName );

		if( model->getName() != modelName )
		{
			CORAL_THROW( co::IllegalStateException, "Space's model different from the publisher" );
		}

		std::ofstream of ( "tmp.lua" );

		of << bytes;
		
		of.close();

		co::IObjectRef archiveObj = co::newInstance( "ca.LuaArchive" );
		archiveObj->getService<ca::INamed>()->setName( "tmp.lua" );

		archiveObj->setService( "model", model.get() );

		_rootObject = archiveObj->getService<ca::IArchive>()->restore();
		_ids = ids;
		initializeIds();
	}
MonteCarlo::MonteCarlo() {
	this->CORES=2;
	manager = new WorkStealingManager(CORES);
	duraction = 0;
	initializeIds();
}