LCOV - code coverage report
Current view: top level - seq - application.cpp (source / functions) Hit Total Coverage
Test: Equalizer Lines: 1 72 1.4 %
Date: 2016-09-29 05:02:09 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             :  *                          Petros Kataras <petroskataras@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             : #include "application.h"
      21             : 
      22             : #include "error.h"
      23             : #include "objectType.h"
      24             : #include "renderer.h"
      25             : #include "viewData.h"
      26             : #include "detail/application.h"
      27             : #include "detail/objectMap.h"
      28             : #include "detail/config.h"
      29             : 
      30             : #include <eq/config.h>
      31             : #include <eq/init.h>
      32             : #include <eq/server.h>
      33             : #include <eq/fabric/configParams.h>
      34             : 
      35             : namespace seq
      36             : {
      37             : 
      38           0 : Application::Application()
      39           0 :     : _impl( 0 )
      40             : {
      41           0 : }
      42             : 
      43           0 : Application::~Application()
      44             : {
      45           0 :     LBASSERT( !_impl );
      46           0 : }
      47             : 
      48           0 : co::NodePtr Application::getMasterNode()
      49             : {
      50           0 :     eq::Config* config = getConfig();
      51           0 :     LBASSERT( config );
      52           0 :     if( !config )
      53           0 :         return 0;
      54           0 :     return config->getApplicationNode();
      55             : }
      56             : 
      57           0 : eq::Config* Application::getConfig()
      58             : {
      59           0 :     LBASSERT( _impl );
      60           0 :     if( !_impl )
      61           0 :         return 0;
      62           0 :     return _impl->getConfig();
      63             : }
      64             : 
      65           0 : bool Application::registerObject( co::Object* object, const uint32_t type )
      66             : {
      67           0 :     if( !_impl || !_impl->getConfig( ))
      68           0 :        return false;
      69             : 
      70           0 :     seq::detail::ObjectMap* objectMap = _impl->getConfig()->getObjectMap();
      71           0 :     return objectMap ? objectMap->register_( object, type ) : false;
      72             : }
      73             : 
      74           0 : bool Application::deregister( co::Object* object )
      75             : {
      76           0 :     if( !_impl || !_impl->getConfig( ))
      77           0 :        return false;
      78             : 
      79           0 :     seq::detail::ObjectMap* objectMap = _impl->getConfig()->getObjectMap();
      80           0 :     return  objectMap ? objectMap->deregister( object ) : false;
      81             : }
      82             : 
      83           0 : void Application::destroyRenderer( Renderer* renderer )
      84             : {
      85           0 :     delete renderer;
      86           0 : }
      87             : 
      88           0 : ViewData* Application::createViewData( View& view )
      89             : {
      90           0 :     return new ViewData( view );
      91             : }
      92             : 
      93           0 : void Application::destroyViewData( ViewData* viewData )
      94             : {
      95           0 :     delete viewData;
      96           0 : }
      97             : 
      98           0 : bool Application::init( const int argc, char** argv, co::Object* initData )
      99             : {
     100           0 :     LBASSERT( !_impl );
     101           0 :     if( _impl )
     102             :     {
     103           0 :         LBERROR << "Already initialized" << std::endl;
     104           0 :         return false;
     105             :     }
     106             : 
     107           0 :     _impl = new detail::Application( this, initData );
     108           0 :     initErrors();
     109           0 :     if( !eq::init( argc, argv, _impl ))
     110             :     {
     111           0 :         LBERROR << "Equalizer initialization failed" << std::endl;
     112           0 :         return false;
     113             :     }
     114             : 
     115           0 :     if( !initLocal( argc, argv ))
     116             :     {
     117           0 :         LBERROR << "Can't initialization client node" << std::endl;
     118           0 :         exit();
     119           0 :         return false;
     120             :     }
     121             : 
     122           0 :     if( !_impl->init( ))
     123             :     {
     124           0 :         exit();
     125           0 :         return false;
     126             :     }
     127             : 
     128           0 :     return true;
     129             : }
     130             : 
     131           0 : bool Application::run( co::Object* frameData )
     132             : {
     133           0 :     return _impl->run( frameData );
     134             : }
     135             : 
     136           0 : bool Application::exit()
     137             : {
     138           0 :     bool retVal = true;
     139           0 :     if( _impl )
     140           0 :         retVal = _impl->exit();
     141             : 
     142           0 :     if( !exitLocal( ))
     143           0 :         retVal = false;
     144             : 
     145           0 :     if( !eq::exit( ))
     146           0 :         retVal = false;
     147             : 
     148           0 :     exitErrors();
     149           0 :     delete _impl;
     150           0 :     _impl = 0;
     151             : 
     152           0 :     LBASSERTINFO( getRefCount() == 1, this->getRefCount( ));
     153           0 :     return retVal;
     154             : }
     155             : 
     156           0 : void Application::stopRunning()
     157             : {
     158           0 :     getConfig()->stopRunning();
     159           0 : }
     160             : 
     161          42 : }

Generated by: LCOV version 1.11