summaryrefslogtreecommitdiff
path: root/src/cam/camera_session.cpp
diff options
context:
space:
mode:
authorNejc Galof <galof.nejc@gmail.com>2022-02-20 01:52:57 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-02-21 16:23:52 +0200
commit7a118dbdb881c38ad13de12efb023c6b78d2a57e (patch)
treeeb19509ce41ba6373be40581543fc129618c3af8 /src/cam/camera_session.cpp
parent039a6a02d019d0e06a5b236bfe99c4444e05fe8d (diff)
cam: Use structured bindings in range-based for loops
Use structured bindings range-based for loops for better readability. Signed-off-by: Nejc Galof <galof.nejc@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/cam/camera_session.cpp')
-rw-r--r--src/cam/camera_session.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/cam/camera_session.cpp b/src/cam/camera_session.cpp
index 1bf460fa..0428b538 100644
--- a/src/cam/camera_session.cpp
+++ b/src/cam/camera_session.cpp
@@ -120,10 +120,7 @@ CameraSession::~CameraSession()
void CameraSession::listControls() const
{
- for (const auto &ctrl : camera_->controls()) {
- const ControlId *id = ctrl.first;
- const ControlInfo &info = ctrl.second;
-
+ for (const auto &[id, info] : camera_->controls()) {
std::cout << "Control: " << id->name() << ": "
<< info.toString() << std::endl;
}
@@ -131,9 +128,8 @@ void CameraSession::listControls() const
void CameraSession::listProperties() const
{
- for (const auto &prop : camera_->properties()) {
- const ControlId *id = properties::properties.at(prop.first);
- const ControlValue &value = prop.second;
+ for (const auto &[key, value] : camera_->properties()) {
+ const ControlId *id = properties::properties.at(key);
std::cout << "Property: " << id->name() << " = "
<< value.toString() << std::endl;
@@ -374,10 +370,7 @@ void CameraSession::processRequest(Request *request)
<< std::setw(6) << std::setfill('0') << ts / 1000 % 1000000
<< " (" << std::fixed << std::setprecision(2) << fps << " fps)";
- for (auto it = buffers.begin(); it != buffers.end(); ++it) {
- const Stream *stream = it->first;
- FrameBuffer *buffer = it->second;
-
+ for (const auto &[stream, buffer] : buffers) {
const FrameMetadata &metadata = buffer->metadata();
info << " " << streamNames_[stream]
@@ -401,10 +394,10 @@ void CameraSession::processRequest(Request *request)
if (printMetadata_) {
const ControlList &requestMetadata = request->metadata();
- for (const auto &ctrl : requestMetadata) {
- const ControlId *id = controls::controls.at(ctrl.first);
+ for (const auto &[key, value] : requestMetadata) {
+ const ControlId *id = controls::controls.at(key);
std::cout << "\t" << id->name() << " = "
- << ctrl.second.toString() << std::endl;
+ << value.toString() << std::endl;
}
}