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"  // for HAVE_PUGIXML
24
#include "metadata/Camera.h" // IWYU pragma: keep
25
#include <cstdint>           // for uint32_t
26
#include <map>               // for map
27
#include <memory>            // for unique_ptr
28
#include <string>            // for string
29
#include <tuple>             // for tie, operator<, tuple
30

31
namespace rawspeed {
32

33
struct CameraId {
34
  std::string make;
35
  std::string model;
36
  std::string mode;
37

38 2
  bool operator<(const CameraId& rhs) const {
39 2
    return std::tie(make, model, mode) <
40 2
           std::tie(rhs.make, rhs.model, rhs.mode);
41
  }
42
};
43

44
class CameraMetaData final {
45
public:
46 1
  CameraMetaData() = default;
47

48
#ifdef HAVE_PUGIXML
49
  explicit CameraMetaData(const char* docname);
50
#endif
51

52
  std::map<CameraId, std::unique_ptr<Camera>> cameras;
53
  std::map<uint32_t, Camera*> chdkCameras;
54

55
  // searches for camera with given make + model + mode
56
  const Camera* getCamera(const std::string& make, const std::string& model,
57
                          const std::string& mode) const;
58

59
  // searches for camera with given make + model, with ANY mode
60
  const Camera* getCamera(const std::string& make,
61
                          const std::string& model) const;
62

63
  bool hasCamera(const std::string& make, const std::string& model,
64
                 const std::string& mode) const;
65
  const Camera* __attribute__((pure)) getChdkCamera(uint32_t filesize) const;
66
  bool __attribute__((pure)) hasChdkCamera(uint32_t filesize) const;
67
  void disableMake(const std::string &make);
68
  void disableCamera(const std::string &make, const std::string &model);
69

70
protected:
71
  const Camera* addCamera(std::unique_ptr<Camera> cam);
72
};
73

74
} // namespace rawspeed

Read our documentation on viewing source code .

Loading