libcamera  v0.0.0
Supporting cameras in Linux since 2019
Public Types | Public Member Functions | List of all members
libcamera::ControlInfoMap Class Reference

A map of ControlId to ControlInfo. More...

Inheritance diagram for libcamera::ControlInfoMap:

Public Types

using Map = std::unordered_map< const ControlId *, ControlInfo >
 The base std::unsorted_map<> container.
 

Public Member Functions

 ControlInfoMap (const ControlInfoMap &other)=default
 Copy constructor, construct a ControlInfoMap from a copy of other. More...
 
 ControlInfoMap (std::initializer_list< Map::value_type > init)
 Construct a ControlInfoMap from an initializer list. More...
 
 ControlInfoMap (Map &&info)
 Construct a ControlInfoMap from a plain map. More...
 
ControlInfoMapoperator= (const ControlInfoMap &other)=default
 Copy assignment operator, replace the contents with a copy of other. More...
 
ControlInfoMapoperator= (std::initializer_list< Map::value_type > init)
 Replace the contents with those from the initializer list. More...
 
ControlInfoMapoperator= (Map &&info)
 Move assignment operator from a plain map. More...
 
mapped_type & at (unsigned int key)
 Access specified element by numerical ID. More...
 
const mapped_type & at (unsigned int key) const
 Access specified element by numerical ID. More...
 
size_type count (unsigned int key) const
 Count the number of elements matching a numerical ID. More...
 
iterator find (unsigned int key)
 Find the element matching a numerical ID. More...
 
const_iterator find (unsigned int key) const
 Find the element matching a numerical ID. More...
 
const ControlIdMapidmap () const
 Retrieve the ControlId map. More...
 

Detailed Description

A map of ControlId to ControlInfo.

The ControlInfoMap class describes controls supported by an object as an unsorted map of ControlId pointers to ControlInfo instances. Unlike the standard std::unsorted_map<> class, it is designed the be immutable once constructed, and thus only exposes the read accessors of the std::unsorted_map<> base class.

In addition to the features of the standard unsorted map, this class also provides access to the mapped elements using numerical ID keys. It maintains an internal map of numerical ID to ControlId for this purpose, and exposes it through the idmap() method to help construction of ControlList instances.

Constructor & Destructor Documentation

◆ ControlInfoMap() [1/3]

libcamera::ControlInfoMap::ControlInfoMap ( const ControlInfoMap other)
default

Copy constructor, construct a ControlInfoMap from a copy of other.

Parameters
[in]otherThe other ControlInfoMap

◆ ControlInfoMap() [2/3]

libcamera::ControlInfoMap::ControlInfoMap ( std::initializer_list< Map::value_type >  init)

Construct a ControlInfoMap from an initializer list.

Parameters
[in]initThe initializer list

◆ ControlInfoMap() [3/3]

libcamera::ControlInfoMap::ControlInfoMap ( Map &&  info)

Construct a ControlInfoMap from a plain map.

Parameters
[in]infoThe control info plain map

Construct a new ControlInfoMap and populate its contents with those of info using move semantics. Upon return the info map will be empty.

Member Function Documentation

◆ at() [1/2]

ControlInfoMap::mapped_type & libcamera::ControlInfoMap::at ( unsigned int  id)

Access specified element by numerical ID.

Parameters
[in]idThe numerical ID
Returns
A reference to the element whose ID is equal to id

◆ at() [2/2]

const ControlInfoMap::mapped_type & libcamera::ControlInfoMap::at ( unsigned int  id) const

Access specified element by numerical ID.

Parameters
[in]idThe numerical ID
Returns
A const reference to the element whose ID is equal to id

◆ count()

ControlInfoMap::size_type libcamera::ControlInfoMap::count ( unsigned int  id) const

Count the number of elements matching a numerical ID.

Parameters
[in]idThe numerical ID
Returns
The number of elements matching the numerical id

◆ find() [1/2]

ControlInfoMap::iterator libcamera::ControlInfoMap::find ( unsigned int  id)

Find the element matching a numerical ID.

Parameters
[in]idThe numerical ID
Returns
An iterator pointing to the element matching the numerical id, or end() if no such element exists

◆ find() [2/2]

ControlInfoMap::const_iterator libcamera::ControlInfoMap::find ( unsigned int  id) const

Find the element matching a numerical ID.

Parameters
[in]idThe numerical ID
Returns
A const iterator pointing to the element matching the numerical id, or end() if no such element exists

◆ idmap()

const ControlIdMap & libcamera::ControlInfoMap::idmap ( ) const
inline

Retrieve the ControlId map.

Constructing ControlList instances for V4L2 controls requires a ControlIdMap for the V4L2 device that the control list targets. This helper method returns a suitable idmap for that purpose.

Returns
The ControlId map

◆ operator=() [1/3]

ControlInfoMap & libcamera::ControlInfoMap::operator= ( const ControlInfoMap other)
default

Copy assignment operator, replace the contents with a copy of other.

Parameters
[in]otherThe other ControlInfoMap
Returns
A reference to the ControlInfoMap

◆ operator=() [2/3]

ControlInfoMap & libcamera::ControlInfoMap::operator= ( Map &&  info)

Move assignment operator from a plain map.

Parameters
[in]infoThe control info plain map

Populate the map by replacing its contents with those of info using move semantics. Upon return the info map will be empty.

Returns
A reference to the populated ControlInfoMap

◆ operator=() [3/3]

ControlInfoMap & libcamera::ControlInfoMap::operator= ( std::initializer_list< Map::value_type >  init)

Replace the contents with those from the initializer list.

Parameters
[in]initThe initializer list
Returns
A reference to the ControlInfoMap

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