libcamera: v4l2_controls: Derive V4L2ControlInfoMap from ControlInfoMap
Replace the std::map<> used as the base type for V4L2ControlInfoMap by ControlInfoMap, which is an alias for an std::unsorted_map<> with the same key and value types. This shortens the code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
1bfed95c1e
commit
c957c8580a
3 changed files with 21 additions and 21 deletions
|
@ -31,27 +31,27 @@ public:
|
||||||
V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl);
|
V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl);
|
||||||
};
|
};
|
||||||
|
|
||||||
class V4L2ControlInfoMap : private std::map<const ControlId *, ControlRange>
|
class V4L2ControlInfoMap : private ControlInfoMap
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
V4L2ControlInfoMap &operator=(std::map<const ControlId *, ControlRange> &&info);
|
V4L2ControlInfoMap &operator=(ControlInfoMap &&info);
|
||||||
|
|
||||||
using std::map<const ControlId *, ControlRange>::key_type;
|
using ControlInfoMap::key_type;
|
||||||
using std::map<const ControlId *, ControlRange>::mapped_type;
|
using ControlInfoMap::mapped_type;
|
||||||
using std::map<const ControlId *, ControlRange>::value_type;
|
using ControlInfoMap::value_type;
|
||||||
using std::map<const ControlId *, ControlRange>::size_type;
|
using ControlInfoMap::size_type;
|
||||||
using std::map<const ControlId *, ControlRange>::iterator;
|
using ControlInfoMap::iterator;
|
||||||
using std::map<const ControlId *, ControlRange>::const_iterator;
|
using ControlInfoMap::const_iterator;
|
||||||
|
|
||||||
using std::map<const ControlId *, ControlRange>::begin;
|
using ControlInfoMap::begin;
|
||||||
using std::map<const ControlId *, ControlRange>::cbegin;
|
using ControlInfoMap::cbegin;
|
||||||
using std::map<const ControlId *, ControlRange>::end;
|
using ControlInfoMap::end;
|
||||||
using std::map<const ControlId *, ControlRange>::cend;
|
using ControlInfoMap::cend;
|
||||||
using std::map<const ControlId *, ControlRange>::at;
|
using ControlInfoMap::at;
|
||||||
using std::map<const ControlId *, ControlRange>::empty;
|
using ControlInfoMap::empty;
|
||||||
using std::map<const ControlId *, ControlRange>::size;
|
using ControlInfoMap::size;
|
||||||
using std::map<const ControlId *, ControlRange>::count;
|
using ControlInfoMap::count;
|
||||||
using std::map<const ControlId *, ControlRange>::find;
|
using ControlInfoMap::find;
|
||||||
|
|
||||||
mapped_type &at(unsigned int key);
|
mapped_type &at(unsigned int key);
|
||||||
const mapped_type &at(unsigned int key) const;
|
const mapped_type &at(unsigned int key) const;
|
||||||
|
|
|
@ -132,7 +132,7 @@ V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Move assignment operator from plain map
|
* \brief Move assignment operator from a ControlInfoMap
|
||||||
* \param[in] info The control info map
|
* \param[in] info The control info map
|
||||||
*
|
*
|
||||||
* Populate the map by replacing its contents with those of \a info using move
|
* Populate the map by replacing its contents with those of \a info using move
|
||||||
|
@ -142,9 +142,9 @@ V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl)
|
||||||
*
|
*
|
||||||
* \return The populated V4L2ControlInfoMap
|
* \return The populated V4L2ControlInfoMap
|
||||||
*/
|
*/
|
||||||
V4L2ControlInfoMap &V4L2ControlInfoMap::operator=(std::map<const ControlId *, ControlRange> &&info)
|
V4L2ControlInfoMap &V4L2ControlInfoMap::operator=(ControlInfoMap &&info)
|
||||||
{
|
{
|
||||||
std::map<const ControlId *, ControlRange>::operator=(std::move(info));
|
ControlInfoMap::operator=(std::move(info));
|
||||||
|
|
||||||
idmap_.clear();
|
idmap_.clear();
|
||||||
for (const auto &ctrl : *this)
|
for (const auto &ctrl : *this)
|
||||||
|
|
|
@ -342,7 +342,7 @@ int V4L2Device::ioctl(unsigned long request, void *argp)
|
||||||
*/
|
*/
|
||||||
void V4L2Device::listControls()
|
void V4L2Device::listControls()
|
||||||
{
|
{
|
||||||
std::map<const ControlId *, ControlRange> ctrls;
|
ControlInfoMap ctrls;
|
||||||
struct v4l2_query_ext_ctrl ctrl = {};
|
struct v4l2_query_ext_ctrl ctrl = {};
|
||||||
|
|
||||||
/* \todo Add support for menu and compound controls. */
|
/* \todo Add support for menu and compound controls. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue