LCOV - code coverage report
Current view: top level - eq/server - changeLatencyVisitor.h (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 0 40 0.0 %
Date: 2014-06-18 Functions: 0 11 0.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2010, Cedric Stalder <cedric.stalder@gmail.com>
       3             :  *               2010-2013, Stefan Eilemann <eile@eyescale.ch>
       4             :  *               2011, Daniel Nachbaur <danielnachbaur@gmail.com>
       5             :  *
       6             :  * This library is free software; you can redistribute it and/or modify it under
       7             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       8             :  * by the Free Software Foundation.
       9             :  *
      10             :  * This library is distributed in the hope that it will be useful, but WITHOUT
      11             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      12             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      13             :  * details.
      14             :  *
      15             :  * You should have received a copy of the GNU Lesser General Public License
      16             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      17             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      18             :  */
      19             : 
      20             : #ifndef EQSERVER_CHANGELATENCYVISITOR_H
      21             : #define EQSERVER_CHANGELATENCYVISITOR_H
      22             : 
      23             : #include "compound.h"
      24             : #include "configVisitor.h"
      25             : #include "frame.h"
      26             : #include "layout.h"
      27             : #include "node.h"
      28             : #include "observer.h"
      29             : #include "segment.h"
      30             : #include "tileQueue.h"
      31             : #include "view.h"
      32             : 
      33             : namespace eq
      34             : {
      35             : namespace server
      36             : {
      37             : /**
      38             :  * The Change Latency visitor modifies the latency on all relevant objects.
      39             :  */
      40           0 : class ChangeLatencyVisitor : public ConfigVisitor
      41             : {
      42             : public:
      43           0 :     ChangeLatencyVisitor( const uint32_t latency ) : _latency( latency ) {}
      44             : 
      45           0 :     virtual VisitorResult visit( Compound* compound )
      46             :     {
      47           0 :         const Frames& outputFrames = compound->getOutputFrames();
      48           0 :         for( FramesCIter i = outputFrames.begin();
      49           0 :              i != outputFrames.end(); ++i )
      50             :         {
      51           0 :             Frame* frame = *i;
      52           0 :             frame->setAutoObsolete( _latency );
      53             :         }
      54             : 
      55           0 :         const Frames& inputFrames = compound->getInputFrames();
      56           0 :         for( FramesCIter i = inputFrames.begin();
      57           0 :              i != inputFrames.end(); ++i )
      58             :         {
      59           0 :             Frame* frame = *i;
      60           0 :             frame->setAutoObsolete( _latency );
      61             :         }
      62             : 
      63           0 :         const TileQueues& outputTileQueues = compound->getOutputTileQueues();
      64           0 :         for( TileQueuesCIter i = outputTileQueues.begin();
      65           0 :              i != outputTileQueues.end(); ++i )
      66             :         {
      67           0 :             TileQueue* queue = *i;
      68           0 :             queue->setAutoObsolete( _latency );
      69             :         }
      70             : 
      71           0 :         const TileQueues& inputTileQueues = compound->getInputTileQueues();
      72           0 :         for( TileQueuesCIter i = inputTileQueues.begin();
      73           0 :              i != inputTileQueues.end(); ++i )
      74             :         {
      75           0 :             TileQueue* queue = *i;
      76           0 :             queue->setAutoObsolete( _latency );
      77             :         }
      78           0 :         return TRAVERSE_CONTINUE;
      79             :     }
      80             : 
      81           0 :     virtual VisitorResult visitPre( Node* node )
      82             :     {
      83           0 :         node->changeLatency( _latency );
      84           0 :         return TRAVERSE_CONTINUE;
      85             :     }
      86             : 
      87           0 :     virtual VisitorResult visit( Observer* observer )
      88           0 :         { return _visit( observer ); }
      89             : 
      90           0 :     virtual VisitorResult visitPre( Layout* layout )
      91           0 :         { return _visit( layout ); }
      92           0 :     virtual VisitorResult visit( View* view )
      93           0 :         { return _visit( view ); }
      94             : 
      95           0 :     virtual VisitorResult visitPre( Segment* segment )
      96           0 :         { return _visit( segment ); }
      97           0 :     virtual VisitorResult visit( Segment* segment )
      98           0 :         { return _visit( segment ); }
      99             : 
     100             : private:
     101             :     const uint32_t _latency;
     102             : 
     103           0 :     VisitorResult _visit( co::Object* object )
     104             :         {
     105             :             // double commit on update/delete
     106           0 :             object->setAutoObsolete( _latency + 1 );
     107           0 :             return TRAVERSE_CONTINUE;
     108             :         }
     109             : };
     110             : 
     111             : }
     112             : }
     113             : #endif // EQSERVER_CHANGELATENCYVISITOR

Generated by: LCOV version 1.10