VisionWorks Toolkit Reference

April 8, 2016 | 1.4 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Application.hpp
Go to the documentation of this file.
1 /*
2 # Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions
6 # are met:
7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above copyright
10 # notice, this list of conditions and the following disclaimer in the
11 # documentation and/or other materials provided with the distribution.
12 # * Neither the name of NVIDIA CORPORATION nor the names of its
13 # contributors may be used to endorse or promote products derived
14 # from this software without specific prior written permission.
15 #
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
17 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24 # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 
29 #ifndef NVXIO_APPLICATION_HPP
30 #define NVXIO_APPLICATION_HPP
31 
32 #include <initializer_list>
33 #include <limits>
34 #include <memory>
35 #include <string>
36 #include <vector>
37 
38 #include "OptionHandler.hpp"
39 
49 namespace nvxio
50 {
62 class NVXIO_EXPORT Application
63 {
64 public:
69  {
71  APP_EXIT_CODE_SUCCESS = 0,
73  APP_EXIT_CODE_ERROR = 1,
75  APP_EXIT_CODE_NO_MEMORY = 2,
77  APP_EXIT_CODE_NO_RESOURCE = 3,
79  APP_EXIT_CODE_NO_FRAMESOURCE = 4,
81  APP_EXIT_CODE_NO_RENDER = 5,
83  APP_EXIT_CODE_INVALID_GRAPH = 6,
86  APP_EXIT_CODE_INVALID_VALUE = 7,
89  APP_EXIT_CODE_INVALID_DIMENSIONS = 8,
91  APP_EXIT_CODE_INVALID_FORMAT = 9,
93  APP_EXIT_CODE_CAN_NOT_CREATE = 10,
94  // add new codes here
95  };
96 
106  static Application &get();
107 
111  virtual ~Application();
112 
125  virtual void addBooleanOption(char shortName, const std::string &longName,
126  const std::string &description,
127  bool *result) = 0;
128 
143  virtual void addOption(char shortName, const std::string &longName,
144  const std::string &description,
145  OptionHandler::ptr handler) = 0;
146 
158  virtual void allowPositionalParameters(const std::string &placeholder,
159  std::vector<std::string> *result) = 0;
160 
169  virtual void setDescription(const std::string &description) = 0;
170 
183  virtual void init(int &argc, char **argv) = 0;
184  virtual bool initGui() = 0;
185 
186  virtual std::string getScenarioName() const = 0;
187  virtual int getScenarioLoopCount() const = 0;
188  virtual std::string getEventLogName() const = 0;
189  virtual bool getEventLogDumpFramesFlag() const = 0;
190  virtual bool getVerboseFlag() const = 0;
191  virtual bool getFullScreenFlag() const = 0;
192  virtual std::string getPreferredRenderName() const = 0;
193 
208  virtual std::string findSampleFilePath(const std::string& filename) const = 0;
209 
230  virtual std::string findLibraryFilePath(const std::string& filename) const = 0;
231 
232  virtual int getSourceDefaultTimeout() const = 0;
233  virtual void setSourceDefaultTimeout(int timeout) = 0;
234 
239  virtual double getFPSLimit() const = 0;
240 
253 #ifdef __GNUC__
254  __attribute__((deprecated("use SyncTimer instead")))
255 #endif
256  virtual bool sleepToLimitFPS(double totalProcessTimeMs, double fpsLimit = 0) = 0;
257 };
258 
259 }
260 
261 #endif // NVXIO_APPLICATION_HPP
ApplicationExitCode
Defines status codes that your application can return.
Definition: Application.hpp:68
std::unique_ptr< OptionHandler > ptr
The OptionHandler interface.
Application interface.
Definition: Application.hpp:62