Fawkes API  Fawkes Development Version
firevision::CameraArgumentParser Class Reference

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...
 

Detailed Description

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

camera-type:id-substring:param1=value1:param2=value2:arg1:arg2

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..

See also
CameraFactory
Author
Tim Niemueller

Definition at line 38 of file camargp.h.

Constructor & Destructor Documentation

◆ CameraArgumentParser()

firevision::CameraArgumentParser::CameraArgumentParser ( const char *  as)

Constructor.

Parameters
ascamera argument string

Definition at line 71 of file camargp.cpp.

◆ ~CameraArgumentParser()

firevision::CameraArgumentParser::~CameraArgumentParser ( )

Destructor.

Definition at line 114 of file camargp.cpp.

Member Function Documentation

◆ arguments()

std::vector< std::string > firevision::CameraArgumentParser::arguments ( ) const

Get the arguments.

Returns a vector of arguments supplied in the argument string.

Returns
vector of arguments

Definition at line 228 of file camargp.cpp.

◆ cam_id()

std::string firevision::CameraArgumentParser::cam_id ( ) const

◆ cam_type()

std::string firevision::CameraArgumentParser::cam_type ( ) const

Get camera type.

Get the camera type. This is the very first element before the first colon.

Returns
camera type

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().

◆ get()

std::string firevision::CameraArgumentParser::get ( std::string  s) const

◆ get_float()

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.

Parameters
skey of the parameter to retrieve
Returns
the value of the given parameter as integer
Exceptions
IllegalArgumentExceptionthrown if the value cannot be properly converted to an integer
Exceptionthrown if the argument has not been supplied

Definition at line 208 of file camargp.cpp.

◆ get_int()

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.

Parameters
skey of the parameter to retrieve
Returns
the value of the given parameter as integer
Exceptions
IllegalArgumentExceptionthrown if the value cannot be properly converted to an integer
Exceptionthrown if the argument has not been supplied

Definition at line 184 of file camargp.cpp.

Referenced by firevision::FileLoader::FileLoader(), and firevision::SwissRangerCamera::SwissRangerCamera().

◆ has()

bool firevision::CameraArgumentParser::has ( std::string  s) const

◆ parameters()

std::map< std::string, std::string > firevision::CameraArgumentParser::parameters ( ) const

Get a map of parameters.

Returns
map of key/value pairs of parameters supplied in the argument string.

Definition at line 238 of file camargp.cpp.


The documentation for this class was generated from the following files: