ESA JPIP server  0.1
codestream_index.h
Go to the documentation of this file.
1 #ifndef _JPEG2000_CODESTREAM_INDEX_H_
2 #define _JPEG2000_CODESTREAM_INDEX_H_
3 
4 
5 #include <vector>
6 #include "base.h"
7 #include "data/file_segment.h"
8 
9 
10 namespace jpeg2000
11 {
12  using namespace data;
13 
14 
26  {
27  public:
29  vector<FileSegment> packets;
30  vector<FileSegment> PLT_markers;
31 
32 
37  {
38  }
39 
44  {
45  *this = index;
46  }
47 
51  void Clear()
52  {
53  packets.clear();
54  PLT_markers.clear();
55  }
56 
61  {
62  header = index.header;
63  base::copy(packets, index.packets);
64  base::copy(PLT_markers, index.PLT_markers);
65 
66  return *this;
67  }
68 
69  template<typename T> T& SerializeWith(T& stream)
70  {
71  return (stream & header & packets & PLT_markers);
72  }
73 
74  friend ostream& operator << (ostream &out, const CodestreamIndex &index)
75  {
76  out << "Header: " << index.header << endl;
77 
78  out << "Packets: ";
79 
80  for(vector<FileSegment>::const_iterator i = index.packets.begin(); i != index.packets.end(); i++)
81  out << *i << " ";
82 
83  out << endl << "PLT-markers: ";
84 
85  for(vector<FileSegment>::const_iterator i = index.PLT_markers.begin(); i != index.PLT_markers.end(); i++)
86  out << *i << " ";
87 
88  out << endl;
89 
90  return out;
91  }
92 
93  virtual ~CodestreamIndex()
94  {
95  }
96  };
97 
98 }
99 
100 
101 #endif /* _JPEG2000_CODESTREAM_INDEX_H_ */
static void copy(std::vector< T > &dest, const std::vector< T > &src)
Copies a vector.
Definition: base.h:30
const CodestreamIndex & operator=(const CodestreamIndex &index)
Copy assignment.
Definition: codestream_index.h:60
Identifies a data segment of a file.
Definition: file_segment.h:20
FileSegment header
Main header segment.
Definition: codestream_index.h:28
CodestreamIndex()
Empty constructor.
Definition: codestream_index.h:36
T & SerializeWith(T &stream)
Definition: codestream_index.h:69
virtual ~CodestreamIndex()
Definition: codestream_index.h:93
void Clear()
Clears the information.
Definition: codestream_index.h:51
vector< FileSegment > PLT_markers
PLT markers segments.
Definition: codestream_index.h:30
Class used for indexing the information of a JPEG2000 codestream.
Definition: codestream_index.h:25
vector< FileSegment > packets
Tile-part packets segments.
Definition: codestream_index.h:29
ostream & operator<<(ostream &out, const Request &request)
Definition: request.cc:65
CodestreamIndex(const CodestreamIndex &index)
Copy constructor.
Definition: codestream_index.h:43