LCOV - code coverage report
Current view: top level - eq/server - changeLatencyVisitor.h (source / functions) Hit Total Coverage
Test: Equalizer Lines: 0 35 0.0 %
Date: 2017-12-16 05:07:20 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 :     explicit ChangeLatencyVisitor(const uint32_t latency)
      44           0 :         : _latency(latency)
      45             :     {
      46           0 :     }
      47             : 
      48           0 :     virtual VisitorResult visit(Compound* compound)
      49             :     {
      50           0 :         const Frames& outputFrames = compound->getOutputFrames();
      51           0 :         for (FramesCIter i = outputFrames.begin(); i != outputFrames.end(); ++i)
      52             :         {
      53           0 :             Frame* frame = *i;
      54           0 :             frame->setAutoObsolete(_latency);
      55             :         }
      56             : 
      57           0 :         const Frames& inputFrames = compound->getInputFrames();
      58           0 :         for (FramesCIter i = inputFrames.begin(); i != inputFrames.end(); ++i)
      59             :         {
      60           0 :             Frame* frame = *i;
      61           0 :             frame->setAutoObsolete(_latency);
      62             :         }
      63             : 
      64           0 :         const TileQueues& outputTileQueues = compound->getOutputTileQueues();
      65           0 :         for (TileQueuesCIter i = outputTileQueues.begin();
      66           0 :              i != outputTileQueues.end(); ++i)
      67             :         {
      68           0 :             TileQueue* queue = *i;
      69           0 :             queue->setAutoObsolete(_latency);
      70             :         }
      71             : 
      72           0 :         const TileQueues& inputTileQueues = compound->getInputTileQueues();
      73           0 :         for (TileQueuesCIter i = inputTileQueues.begin();
      74           0 :              i != inputTileQueues.end(); ++i)
      75             :         {
      76           0 :             TileQueue* queue = *i;
      77           0 :             queue->setAutoObsolete(_latency);
      78             :         }
      79           0 :         return TRAVERSE_CONTINUE;
      80             :     }
      81             : 
      82           0 :     virtual VisitorResult visitPre(Node* node)
      83             :     {
      84           0 :         node->changeLatency(_latency);
      85           0 :         return TRAVERSE_CONTINUE;
      86             :     }
      87             : 
      88           0 :     virtual VisitorResult visit(Observer* observer) { return _visit(observer); }
      89           0 :     virtual VisitorResult visitPre(Layout* layout) { return _visit(layout); }
      90           0 :     virtual VisitorResult visit(View* view) { return _visit(view); }
      91           0 :     virtual VisitorResult visitPre(Segment* segment) { return _visit(segment); }
      92           0 :     virtual VisitorResult visit(Segment* segment) { return _visit(segment); }
      93             : private:
      94             :     const uint32_t _latency;
      95             : 
      96           0 :     VisitorResult _visit(co::Object* object)
      97             :     {
      98             :         // double commit on update/delete
      99           0 :         object->setAutoObsolete(_latency + 1);
     100           0 :         return TRAVERSE_CONTINUE;
     101             :     }
     102             : };
     103             : }
     104             : }
     105             : #endif // EQSERVER_CHANGELATENCYVISITOR

Generated by: LCOV version 1.11