summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-02-26 16:02:40 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-03-15 12:55:09 +0200
commite8f01b37e809bd7b101e6528b59c314ea3268068 (patch)
treecb65acccf7767b38de9610ae12c52b8ec8d5f5ce /include
parent0d2ad0cd8424e1b418cbb753bae100efc1b3d669 (diff)
libcamera: v4l2_subdevice: Replace Routing::toString() with operator<<()
The main (and only at the moment) use case for the Routing::toString() function is to print a representation of the routing table in a log message. The function is implemented using an std::stringstream, and the returned std::string is then inserted into an std::ostream. This is inefficient. Replace the function with a specialization of the operator<<() and use it in the caller. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/internal/v4l2_subdevice.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h
index 6cd36730..2939dc24 100644
--- a/include/libcamera/internal/v4l2_subdevice.h
+++ b/include/libcamera/internal/v4l2_subdevice.h
@@ -95,11 +95,7 @@ public:
unsigned int stream;
};
- class Routing : public std::vector<struct v4l2_subdev_route>
- {
- public:
- std::string toString() const;
- };
+ using Routing = std::vector<struct v4l2_subdev_route>;
explicit V4L2Subdevice(const MediaEntity *entity);
~V4L2Subdevice();
@@ -178,5 +174,6 @@ static inline bool operator!=(const V4L2Subdevice::Stream &lhs,
}
std::ostream &operator<<(std::ostream &out, const V4L2Subdevice::Stream &stream);
+std::ostream &operator<<(std::ostream &out, const V4L2Subdevice::Routing &routing);
} /* namespace libcamera */