![]() |
VisionWorks Toolkit ReferenceDecember 18, 2015 | 1.2 Release |
Application
interface.
This class is intended to simplify the creation of your own application. It performs initialization of global resources, the environment, and parses command line arguments.
Application
is a singleton. You must call the Application::get static method to get the reference to the object.
Definition at line 62 of file Application.hpp.
Public Types | |
enum | ApplicationExitCode { APP_EXIT_CODE_SUCCESS = 0, APP_EXIT_CODE_ERROR = 1, APP_EXIT_CODE_NO_MEMORY = 2, APP_EXIT_CODE_NO_RESOURCE = 3, APP_EXIT_CODE_NO_FRAMESOURCE = 4, APP_EXIT_CODE_NO_RENDER = 5, APP_EXIT_CODE_INVALID_GRAPH = 6, APP_EXIT_CODE_INVALID_VALUE = 7, APP_EXIT_CODE_INVALID_DIMENSIONS = 8, APP_EXIT_CODE_INVALID_FORMAT = 9, APP_EXIT_CODE_CAN_NOT_CREATE = 10 } |
Defines status codes that your application can return. More... | |
Public Member Functions | |
virtual void | addBooleanOption (char shortName, const std::string &longName, const std::string &description, bool *result)=0 |
Adds Boolean command line option to the application. More... | |
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. More... | |
virtual void | allowPositionalParameters (const std::string &placeholder, std::vector< std::string > *result)=0 |
Enables support of positional parameters to be used with the application. More... | |
virtual std::string | findLibraryFilePath (const std::string &filename) const =0 |
Finds the file in the VisionWorks data directory. More... | |
virtual std::string | findSampleFilePath (const std::string &filename) const =0 |
Finds the file in the sample data directory. More... | |
virtual bool | getEventLogDumpFramesFlag () const =0 |
virtual std::string | getEventLogName () const =0 |
virtual double | getFPSLimit () const =0 |
Gets a limit for frame rate in frames per second. More... | |
virtual std::string | getPreferredRenderName () const =0 |
virtual int | getScenarioLoopCount () const =0 |
virtual std::string | getScenarioName () const =0 |
virtual int | getSourceDefaultTimeout () const =0 |
virtual bool | getVerboseFlag () const =0 |
virtual void | init (int &argc, char **argv)=0 |
Initializes the application. More... | |
virtual bool | initGui ()=0 |
virtual void | setDescription (const std::string &description)=0 |
Sets a description of the application for the console Help message. More... | |
virtual void | setSourceDefaultTimeout (int timeout)=0 |
virtual bool | sleepToLimitFPS (double totalProcessTimeMs, double fpsLimit=0)=0 |
Suspends execution of the calling thread to limit frame rate. More... | |
virtual | ~Application () |
Destructor. More... | |
Static Public Member Functions | |
static Application & | get () |
Returns the reference to the object. More... | |
Defines status codes that your application can return.
Definition at line 68 of file Application.hpp.
|
virtual |
Destructor.
|
static |
Returns the reference to the object.
Application is a singleton. You must call the Application::get static method to get the reference to the object.
|
pure virtual |
Adds Boolean command line option to the application.
[in] | shortName | Specifies the single-letter name of the option. '\0' means "no short name". |
[in] | longName | A reference to the full name of the option. nullptr means "no long name". |
[in] | description | A reference to the description of the option for the console Help message. |
[out] | result | A pointer to the variable to set. result is true if the option is present in the argument list; otherwise, it is false . |
|
pure virtual |
Adds arbitrary command line option to the application.
[in] | shortName | Specifies the single-letter name of the option. '\0' means "no short name". |
[in] | longName | A reference to the full name of the option. nullptr means "no long name". |
[in] | description | A reference to the description of the option for the console Help message. |
[in] | handler | OptionHandler used to process the option. |
|
pure virtual |
Enables support of positional parameters to be used with the application.
[in] | placeholder | A reference to a short hint that describes the expected values of the parameter. |
[out] | result | A pointer to a vector of strings to be filled with the provided parameters. |
|
pure virtual |
Sets a description of the application for the console Help message.
[in] | description | A refernce to the description of the application for the console Help message. |
|
pure virtual |
Initializes the application.
[in] | argc | A reference to the number of arguments passed into your program from the command line. |
[in] | argv | A pointer to a pointer to the array of the command line arguments. |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
Finds the file in the sample data directory.
This method finds the file in the following directories:
path_to_your_exe/sources/data/
path_to_your_exe/../data/
std::runtime_error
exception if the file is not found.[in] | filename | A reference to the name of the required file. |
|
pure virtual |
Finds the file in the VisionWorks data directory.
This method finds the file in the following directories:
path_to_your_exe/data/
VISIONWORKS_DIR/share/visionworks/data/
Only if VISIONWORKS_DIR
is defined; VISIONWORKS_DIR
is a full path to the installation directory of VisionWorks.
/usr/share/visionworks/data/
On Linux and when VISIONWORKS_DIR
is not defined.
std::runtime_error
exception if the file is not found.[in] | filename | A reference to the name of the required file. |
|
pure virtual |
|
pure virtual |
|
pure virtual |
Gets a limit for frame rate in frames per second.
|
pure virtual |
Suspends execution of the calling thread to limit frame rate.
[in] | totalProcessTimeMs | The total time of processing in miliseconds (ms). If this time is less than 1000/fpsLimit ms, then the calling thread suspends on about (1000/fpsLimit - totalProcessTimeMs) ms. |
[in] | fpsLimit | The desired frame rate in frames per second. Call the Application::getFPSLimit method to get the default limit for frame rate. |