Message ID | 20230127154322.29019-13-naush@raspberrypi.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Quoting Naushir Patuck via libcamera-devel (2023-01-27 15:43:19) > Move rolesMap out of the nameParameters() function to allow use with > other functions in the file. Additionally enclose all global variables > in an unnamed namespace. > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > --- > src/apps/lc-compliance/capture_test.cpp | 18 +++++++++++------- > 1 file changed, 11 insertions(+), 7 deletions(-) > > diff --git a/src/apps/lc-compliance/capture_test.cpp b/src/apps/lc-compliance/capture_test.cpp > index 1dcfcf92fc8c..37138dfb3d2e 100644 > --- a/src/apps/lc-compliance/capture_test.cpp > +++ b/src/apps/lc-compliance/capture_test.cpp > @@ -15,6 +15,15 @@ > > using namespace libcamera; > > +namespace { > + > +std::map<StreamRole, std::string> rolesMap = { > + { StreamRole::Raw, "Raw" }, > + { StreamRole::StillCapture, "StillCapture" }, > + { StreamRole::VideoRecording, "VideoRecording" }, > + { StreamRole::Viewfinder, "Viewfinder" } > +}; > + > const std::vector<int> NUMREQUESTS = { 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 }; > const std::vector<StreamRole> ROLES = { > StreamRole::Raw, > @@ -23,6 +32,8 @@ const std::vector<StreamRole> ROLES = { > StreamRole::Viewfinder > }; > > +} /* namespace */ > + > class SingleStream : public testing::TestWithParam<std::tuple<StreamRole, int>> > { > public: > @@ -59,13 +70,6 @@ void SingleStream::TearDown() > > std::string SingleStream::nameParameters(const testing::TestParamInfo<SingleStream::ParamType> &info) > { > - std::map<StreamRole, std::string> rolesMap = { > - { StreamRole::Raw, "Raw" }, > - { StreamRole::StillCapture, "StillCapture" }, > - { StreamRole::VideoRecording, "VideoRecording" }, > - { StreamRole::Viewfinder, "Viewfinder" } > - }; > - > std::string roleName = rolesMap[std::get<0>(info.param)]; > std::string numRequestsName = std::to_string(std::get<1>(info.param)); > > -- > 2.25.1 >
diff --git a/src/apps/lc-compliance/capture_test.cpp b/src/apps/lc-compliance/capture_test.cpp index 1dcfcf92fc8c..37138dfb3d2e 100644 --- a/src/apps/lc-compliance/capture_test.cpp +++ b/src/apps/lc-compliance/capture_test.cpp @@ -15,6 +15,15 @@ using namespace libcamera; +namespace { + +std::map<StreamRole, std::string> rolesMap = { + { StreamRole::Raw, "Raw" }, + { StreamRole::StillCapture, "StillCapture" }, + { StreamRole::VideoRecording, "VideoRecording" }, + { StreamRole::Viewfinder, "Viewfinder" } +}; + const std::vector<int> NUMREQUESTS = { 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 }; const std::vector<StreamRole> ROLES = { StreamRole::Raw, @@ -23,6 +32,8 @@ const std::vector<StreamRole> ROLES = { StreamRole::Viewfinder }; +} /* namespace */ + class SingleStream : public testing::TestWithParam<std::tuple<StreamRole, int>> { public: @@ -59,13 +70,6 @@ void SingleStream::TearDown() std::string SingleStream::nameParameters(const testing::TestParamInfo<SingleStream::ParamType> &info) { - std::map<StreamRole, std::string> rolesMap = { - { StreamRole::Raw, "Raw" }, - { StreamRole::StillCapture, "StillCapture" }, - { StreamRole::VideoRecording, "VideoRecording" }, - { StreamRole::Viewfinder, "Viewfinder" } - }; - std::string roleName = rolesMap[std::get<0>(info.param)]; std::string numRequestsName = std::to_string(std::get<1>(info.param));
Move rolesMap out of the nameParameters() function to allow use with other functions in the file. Additionally enclose all global variables in an unnamed namespace. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> --- src/apps/lc-compliance/capture_test.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)