libopenraw
lib
ifddir.hpp
1
/* -*- Mode: C++ -*- */
2
/*
3
* libopenraw - ifddir.h
4
*
5
* Copyright (C) 2006-2015 Hubert Figuiere
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
#ifndef OR_INTERNALS_IFDDIR_H
23
#define OR_INTERNALS_IFDDIR_H
24
25
#include <stddef.h>
26
#include <stdint.h>
27
#include <sys/types.h>
28
#include <exception>
29
#include <map>
30
#include <memory>
31
#include <vector>
32
33
#include <libopenraw/debug.h>
34
35
#include "ifdentry.hpp"
36
#include "trace.hpp"
37
38
namespace
OpenRaw
{
39
namespace
Internals {
40
41
class
IfdFileContainer;
42
43
class
IfdDir
{
44
public
:
45
typedef
std::shared_ptr<IfdDir> Ref;
46
typedef
std::vector<Ref> RefVec;
47
48
IfdDir
(off_t _offset,
IfdFileContainer
&_container);
49
virtual
~
IfdDir
();
50
51
bool
isPrimary()
const
;
52
bool
isThumbnail()
const
;
53
55
off_t
offset
()
const
{
return
m_offset; }
56
const
IfdFileContainer
&container()
const
{
return
m_container; }
57
59
bool
load
();
61
int
numTags
() {
return
m_entries.size(); }
62
IfdEntry::Ref
getEntry(uint16_t
id
)
const
;
63
69
template
<
typename
T>
70
bool
getValue
(uint16_t
id
, T &v)
const
71
{
72
bool
success =
false
;
73
IfdEntry::Ref
e = getEntry(
id
);
74
if
(e != NULL) {
75
try
{
76
v =
IfdTypeTrait<T>::get
(*e);
77
success =
true
;
78
}
79
catch
(
const
std::exception &ex) {
80
Debug::Trace
(ERROR) <<
"Exception raised "
<< ex.what()
81
<<
" fetch value for "
<<
id
<<
"\n"
;
82
}
83
}
84
return
success;
85
}
86
95
bool
getIntegerValue
(uint16_t
id
, uint32_t &v);
96
100
off_t
nextIFD
();
101
105
Ref
getSubIFD
(uint32_t idx = 0)
const
;
110
bool
getSubIFDs
(std::vector<IfdDir::Ref> &ifds);
111
115
Ref
getExifIFD
();
116
120
Ref
getMakerNoteIfd
();
121
122
private
:
123
off_t m_offset;
124
IfdFileContainer
&m_container;
125
std::map<uint16_t, IfdEntry::Ref> m_entries;
126
};
127
}
128
}
129
130
#endif
OpenRaw
CIFF is the container for CRW files. It is an attempt from Canon to make this a standard. I guess it failed.
Definition:
arwfile.cpp:30
OpenRaw::Internals::IfdTypeTrait::get
static T get(IfdEntry &e, uint32_t idx=0, bool ignore_type=false) noexcept(false)
Definition:
ifdentry.hpp:269
OpenRaw::Internals::IfdDir::getSubIFDs
bool getSubIFDs(std::vector< IfdDir::Ref > &ifds)
Definition:
ifddir.cpp:148
OpenRaw::Internals::IfdDir::getIntegerValue
bool getIntegerValue(uint16_t id, uint32_t &v)
Definition:
ifddir.cpp:94
OpenRaw::Internals::IfdDir::load
bool load()
Definition:
ifddir.cpp:58
OpenRaw::Internals::IfdDir::getValue
bool getValue(uint16_t id, T &v) const
Definition:
ifddir.hpp:70
OpenRaw::Internals::IfdDir::getExifIFD
Ref getExifIFD()
Definition:
ifddir.cpp:173
OpenRaw::Internals::IfdFileContainer
Definition:
ifdfilecontainer.hpp:47
Debug::Trace
Definition:
trace.hpp:54
OpenRaw::Internals::IfdEntry::Ref
std::shared_ptr< IfdEntry > Ref
Definition:
ifdentry.hpp:178
OpenRaw::Internals::IfdDir::nextIFD
off_t nextIFD()
Definition:
ifddir.cpp:105
OpenRaw::Internals::IfdDir::offset
off_t offset() const
Definition:
ifddir.hpp:55
OpenRaw::Internals::IfdDir::getSubIFD
Ref getSubIFD(uint32_t idx=0) const
Definition:
ifddir.cpp:128
OpenRaw::Internals::IfdDir
Definition:
ifddir.hpp:43
OpenRaw::Internals::IfdDir::numTags
int numTags()
Definition:
ifddir.hpp:61
OpenRaw::Internals::IfdDir::getMakerNoteIfd
Ref getMakerNoteIfd()
Definition:
ifddir.cpp:192
Generated by
1.8.12