Fawkes API  Fawkes Development Version
firevision::CameraArgumentParser Class Reference

Camera argument parser. More...

#include <>>

List of all members.

Public Member Functions

 CameraArgumentParser (const char *as)
 Constructor.
 ~CameraArgumentParser ()
 Destructor.
bool has (std::string s) const
 Check if an parameter was given.
std::string get (std::string s) const
 Get the value of the given parameter.
long int get_int (std::string s) const
 Get the value of the given parameter as integer.
double get_float (std::string s) const
 Get the value of the given parameter as integer.
std::map< std::string,
std::string
parameters () const
 Get a map of parameters.
std::vector< std::stringarguments () const
 Get the arguments.
std::string cam_id () const
 Get camera ID.
std::string cam_type () const
 Get camera type.

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

Constructor & Destructor Documentation

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

Constructor.

Parameters:
ascamera argument string

Definition at line 71 of file camargp.cpp.

firevision::CameraArgumentParser::~CameraArgumentParser ( )

Destructor.

Definition at line 114 of file camargp.cpp.


Member Function Documentation

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.

std::string firevision::CameraArgumentParser::cam_id ( ) const
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 firevision::CameraControlFactory::instance(), firevision::CameraFactory::instance(), FvBaseThread::register_for_camera(), FvBaseThread::register_for_raw_camera(), FvBaseThread::acquire_camctrl(), and RetrieverConfigDialog::add_camera().

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.

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

bool firevision::CameraArgumentParser::has ( std::string  s) const
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.

Referenced by RetrieverConfigDialog::add_camera().


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