RawSpeed
fast raw decoding library
Loading...
Searching...
No Matches
CameraMetaData.h
Go to the documentation of this file.
1/*
2 RawSpeed - RAW file decoder.
3
4 Copyright (C) 2009-2014 Klaus Post
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19*/
20
21#pragma once
22
23#include "rawspeedconfig.h"
24#include "metadata/Camera.h"
25#include <cstdint>
26#include <map>
27#include <memory>
28#include <string>
29#include <string_view>
30#include <tuple>
31
32namespace rawspeed {
33class Camera;
34
35struct CameraId final {
36 std::string make;
37 std::string model;
38 std::string mode;
39
40 bool operator<(const CameraId& rhs) const {
41 return std::tie(make, model, mode) <
42 std::tie(rhs.make, rhs.model, rhs.mode);
43 }
44};
45
46// NOTE: *NOT* `final`, could be derived from by downstream.
48public:
49 CameraMetaData() = default;
50
51#ifdef HAVE_PUGIXML
52 explicit CameraMetaData(const char* docname);
53#endif
54
55 std::map<CameraId, std::unique_ptr<Camera>> cameras;
56 std::map<uint32_t, Camera*> chdkCameras;
57
58 // searches for camera with given make + model + mode
59 [[nodiscard]] const Camera* getCamera(const std::string& make,
60 const std::string& model,
61 const std::string& mode) const;
62
63 // searches for camera with given make + model, with ANY mode
64 [[nodiscard]] const Camera* getCamera(const std::string& make,
65 const std::string& model) const;
66
67 [[nodiscard]] bool hasCamera(const std::string& make,
68 const std::string& model,
69 const std::string& mode) const;
70 [[nodiscard]] const Camera* RAWSPEED_READONLY
71 getChdkCamera(uint32_t filesize) const;
72 [[nodiscard]] bool RAWSPEED_READONLY hasChdkCamera(uint32_t filesize) const;
73 void disableMake(std::string_view make) const;
74 void disableCamera(std::string_view make, std::string_view model) const;
75
76private:
77 const Camera* addCamera(std::unique_ptr<Camera> cam);
78};
79
80} // namespace rawspeed
CameraMetaData()=default
const Camera * getCamera(const std::string &make, const std::string &model, const std::string &mode) const
std::map< uint32_t, Camera * > chdkCameras
const Camera *RAWSPEED_READONLY getChdkCamera(uint32_t filesize) const
std::map< CameraId, std::unique_ptr< Camera > > cameras
bool hasCamera(const std::string &make, const std::string &model, const std::string &mode) const
void disableCamera(std::string_view make, std::string_view model) const
void disableMake(std::string_view make) const
bool RAWSPEED_READONLY hasChdkCamera(uint32_t filesize) const
const Camera * addCamera(std::unique_ptr< Camera > cam)
bool operator<(const CameraId &rhs) const