CameraArgumentParser Class Reference

Camera argument parser. More...

#include <fvutils/system/camargp.h>

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.
std::map< std::string,
std::string > 
parameters () const
 Get a map of parameters.
std::vector< std::string > arguments () 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

Definition at line 33 of file camargp.h.


Constructor & Destructor Documentation

CameraArgumentParser::CameraArgumentParser ( const char *  as  ) 

Constructor.

Parameters:
as camera argument string

Definition at line 62 of file camargp.cpp.

CameraArgumentParser::~CameraArgumentParser (  ) 

Destructor.

Definition at line 105 of file camargp.cpp.


Member Function Documentation

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

Get the arguments.

Returns a vector of arguments supplied in the argument string.

Returns:
vector of arguments

Definition at line 171 of file camargp.cpp.

std::string CameraArgumentParser::cam_id (  )  const

Get camera ID.

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

Returns:
camera ID string

Definition at line 130 of file camargp.cpp.

Referenced by FvBaseThread::acquire_camctrl(), RetrieverConfigDialog::add_camera(), Bumblebee2Camera::Bumblebee2Camera(), FirewireCamera::FirewireCamera(), FvBaseThread::register_for_camera(), FvBaseThread::register_for_raw_camera(), and SonyEviD100PControl::SonyEviD100PControl().

std::string 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 118 of file camargp.cpp.

Referenced by FvBaseThread::acquire_camctrl(), RetrieverConfigDialog::add_camera(), CameraFactory::instance(), CameraControlFactory::instance(), FvBaseThread::register_for_camera(), and FvBaseThread::register_for_raw_camera().

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

Get the value of the given parameter.

Parameters:
s key of the parameter to retrieve
Returns:
the value of the given parameter or an empty string if the parameter was not supplied.

Definition at line 155 of file camargp.cpp.

Referenced by Bumblebee2Camera::Bumblebee2Camera(), FileLoader::FileLoader(), FirewireCamera::FirewireCamera(), NetworkCamera::NetworkCamera(), SharedMemoryCamera::SharedMemoryCamera(), V4L1Camera::V4L1Camera(), V4L2Camera::V4L2Camera(), and V4LCamera::V4LCamera().

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

Check if an parameter was given.

Checks if the given parameter s was given in the argument string.

Parameters:
s parameter key to check for
Returns:
true, if the parameter has been supplied, false otherwise

Definition at line 143 of file camargp.cpp.

Referenced by Bumblebee2Camera::Bumblebee2Camera(), FileLoader::FileLoader(), FirewireCamera::FirewireCamera(), NetworkCamera::NetworkCamera(), SharedMemoryCamera::SharedMemoryCamera(), V4L1Camera::V4L1Camera(), V4L2Camera::V4L2Camera(), and V4LCamera::V4LCamera().

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

Get a map of parameters.

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

Definition at line 181 of file camargp.cpp.

Referenced by RetrieverConfigDialog::add_camera().


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