examples/eqNBody/pipe.cpp

00001 /*
00002  * Copyright (c) 2009, Philippe Robert <probert@eyescale.ch> 
00003  *
00004  * This library is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU Lesser General Public License version 2.1 as published
00006  * by the Free Software Foundation.
00007  *  
00008  * This library is distributed in the hope that it will be useful, but WITHOUT
00009  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00010  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00011  * details.
00012  * 
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this library; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016  */
00017 
00018 #include "pipe.h"
00019 #include "config.h"
00020 
00021 using namespace eq::base;
00022 using namespace std;
00023 
00024 namespace eqNbody
00025 {           
00026     bool Pipe::configInit( const uint32_t initID )
00027     {
00028         if( !eq::Pipe::configInit( initID )) {
00029             return false;
00030         }
00031         
00032         Config*         config      = static_cast<Config*>( getConfig() );
00033         const InitData& initData    = config->getInitData();
00034         const uint32_t  frameDataID = initData.getFrameDataID();
00035                 
00036         _frameData.init(initData.getNumBodies());
00037 
00038         const bool mapped = config->mapObject( &_frameData, frameDataID );
00039         EQASSERT( mapped );
00040 
00041         return mapped;
00042     }
00043     
00044     bool Pipe::configExit()
00045     {
00046         eq::Config* config = getConfig();
00047         config->unmapObject( &_frameData );
00048                         
00049         return eq::Pipe::configExit();
00050     }
00051         
00052     void Pipe::frameStart( const uint32_t frameID, const uint32_t frameNumber )
00053     {                               
00054         // Sync for the next frame - wait for the data broadcast!
00055         _frameData.sync( frameID );
00056         eq::Pipe::frameStart( frameID, frameNumber );
00057     }
00058                     
00059 }
Generated on Mon Aug 10 18:58:40 2009 for Equalizer 0.9 by  doxygen 1.5.8