compoundInitVisitor.cpp

00001 
00002 /* Copyright (c) 2007-2009, Stefan Eilemann <eile@equalizergraphics.com> 
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 "compoundInitVisitor.h"
00019 
00020 #include "config.h"
00021 #include "frame.h"
00022 #include "log.h"
00023 #include "segment.h"
00024 #include "view.h"
00025 #include "window.h"
00026 #include "swapBarrier.h"
00027 #include <eq/client/log.h>
00028 
00029 using namespace std;
00030 using namespace eq::base;
00031 
00032 namespace eq
00033 {
00034 namespace server
00035 {
00036 CompoundInitVisitor::CompoundInitVisitor()
00037         : _taskID( 0 )
00038 {}
00039 
00040 VisitorResult CompoundInitVisitor::visit( Compound* compound )
00041 {
00042     compound->setTaskID( ++_taskID );
00043 
00044     Channel* channel = compound->getChannel();
00045     if( compound->isDestination() && !channel->getSegment( ))
00046     {
00047         EQASSERT( !channel->getView( ));
00048         
00049         // old-school (non-Layout) destination channel, activate compound
00050         //  layout destination channel compounds are activated by canvas
00051         compound->activate();
00052     }
00053     
00054     Config*        config  = compound->getConfig();
00055     const uint32_t latency = config->getLatency();
00056     EQASSERT( config );
00057     
00058     const std::vector< Frame* >& outputFrames = compound->getOutputFrames();
00059     for( vector<Frame*>::const_iterator i = outputFrames.begin(); 
00060          i != outputFrames.end(); ++i )
00061     {
00062         Frame* frame = *i;
00063         config->registerObject( frame );
00064         frame->setAutoObsolete( latency );
00065         EQLOG( eq::LOG_ASSEMBLY ) << "Output frame \"" << frame->getName() 
00066                                   << "\" id " << frame->getID() << endl;
00067     }
00068 
00069     const std::vector< Frame* >& inputFrames = compound->getInputFrames();
00070     for( vector<Frame*>::const_iterator i = inputFrames.begin(); 
00071          i != inputFrames.end(); ++i )
00072     {
00073         Frame* frame = *i;
00074         config->registerObject( frame );
00075         frame->setAutoObsolete( latency );
00076         EQLOG( eq::LOG_ASSEMBLY ) << "Input frame \"" << frame->getName() 
00077                                   << "\" id " << frame->getID() << endl;
00078     }
00079 
00080     compound->updateFrustum();
00081     compound->updateInheritData( 0 ); // set up initial values
00082 
00083     if( channel )
00084         channel->addTasks( compound->getInheritTasks( ));
00085 
00086     return TRAVERSE_CONTINUE;    
00087 }
00088 
00089 }
00090 }
Generated on Sat Feb 6 12:59:48 2010 for Equalizer 0.9.1 by  doxygen 1.6.1