26 #include <sys/types.h>
32 #include <libopenraw/debug.h>
34 #include "ifdentry.hpp"
37 #include "exif/exif_tags.hpp"
48 class IfdFileContainer;
56 typedef std::shared_ptr<IfdDir>
Ref;
66 typedef std::map<uint16_t, IfdEntry::Ref>
Entries;
89 {
return m_base_offset; }
92 { m_base_offset = base; }
106 off_t
offset()
const {
return m_offset; }
155 template <
typename T>
163 catch (
const std::exception &ex) {
164 LOGERR(
"Exception raised %s fetch value for %u\n", ex.what(),
id);
213 m_tag_table = &tag_table;
221 template <
typename T>
245 const TagTable* m_tag_table;
256 template <
typename T>
260 std::vector<T> array;
261 array.reserve(entry.
count());
262 for (uint32_t i = 0; i < entry.
count(); i++) {
263 array.push_back(getEntryValue<T>(entry, i));
267 catch(
const std::exception& e)
269 LOGERR(
"Exception: %s\n", e.what());
282 template <
typename T>
287 if(!ignore_type && (e.type() != IFD::EXIF_FORMAT_UNDEFINED)) {
292 if (idx + 1 > e.count()) {
300 const uint8_t *data = e.dataptr();
const RawContainer & container() const
The container for the IfdDir, const.
std::vector< Ref > RefVec
Vector of shared ptr of IfdDir.
bool isThumbnail() const
The IFD is for a thumnail.
void setTagTable(const TagTable &tag_table)
Set the tag table for tag to name correspondance.
off_t nextIFD()
Get the offset of the next IFD in absolute.
Ref getMakerNoteIfd(or_rawfile_type file_type)
Get the MakerNote IFD.
const Entries & entries() const
Direct access to the entries.
virtual bool load()
Load the directory to memory.
RawContainer::EndianType endian() const
the Container endian
MetaValue * makeMetaValue(IfdEntry &e) const
Make a meta value out of the IFD entry.
IfdDirType type() const
Get the type of the IfdDir.
Option< T > getValue(uint16_t id) const
Get a T value from an entry.
void setType(IfdDirType type_)
Set the type of the IfdDir.
RawContainer & container()
The container for the IfdDir.
std::map< uint16_t, IfdEntry::Ref > Entries
Ifd Entries map type.
off_t baseOffset() const
Get the base offset for the data.
bool isPrimary() const
The IFD is a primary in the TIFF/EP sense.
Ref getExifIFD()
Get the Exif IFD.
const char * getTagName(uint32_t tag) const
Return the tag name for tag.
void setEndian(RawContainer::EndianType _endian)
Set the endian for the IFD.
uint32_t getEntryIntegerArrayItemValue(IfdEntry &e, int idx) const
Return the integer value at index. It will coerce the type.
Ref getSubIFD(uint32_t idx=0) const
Get the SubIFD at index idx.
void setBaseOffset(off_t base)
Set the base offset.
IfdEntry::Ref getEntry(uint16_t id) const
Get the IfdEntry for the tag id.
std::shared_ptr< IfdDir > Ref
Shared ptr of an IfdDir.
std::weak_ptr< IfdDir > WeakRef
Weak ptr of an IfdDir.
Option< std::vector< IfdDir::Ref > > getSubIFDs()
Get all SubIFDs.
int numTags()
Return the number of entries.
off_t offset() const
Return the offset.
Option< uint32_t > getIntegerValue(uint16_t id)
Get an loosely typed integer value from an entry.
IfdDir(off_t _offset, RawContainer &_container, IfdDirType _type, const TagTable &tag_table=exif_tag_names)
Construct an IfdDir.
uint32_t count() const noexcept
The count of items in the entry.
std::shared_ptr< IfdEntry > Ref
IfdEntry reference (ie shared pointer)
Generic interface for the RAW file container.
EndianType
Define the endian of the container.
Tag class to help create an empty Option.
An option type inspired by Rust.
T getEntryValue(IfdEntry &e, uint32_t idx=0, bool ignore_type=false) const
Get the typed entry value.
Option< std::vector< T > > getEntryArrayValue(IfdEntry &e) const
Get the entry value as an array.
or_ifd_dir_type
Type of IfdDir.
or_rawfile_type
Types of RAW files.
Global namespace for libopenraw.