LCOV - code coverage report
Current view: top level - eq - init.h (source / functions) Hit Total Coverage
Test: Equalizer Lines: 3 7 42.9 %
Date: 2017-12-16 05:07:20 Functions: 1 1 100.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2005-2017, Stefan Eilemann <eile@equalizergraphics.com>
       3             :  *
       4             :  * This library is free software; you can redistribute it and/or modify it under
       5             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       6             :  * by the Free Software Foundation.
       7             :  *
       8             :  * This library is distributed in the hope that it will be useful, but WITHOUT
       9             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      10             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      11             :  * details.
      12             :  *
      13             :  * You should have received a copy of the GNU Lesser General Public License
      14             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      15             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      16             :  */
      17             : 
      18             : #ifndef EQ_INIT_H
      19             : #define EQ_INIT_H
      20             : 
      21             : #include <eq/api.h>
      22             : #include <eq/types.h>
      23             : #include <eq/version.h>   // used inline
      24             : #include <lunchbox/log.h> // used inline
      25             : 
      26             : namespace eq
      27             : {
      28             : /** @internal */
      29             : EQ_API bool _init(const int argc, char** argv, NodeFactory* nodeFactory);
      30             : 
      31             : /**
      32             :  * Initialize the Equalizer client library.
      33             :  *
      34             :  * The following command line options are recognized by this function:
      35             :  * <ul>
      36             :  *   <li>--eq-logfile &lt;filename&gt; redirect all log output to the given
      37             :  *         file.</li>
      38             :  *   <li>--eq-server &lt;hostname&gt; to specify an explicit server
      39             :  *         address (cf. Global::setServer())</li>
      40             :  *   <li>--eq-config &lt;filename&gt; to specify the configuration file or hwsd
      41             :  *         session if an application-specific server is used (cf.
      42             :  *         Global::setConfigFile())</li>
      43             :  *   <li>--eq-render-client &lt;filename&gt; to specify an alternate name
      44             :  *         for the render client executable (default is argv[0]). Also sets
      45             :  *         the working directory to the director part of the filename.</li>
      46             :  * </ul>
      47             :  *
      48             :  * Please note that further command line parameters are recognized by
      49             :  * co::LocalNode::initLocal().
      50             :  *
      51             :  * exit() should be called independent of the return value of this function.
      52             :  *
      53             :  * @param argc the command line argument count.
      54             :  * @param argv the command line argument values.
      55             :  * @param nodeFactory the factory for allocating Equalizer objects.
      56             :  * @return true if the library was successfully initialized, false otherwise.
      57             :  */
      58           3 : inline bool init(const int argc, char** argv, NodeFactory* nodeFactory)
      59             : {
      60           3 :     if (EQ_VERSION_ABI == Version::getABI())
      61           3 :         return eq::_init(argc, argv, nodeFactory);
      62           0 :     LBWARN << "Equalizer shared library v" << Version::getABI()
      63           0 :            << " not binary compatible with application v" << EQ_VERSION_ABI
      64           0 :            << std::endl;
      65           0 :     return false;
      66             : }
      67             : 
      68             : /**
      69             :  * De-initialize the Equalizer client library.
      70             :  *
      71             :  * @return true if the library was successfully de-initialized, false otherwise.
      72             :  */
      73             : EQ_API bool exit();
      74             : 
      75             : /**
      76             :  * Convenience function to retrieve a configuration.
      77             :  *
      78             :  * This function initializes a local client node, connects it to the server,
      79             :  * and retrieves a configuration. On any failure everything is correctly
      80             :  * deinitialized and 0 is returned.
      81             :  *
      82             :  * @return the pointer to a configuration, or 0 upon error.
      83             :  */
      84             : EQ_API Config* getConfig(const int argc, char** argv);
      85             : 
      86             : /**
      87             :  * Convenience function to release a configuration.
      88             :  *
      89             :  * This function releases the configuration, disconnects the server,
      90             :  * and stops the local client node.
      91             :  */
      92             : EQ_API void releaseConfig(Config* config);
      93             : 
      94             : /** @return a help string for all parsed command line arguments. @version 2.1 */
      95             : EQ_API std::string getHelp();
      96             : }
      97             : 
      98             : #endif // EQ_INIT_H

Generated by: LCOV version 1.11