libpniio
Main Page
Modules
Namespaces
Data Structures
Files
File List
Globals
include
pni
io
tiff
ifd_entry_reader.hpp
Go to the documentation of this file.
1
//
2
// (c) Copyright 2011 DESY, Eugen Wintersberger <eugen.wintersberger@desy.de>
3
//
4
// This file is part of libpniio.
5
//
6
// libpniio is free software: you can redistribute it and/or modify
7
// it under the terms of the GNU General Public License as published by
8
// the Free Software Foundation, either version 2 of the License, or
9
// (at your option) any later version.
10
//
11
// libpniio 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
14
// GNU General Public License for more details.
15
//
16
// You should have received a copy of the GNU General Public License
17
// along with libpniio. If not, see <http://www.gnu.org/licenses/>.
18
// ===========================================================================
19
//
20
// Created on: Apr 26, 2012
21
// Author: Eugen Wintersberger <eugen.wintersberger@desy.de>
22
//
23
//
24
#pragma once
25
26
#include<iostream>
27
#include<fstream>
28
#include<vector>
29
30
#ifdef NOFOREACH
31
#include <boost/foreach.hpp>
32
#endif
33
34
#include <pni/core/types.hpp>
35
36
37
namespace
pni
{
38
namespace
io{
39
namespace
tiff{
40
48
template
<
typename
RTYPE,
typename
ETYPE>
class
ifd_entry_reader
49
{
50
public
:
63
static
void
read
(std::vector<RTYPE> &r,std::ifstream &stream);
64
};
65
66
//-------------------------------------------------------------------------
67
template
<
typename
RTYPE,
typename
ETYPE>
void
ifd_entry_reader<RTYPE,ETYPE>::
68
read
(std::vector<RTYPE> &r,std::ifstream &stream)
69
{
70
71
ETYPE buffer;
72
73
//check size of entire entry data
74
if
(
sizeof
(ETYPE)*r.size()>4){
75
//if the data does not fit into 4 Byte we interpret data as an
76
//offset and move the stream pointer to this new position
77
pni::core::int32 offset;
78
stream.read((
char
*)(&offset),4);
79
stream.seekg(offset,std::ios::beg);
80
}
81
82
//read the data
83
for
(RTYPE &value: r)
84
{
85
stream.read((
char
*)(&buffer),
sizeof
(ETYPE));
86
value = (RTYPE)(buffer);
87
}
88
89
}
90
91
//-------------------------------------------------------------------------
100
template
<>
class
ifd_entry_reader
<
pni
::core::string,pni::core::string>
101
{
102
public
:
104
static
void
read
(std::vector<pni::core::string> &r,std::ifstream &stream);
105
};
106
107
108
109
//end of namespace
110
}
111
}
112
}
113
114
115
116
pni
Definition:
cbf_reader.hpp:41
pni::io::tiff::ifd_entry_reader::read
static void read(std::vector< RTYPE > &r, std::ifstream &stream)
read entry data
Definition:
ifd_entry_reader.hpp:68
pni::io::tiff::ifd_entry_reader
IFD entry reader template.
Definition:
ifd_entry_reader.hpp:48
Generated on Mon Mar 13 2017 10:41:07 for libpniio by
1.8.8