LCOV - code coverage report
Current view: top level - seq - application.cpp (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 44 62 71.0 %
Date: 2014-06-18 Functions: 12 14 85.7 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2011, Stefan Eilemann <eile@eyescale.ch>
       3             :  *               2012, 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 "application.h"
      20             : 
      21             : #include "error.h"
      22             : #include "objectType.h"
      23             : #include "renderer.h"
      24             : #include "viewData.h"
      25             : #include "detail/application.h"
      26             : #include "detail/config.h"
      27             : 
      28             : #include <eq/client/config.h>
      29             : #include <eq/client/init.h>
      30             : #include <eq/client/server.h>
      31             : #include <eq/fabric/configParams.h>
      32             : 
      33             : namespace seq
      34             : {
      35             : 
      36           1 : Application::Application()
      37           1 :     : _impl( 0 )
      38             : {
      39           1 : }
      40             : 
      41           2 : Application::~Application()
      42             : {
      43           1 :     LBASSERT( !_impl );
      44           1 : }
      45             : 
      46           0 : co::NodePtr Application::getMasterNode()
      47             : {
      48           0 :     eq::Config* config = getConfig();
      49           0 :     LBASSERT( config );
      50           0 :     if( !config )
      51           0 :         return 0;
      52           0 :     return config->getApplicationNode();
      53             : }
      54             : 
      55           1 : eq::Config* Application::getConfig()
      56             : {
      57           1 :     LBASSERT( _impl );
      58           1 :     if( !_impl )
      59           0 :         return 0;
      60           1 :     return _impl->getConfig();
      61             : }
      62             : 
      63           2 : void Application::destroyRenderer( Renderer* renderer )
      64             : {
      65           2 :     delete renderer;
      66           2 : }
      67             : 
      68           7 : ViewData* Application::createViewData()
      69             : {
      70           7 :     return new ViewData;
      71             : }
      72             : 
      73           7 : void Application::destroyViewData( ViewData* viewData )
      74             : {
      75           7 :     delete viewData;
      76           7 : }
      77             : 
      78           1 : bool Application::init( const int argc, char** argv, co::Object* initData )
      79             : {
      80           1 :     LBASSERT( !_impl );
      81           1 :     if( _impl )
      82             :     {
      83           0 :         LBERROR << "Already initialized" << std::endl;
      84           0 :         return false;
      85             :     }
      86             : 
      87           1 :     _impl = new detail::Application( this, initData );
      88           1 :     initErrors();
      89           1 :     if( !eq::init( argc, argv, _impl ))
      90             :     {
      91           0 :         LBERROR << "Equalizer initialization failed" << std::endl;
      92           0 :         return false;
      93             :     }
      94             : 
      95           1 :     if( !initLocal( argc, argv ))
      96             :     {
      97           0 :         LBERROR << "Can't initialization client node" << std::endl;
      98           0 :         exit();
      99           0 :         return false;
     100             :     }
     101             : 
     102           1 :     if( !_impl->init( ))
     103             :     {
     104           0 :         exit();
     105           0 :         return false;
     106             :     }
     107             : 
     108           1 :     return true;
     109             : }
     110             : 
     111           1 : bool Application::run( co::Object* frameData )
     112             : {
     113           1 :     return _impl->run( frameData );
     114             : }
     115             : 
     116           1 : bool Application::exit()
     117             : {
     118           1 :     bool retVal = true;
     119           1 :     if( _impl )
     120           1 :         retVal = _impl->exit();
     121             : 
     122           1 :     if( !exitLocal( ))
     123           0 :         retVal = false;
     124             : 
     125           1 :     if( !eq::exit( ))
     126           0 :         retVal = false;
     127             : 
     128           1 :     exitErrors();
     129           1 :     delete _impl;
     130           1 :     _impl = 0;
     131             : 
     132           1 :     LBASSERTINFO( getRefCount() == 1, this->getRefCount( ));
     133           1 :     return retVal;
     134             : }
     135             : 
     136           1 : void Application::stopRunning()
     137             : {
     138           1 :     getConfig()->stopRunning();
     139           1 : }
     140             : 
     141           3 : }

Generated by: LCOV version 1.10