libcamera  v0.3.2+116-83c5ad0f
Supporting cameras in Linux since 2019
Public Types | Public Member Functions | List of all members
libcamera::Control< T > Class Template Reference

Describe a control and its intrinsic properties. More...

Inheritance diagram for libcamera::Control< T >:
Inheritance graph
[legend]
Collaboration diagram for libcamera::Control< T >:
Collaboration graph
[legend]

Public Types

using type = T
 The Control template type T.
 

Public Member Functions

 Control (unsigned int id, const char *name, const char *vendor, const std::map< std::string, int32_t > &enumStrMap={})
 Construct a Control instance. More...
 
- Public Member Functions inherited from libcamera::ControlId
 ControlId (unsigned int id, const std::string &name, const std::string &vendor, ControlType type, std::size_t size=0, const std::map< std::string, int32_t > &enumStrMap={})
 Construct a ControlId instance. More...
 
unsigned int id () const
 Retrieve the control numerical ID. More...
 
const std::string & name () const
 Retrieve the control name. More...
 
const std::string & vendor () const
 Retrieve the vendor name. More...
 
ControlType type () const
 Retrieve the control data type. More...
 
bool isArray () const
 Determine if the control is an array control. More...
 
std::size_t size () const
 Retrieve the size of the control if it is an array control. More...
 
const std::map< int32_t, std::string > & enumerators () const
 Retrieve the map of enum values to enum names. More...
 

Detailed Description

template<typename T>
class libcamera::Control< T >

Describe a control and its intrinsic properties.

The Control class models a control exposed by an object. Its template type name T refers to the control data type, and allows functions that operate on control values to be defined as template functions using the same type T for the control value. See for instance how the ControlList::get() function returns a value corresponding to the type of the requested control.

While this class is the main means to refer to a control, the control identifying information is stored in the non-template base ControlId class. This allows code that operates on a set of controls of different types to reference those controls through a ControlId instead of a Control. For instance, the list of controls supported by a camera is exposed as ControlId instead of Control.

Controls of any type can be defined through template specialisation, but libcamera only supports the bool, uint8_t, int32_t, int64_t and float types natively (this includes types that are equivalent to the supported types, such as int and long int).

Controls IDs shall be unique. While nothing prevents multiple instances of the Control class to be created with the same ID for the same object, doing so may cause undefined behaviour.

Constructor & Destructor Documentation

◆ Control()

template<typename T>
libcamera::Control< T >::Control ( unsigned int  id,
const char *  name,
const char *  vendor,
const std::map< std::string, int32_t > &  enumStrMap = {} 
)
inline

Construct a Control instance.

Parameters
[in]idThe control numerical ID
[in]nameThe control name
[in]vendorThe vendor name
[in]enumStrMapThe map from enum names to values (optional)

The control data type is automatically deduced from the template type T.


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