libopenraw  0.3.7
arwfile.hpp
1 /* -*- Mode: C++; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
3  * libopenraw - arwfile.hpp
4  *
5  * Copyright (C) 2006-2020 Hubert Figuière
6  *
7  * This library is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation, either version 3 of
10  * the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library. If not, see
19  * <http://www.gnu.org/licenses/>.
20  */
21 
22 #pragma once
23 
24 #include <libopenraw/cameraids.h>
25 #include <libopenraw/consts.h>
26 
27 #include "rawfile.hpp"
28 #include "io/stream.hpp"
29 #include "ifddir.hpp"
30 #include "ifdfile.hpp"
31 #include "tiffepfile.hpp"
32 
33 namespace OpenRaw {
34 
35 class RawData;
36 
37 namespace Internals {
38 
39 class ArwFile
40  : public TiffEpFile
41 {
42  template<typename T>
43  friend void audit_coefficients();
44 
45 public:
46  static RawFile *factory(const IO::Stream::Ptr & s);
47  ArwFile(const IO::Stream::Ptr & s);
48  virtual ~ArwFile();
49 
50  ArwFile(const ArwFile&) = delete;
51  ArwFile & operator=(const ArwFile&) = delete;
52 
53 protected:
54  virtual IfdDir::Ref _locateCfaIfd() override;
55 
56  virtual ::or_error _getRawData(RawData & data, uint32_t options) override;
57  virtual bool vendorCameraIdLocation(Internals::IfdDir::Ref& ifd, uint16_t& index, const ModelIdMap*& model_map) override;
58 
59 private:
60  // first version of ARW. Different from the rest.
61  bool isA100()
62  {
63  return typeId() == OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_SONY,
64  OR_TYPEID_SONY_A100);
65  }
66 
67  static const IfdFile::camera_ids_t s_def[];
68 };
69 
70 }
71 }
std::shared_ptr< Stream > Ptr
Definition: stream.hpp:47
virtual bool vendorCameraIdLocation(Internals::IfdDir::Ref &ifd, uint16_t &index, const ModelIdMap *&model_map) override
Get the vendor camera ID location.
Definition: arwfile.cpp:646
virtual ::or_error _getRawData(RawData &data, uint32_t options) override
Get the RAW data.
Definition: arwfile.cpp:637
virtual IfdDir::Ref _locateCfaIfd() override
Locate the IFD for the raw data.
Definition: arwfile.cpp:629
std::shared_ptr< IfdDir > Ref
Shared ptr of an IfdDir.
Definition: ifddir.hpp:56
TIFF.EP conformant files.
Definition: tiffepfile.hpp:44
Represent camera raw data.
Definition: rawdata.hpp:38
RAW file.
Definition: rawfile.hpp:66
TypeId typeId()
The RAW file type ID. Identify it if needed.
Definition: rawfile.cpp:380
#define OR_MAKE_FILE_TYPEID(vendor, camera)
Make a or_rawfile_typeid with a vendor and camera.
Definition: consts.h:133
or_error
Error codes returned by libopenraw.
Definition: consts.h:42
std::map< uint32_t, ::or_rawfile_typeid > ModelIdMap
Definition: rawfile.hpp:54
Global namespace for libopenraw.
Definition: arwfile.cpp:29