Fawkes API
Fawkes Development Version
|
Camera argument parser. More...
#include <>>
Public Member Functions | |
CameraArgumentParser (const char *as) | |
Constructor. More... | |
~CameraArgumentParser () | |
Destructor. More... | |
bool | has (std::string s) const |
Check if an parameter was given. More... | |
std::string | get (std::string s) const |
Get the value of the given parameter. More... | |
long int | get_int (std::string s) const |
Get the value of the given parameter as integer. More... | |
double | get_float (std::string s) const |
Get the value of the given parameter as integer. More... | |
std::map< std::string, std::string > | parameters () const |
Get a map of parameters. More... | |
std::vector< std::string > | arguments () const |
Get the arguments. More... | |
std::string | cam_id () const |
Get camera ID. More... | |
std::string | cam_type () const |
Get camera type. More... | |
Camera argument parser.
Simple parser that will parse a camera parameter string that defines the camera type and options specific to this camera.
In general a string is of the form
The string is a colon-separated (:) list of elements.
The first element (camera in the example) denotes the camera type. See the CameraFactory documentation for allowed values. It can be queried with the cam_type() method.
There is one special parameter that is used for all kinds of cameras, the identifier string (second element). This special value is meant to be used to recognize the very same camera even if it has different parameters and to distinguish multiple cameras of the same type (for instance to distinguish two different firewire cameras). The ID can be queried with cam_id().
The rest is a list of parameters and arguments. Parameters are key/value pairs separated by an equals sign. The are then queried with the has(), get() and parameters() methods. Arguments are simple strings that do not contain an equals sign and are given as-is via the arguments() method. These could for example be a list of files etc..
firevision::CameraArgumentParser::CameraArgumentParser | ( | const char * | as | ) |
firevision::CameraArgumentParser::~CameraArgumentParser | ( | ) |
Destructor.
Definition at line 114 of file camargp.cpp.
std::vector< std::string > firevision::CameraArgumentParser::arguments | ( | ) | const |
Get the arguments.
Returns a vector of arguments supplied in the argument string.
Definition at line 228 of file camargp.cpp.
std::string firevision::CameraArgumentParser::cam_id | ( | ) | const |
Get camera ID.
Get the camera ID. This is the very first element before the first colon.
Definition at line 139 of file camargp.cpp.
Referenced by FvBaseThread::acquire_camctrl(), firevision::Bumblebee2Camera::Bumblebee2Camera(), firevision::FirewireCamera::FirewireCamera(), FvBaseThread::register_for_camera(), FvBaseThread::register_for_raw_camera(), and firevision::SonyEviD100PControl::SonyEviD100PControl().
std::string firevision::CameraArgumentParser::cam_type | ( | ) | const |
Get camera type.
Get the camera type. This is the very first element before the first colon.
Definition at line 127 of file camargp.cpp.
Referenced by FvBaseThread::acquire_camctrl(), firevision::CameraFactory::instance(), firevision::CameraControlFactory::instance(), FvBaseThread::register_for_camera(), and FvBaseThread::register_for_raw_camera().
std::string firevision::CameraArgumentParser::get | ( | std::string | s | ) | const |
Get the value of the given parameter.
s | key of the parameter to retrieve |
Definition at line 164 of file camargp.cpp.
Referenced by firevision::Bumblebee2Camera::Bumblebee2Camera(), firevision::FileLoader::FileLoader(), firevision::FirewireCamera::FirewireCamera(), firevision::NaoCamera::NaoCamera(), firevision::NetworkCamera::NetworkCamera(), firevision::PikeCamera::PikeCamera(), firevision::SharedMemoryCamera::SharedMemoryCamera(), firevision::SwissRangerCamera::SwissRangerCamera(), firevision::V4L1Camera::V4L1Camera(), firevision::V4L2Camera::V4L2Camera(), and firevision::V4LCamera::V4LCamera().
double firevision::CameraArgumentParser::get_float | ( | std::string | s | ) | const |
Get the value of the given parameter as integer.
This method assumes that the value is an integer and converts it.
s | key of the parameter to retrieve |
IllegalArgumentException | thrown if the value cannot be properly converted to an integer |
Exception | thrown if the argument has not been supplied |
Definition at line 208 of file camargp.cpp.
long int firevision::CameraArgumentParser::get_int | ( | std::string | s | ) | const |
Get the value of the given parameter as integer.
This method assumes that the value is an integer and converts it.
s | key of the parameter to retrieve |
IllegalArgumentException | thrown if the value cannot be properly converted to an integer |
Exception | thrown if the argument has not been supplied |
Definition at line 184 of file camargp.cpp.
Referenced by firevision::FileLoader::FileLoader(), and firevision::SwissRangerCamera::SwissRangerCamera().
bool firevision::CameraArgumentParser::has | ( | std::string | s | ) | const |
Check if an parameter was given.
Checks if the given parameter s was given in the argument string.
s | parameter key to check for |
Definition at line 152 of file camargp.cpp.
Referenced by firevision::Bumblebee2Camera::Bumblebee2Camera(), firevision::FileLoader::FileLoader(), firevision::FirewireCamera::FirewireCamera(), firevision::NaoCamera::NaoCamera(), firevision::NetworkCamera::NetworkCamera(), firevision::PikeCamera::PikeCamera(), firevision::SharedMemoryCamera::SharedMemoryCamera(), firevision::SwissRangerCamera::SwissRangerCamera(), firevision::V4L1Camera::V4L1Camera(), firevision::V4L2Camera::V4L2Camera(), and firevision::V4LCamera::V4LCamera().
std::map< std::string, std::string > firevision::CameraArgumentParser::parameters | ( | ) | const |
Get a map of parameters.
Definition at line 238 of file camargp.cpp.