LCOV - code coverage report
Current view: top level - seq/detail - view.cpp (source / functions) Hit Total Coverage
Test: Equalizer Lines: 1 67 1.5 %
Date: 2016-07-30 05:04:55 Functions: 2 16 12.5 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2011-2016, Stefan Eilemann <eile@eyescale.ch>
       3             :  *                          Daniel Nachbaur <danielnachbaur@gmail.com>
       4             :  *
       5             :  * This library is free software; you can redistribute it and/or modify it under
       6             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       7             :  * by the Free Software Foundation.
       8             :  *
       9             :  * This library is distributed in the hope that it will be useful, but WITHOUT
      10             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      11             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      12             :  * details.
      13             :  *
      14             :  * You should have received a copy of the GNU Lesser General Public License
      15             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      16             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      17             :  */
      18             : 
      19             : #include "view.h"
      20             : 
      21             : #include "config.h"
      22             : #include "pipe.h"
      23             : 
      24             : #include <seq/application.h>
      25             : #include <seq/renderer.h>
      26             : #include <seq/viewData.h>
      27             : #include <eq/config.h>
      28             : #ifndef EQ_2_0_API
      29             : #  include <eq/configEvent.h>
      30             : #endif
      31             : #include <eq/eventICommand.h>
      32             : 
      33             : namespace seq
      34             : {
      35             : namespace detail
      36             : {
      37             : 
      38           0 : View::View( eq::Layout* parent )
      39           0 :         : eq::View( parent )
      40           0 : {}
      41             : 
      42           0 : View::~View()
      43             : {
      44           0 : }
      45             : 
      46           0 : Config* View::getConfig()
      47             : {
      48           0 :     return static_cast< Config* >( eq::View::getConfig( ));
      49             : }
      50             : 
      51           0 : Pipe* View::getPipe()
      52             : {
      53           0 :     return static_cast< Pipe* >( eq::View::getPipe( ));
      54             : }
      55             : 
      56           0 : ViewData* View::getViewData()
      57             : {
      58           0 :     return static_cast< ViewData* >( eq::View::getUserData( ));
      59             : }
      60             : 
      61           0 : const ViewData* View::getViewData() const
      62             : {
      63           0 :     return static_cast< const ViewData* >( eq::View::getUserData( ));
      64             : }
      65             : 
      66           0 : bool View::configInit()
      67             : {
      68           0 :     if( !eq::View::configInit( ))
      69           0 :         return false;
      70             : 
      71           0 :     if( !getPipe() ) // application view
      72           0 :         setUserData( getConfig()->getApplication()->createViewData( *this ));
      73           0 :     return true;
      74             : }
      75             : 
      76           0 : bool View::configExit()
      77             : {
      78           0 :     ViewData* viewData = getViewData();
      79           0 :     if( !getPipe() && viewData ) // application view
      80             :     {
      81           0 :         setUserData( 0 );
      82           0 :         getConfig()->getApplication()->destroyViewData( viewData );
      83             :     }
      84           0 :     return eq::View::configExit();
      85             : }
      86             : 
      87           0 : void View::notifyAttach()
      88             : {
      89           0 :     eq::View::notifyAttach();
      90           0 :     Pipe* pipe = getPipe();
      91             : 
      92           0 :     if( pipe ) // render client view
      93           0 :         setUserData( pipe->getRenderer()->createViewData( *this ));
      94           0 : }
      95             : 
      96           0 : void View::notifyDetached()
      97             : {
      98           0 :     ViewData* data = getViewData();
      99           0 :     setUserData( 0 );
     100             : 
     101           0 :     if( data )
     102             :     {
     103           0 :         Pipe* pipe = getPipe();
     104             : 
     105           0 :         if( pipe ) // render client view
     106           0 :             pipe->getRenderer()->destroyViewData( data );
     107             :     }
     108             : 
     109           0 :     eq::View::notifyDetached();
     110           0 : }
     111             : 
     112           0 : bool View::updateData()
     113             : {
     114           0 :     if( !isActive( ))
     115           0 :         return false;
     116             : 
     117           0 :     ViewData* data = getViewData();
     118           0 :     LBASSERT( data );
     119           0 :     if( data )
     120           0 :         return data->update();
     121           0 :     return false;
     122             : }
     123             : 
     124             : #ifndef EQ_2_0_API
     125           0 : bool View::handleEvent( const eq::ConfigEvent* event )
     126             : {
     127           0 :     ViewData* data = getViewData();
     128           0 :     LBASSERT( data );
     129           0 :     if( !data )
     130           0 :         return false;
     131           0 :     if( isActive( ))
     132           0 :         return data->handleEvent( event );
     133           0 :     data->handleEvent( event );
     134           0 :     return false;
     135             : }
     136             : #endif
     137             : 
     138           0 : bool View::handleEvent( const eq::EventICommand& command )
     139             : {
     140           0 :     ViewData* data = getViewData();
     141           0 :     LBASSERT( data );
     142           0 :     if( !data )
     143           0 :         return false;
     144           0 :     if( isActive( ))
     145           0 :         return data->handleEvent( command );
     146           0 :     data->handleEvent( command );
     147           0 :     return false;
     148             : }
     149             : }
     150          42 : }

Generated by: LCOV version 1.11