libpniio
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
pni::io::tiff::ifd_entry Class Reference

class for IFD entries More...

#include <ifd_entry.hpp>

Public Member Functions

 ifd_entry ()
 default constructor More...
 
 ifd_entry (const ifd_entry &e)
 copy constructor More...
 
 ifd_entry (ifd_entry &&e)
 move constructor More...
 
 ifd_entry (uint16 tag, ifd_entry_type_id tid, size_t size, std::streampos data)
 standard constructor More...
 
 ~ifd_entry ()
 destructor More...
 
ifd_entryoperator= (const ifd_entry &e)
 copy assignment operator More...
 
ifd_entryoperator= (ifd_entry &&e)
 move assignment operator More...
 
size_t size () const
 number of elements More...
 
string name () const
 get name More...
 
type_id_t type_id () const
 get type ID More...
 
template<typename T >
std::vector< T > value (std::ifstream &stream)
 get entry value More...
 

Static Public Member Functions

static ifd_entry create_from_stream (std::ifstream &stream)
 create entry from stream More...
 

Private Member Functions

template<typename T >
void _read_entry_data (std::vector< T > &r, std::ifstream &stream)
 read entry data from stream More...
 
void _read_entry_data (std::vector< string > &r, std::ifstream &stream)
 read string entry from stream More...
 

Private Attributes

uint16 _tag
 ID of the entry. More...
 
ifd_entry_type_id _tid
 type id of the entry More...
 
size_t _size
 number of elements of the entry More...
 
std::streampos _data
 marks data position More...
 

Friends

std::ostream & operator<< (std::ostream &o, const ifd_entry &e)
 output operator More...
 

Detailed Description

This class can manage the content of a single IFDEntry.

Constructor & Destructor Documentation

pni::io::tiff::ifd_entry::ifd_entry ( )
pni::io::tiff::ifd_entry::ifd_entry ( const ifd_entry e)
pni::io::tiff::ifd_entry::ifd_entry ( ifd_entry &&  e)
pni::io::tiff::ifd_entry::ifd_entry ( uint16  tag,
ifd_entry_type_id  tid,
size_t  size,
std::streampos  data 
)

Standard constructor to create a IFDEntry.

Parameters
tagTIFF tag of the entry
tidtype ID of the entry
sizenumber of elements stored in this entry
datastarting position of data in the stream
pni::io::tiff::ifd_entry::~ifd_entry ( )

Member Function Documentation

template<typename T >
void pni::io::tiff::ifd_entry::_read_entry_data ( std::vector< T > &  r,
std::ifstream &  stream 
)
private

Reads the entrys data from an input stream. This method assumes that the input stream points to the first element of the entry. The position of the stream is altered. It is the responsibility of the calling method to take care about the position of the stream.

Parameters
rvector where to store the data
streaminput stream from which to read
void pni::io::tiff::ifd_entry::_read_entry_data ( std::vector< string > &  r,
std::ifstream &  stream 
)
private

Reads a string entry from the stream. The stream position will be altered by this method. Thus the calling method must take care about this.

Parameters
rvector where to store data
streaminput stream from which to read
ifd_entry pni::io::tiff::ifd_entry::create_from_stream ( std::ifstream &  stream)
static

A static factory method to create an instance of IFDEntry from a stream.

Parameters
streaminput stream from which to read data
Returns
instance of IFDEntry
pni::core::string pni::io::tiff::ifd_entry::name ( ) const

Returns the name of the entry as a string.

Returns
name as string
ifd_entry & pni::io::tiff::ifd_entry::operator= ( const ifd_entry e)
ifd_entry & pni::io::tiff::ifd_entry::operator= ( ifd_entry &&  e)
size_t pni::io::tiff::ifd_entry::size ( ) const

Returns the number of elements that make up the entry.

Returns
number of elements
pni::core::type_id_t pni::io::tiff::ifd_entry::type_id ( ) const

Returns the TypeID of the entries type.

Returns
type ID of entry
template<typename T >
std::vector< T > pni::io::tiff::ifd_entry::value ( std::ifstream &  stream)

Template returns the value of the entry and returs it as a vector of type T. Entries are in general considered as arrays (vectors) in TIFF. Thus the std::vector type is used to represent each entry.

The method makes no assumption about the position of the stream pointer neither does it alter its state.

Parameters
streaminput stream from which data will be read
Returns
entry as vector

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const ifd_entry e 
)
friend

Field Documentation

std::streampos pni::io::tiff::ifd_entry::_data
private
size_t pni::io::tiff::ifd_entry::_size
private
uint16 pni::io::tiff::ifd_entry::_tag
private
ifd_entry_type_id pni::io::tiff::ifd_entry::_tid
private

The documentation for this class was generated from the following files: