LCOV - code coverage report
Current view: top level - eq/server/config - server.cpp (source / functions) Hit Total Coverage
Test: Equalizer Lines: 1 34 2.9 %
Date: 2016-09-29 05:02:09 Functions: 2 4 50.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2011-2015, Stefan Eilemann <eile@eyescale.h>
       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 "server.h"
      20             : 
      21             : #include "display.h"
      22             : #include "resources.h"
      23             : 
      24             : #include "../config.h"
      25             : #include "../global.h"
      26             : #include "../loader.h"
      27             : #include "../server.h"
      28             : 
      29             : #include <eq/fabric/configParams.h>
      30             : 
      31             : #include <fstream>
      32             : 
      33             : namespace eq
      34             : {
      35             : namespace server
      36             : {
      37             : namespace config
      38             : {
      39             : 
      40           0 : Config* Server::configure( ServerPtr server, const std::string& session,
      41             :                            const fabric::ConfigParams& params )
      42             : {
      43           0 :     if( !server->getConfigs().empty( )) // don't do more than one auto config
      44           0 :         return 0;
      45             : 
      46           0 :     Global::instance()->setConfigFAttribute( Config::FATTR_VERSION, 1.2f );
      47             : 
      48           0 :     Config* config = new Config( server );
      49           0 :     config->setName( session + " autoconfig" );
      50             : 
      51           0 :     if( !Resources::discover( server, config, session, params ))
      52             :     {
      53           0 :         delete config;
      54           0 :         return 0;
      55             :     }
      56             : 
      57           0 :     Display::discoverLocal( config, params );
      58           0 :     const Compounds compounds = Loader::addOutputCompounds( server );
      59           0 :     if( compounds.empty( ))
      60             :     {
      61           0 :         delete config;
      62           0 :         return 0;
      63             :     }
      64             : 
      65           0 :     const Channels channels = Resources::configureSourceChannels( config );
      66           0 :     Resources::configure( compounds, channels, params );
      67             : 
      68           0 :     std::ofstream configFile;
      69           0 :     const std::string filename = session + ".auto.eqc";
      70           0 :     configFile.open( filename.c_str( ));
      71           0 :     if( configFile.is_open( ))
      72             :     {
      73           0 :         std::ostream& previous = lunchbox::Log::getOutput();
      74             : 
      75           0 :         lunchbox::Log::setOutput( configFile );
      76           0 :         lunchbox::Log::instance( __FILE__, __LINE__ )
      77           0 :             << lunchbox::disableHeader << Global::instance() << *server
      78           0 :             << std::endl << lunchbox::enableHeader;
      79           0 :         lunchbox::Log::setOutput( previous );
      80             : 
      81           0 :         configFile.close();
      82             :     }
      83           0 :     return config;
      84             : }
      85             : 
      86           0 : void Server::release( Config* config )
      87             : {
      88           0 :     const co::Connections& connections = config->getServerConnections();
      89           0 :     config->getServer()->removeListeners( connections );
      90           0 :     delete config;
      91           0 : }
      92             : 
      93             : }
      94             : }
      95          84 : }

Generated by: LCOV version 1.11