VisionWorks Toolkit Reference

December 18, 2015 | 1.2 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-2015, 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 {
63 {
64 public:
69  {
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 std::string getPreferredRenderName() const = 0;
192 
207  virtual std::string findSampleFilePath(const std::string& filename) const = 0;
208 
229  virtual std::string findLibraryFilePath(const std::string& filename) const = 0;
230 
231  virtual int getSourceDefaultTimeout() const = 0;
232  virtual void setSourceDefaultTimeout(int timeout) = 0;
233 
238  virtual double getFPSLimit() const = 0;
249  virtual bool sleepToLimitFPS(double totalProcessTimeMs, double fpsLimit = 0) = 0;
250 };
251 
252 }
253 
254 #endif // NVXIO_APPLICATION_HPP
virtual void addBooleanOption(char shortName, const std::string &longName, const std::string &description, bool *result)=0
Adds Boolean command line option to the application.
virtual void setDescription(const std::string &description)=0
Sets a description of the application for the console Help message.
virtual bool getEventLogDumpFramesFlag() const =0
virtual int getScenarioLoopCount() const =0
Indicates the object cannot be created.
Definition: Application.hpp:93
ApplicationExitCode
Defines status codes that your application can return.
Definition: Application.hpp:68
std::unique_ptr< OptionHandler > ptr
Indicates the supplied graph failed verification.
Definition: Application.hpp:83
virtual std::string findSampleFilePath(const std::string &filename) const =0
Finds the file in the sample data directory.
Indicates the parameter provided is too big or too small in dimension, or is not of even size...
Definition: Application.hpp:89
Indicates the parameter provided does not match the algorithm's possible values or a validation proce...
Definition: Application.hpp:86
Indicates a generic error code; this code is used when no other code describes the error...
Definition: Application.hpp:73
Indicates the operation succeeded.
Definition: Application.hpp:71
virtual std::string getScenarioName() const =0
Indicates the framesource exists but cannot be read.
Definition: Application.hpp:79
The OptionHandler interface.
virtual void init(int &argc, char **argv)=0
Initializes the application.
Indicates the resource (file, etc.) cannot be acquired.
Definition: Application.hpp:77
virtual ~Application()
Destructor.
Indicates the parameter provided is in an invalid format.
Definition: Application.hpp:91
virtual std::string getPreferredRenderName() const =0
virtual bool sleepToLimitFPS(double totalProcessTimeMs, double fpsLimit=0)=0
Suspends execution of the calling thread to limit frame rate.
virtual bool initGui()=0
Indicates an internal or implicit allocation failure.
Definition: Application.hpp:75
virtual bool getVerboseFlag() const =0
Indicates the render cannot be created.
Definition: Application.hpp:81
Application interface.
Definition: Application.hpp:62
virtual void addOption(char shortName, const std::string &longName, const std::string &description, OptionHandler::ptr handler)=0
Adds arbitrary command line option to the application.
virtual std::string findLibraryFilePath(const std::string &filename) const =0
Finds the file in the VisionWorks data directory.
virtual double getFPSLimit() const =0
Gets a limit for frame rate in frames per second.
virtual void allowPositionalParameters(const std::string &placeholder, std::vector< std::string > *result)=0
Enables support of positional parameters to be used with the application.
virtual std::string getEventLogName() const =0
virtual int getSourceDefaultTimeout() const =0
virtual void setSourceDefaultTimeout(int timeout)=0