ESA JPIP server  0.1
place_holder.h
Go to the documentation of this file.
1 #ifndef _JPEG2000_PLACE_HOLDER_H_
2 #define _JPEG2000_PLACE_HOLDER_H_
3 
4 
5 #include "data/file_segment.h"
6 
7 
8 namespace jpeg2000
9 {
10 
11  using namespace data;
12 
13 
19  {
20  public:
21  int id;
22  bool is_jp2c;
24  uint64_t data_length;
25 
26 
31  {
32  id = 0;
33  is_jp2c = false;
34  data_length = 0;
35  }
36 
44  PlaceHolder(int id, bool is_jp2c, const FileSegment &header, uint64_t data_length)
45  {
46  this->id = id;
47  this->is_jp2c = is_jp2c;
48  this->header = header;
49  this->data_length = data_length;
50  }
51 
55  PlaceHolder(const PlaceHolder& place_holder)
56  {
57  *this = place_holder;
58  }
59 
60  template<typename T> T& SerializeWith(T& stream)
61  {
62  return (stream & id & is_jp2c & header & data_length);
63  }
64 
68  PlaceHolder& operator=(const PlaceHolder& place_holder)
69  {
70  id = place_holder.id;
71  is_jp2c = place_holder.is_jp2c;
72  header = place_holder.header;
73  data_length = place_holder.data_length;
74 
75  return *this;
76  }
77 
78  friend ostream& operator << (ostream &out, const PlaceHolder &place_holder)
79  {
80  out << "Id: " << place_holder.id << endl;
81  out << "JP2C: " << (place_holder.is_jp2c ? "Yes" : "No") << endl;
82  out << "Header: " << place_holder.header << endl;
83  out << "Data length: " << place_holder.data_length << endl;
84 
85  return out;
86  }
87 
91  int length() const
92  {
93  return (44 + header.length);
94  }
95 
96  virtual ~PlaceHolder()
97  {
98  }
99  };
100 
101 }
102 
103 
104 #endif /* _JPEG2000_PLACE_HOLDER_H_ */
PlaceHolder()
Initializes the object.
Definition: place_holder.h:30
bool is_jp2c
true if refers to a codestream.
Definition: place_holder.h:22
Contains a set of classes to easy the handling of data and files, as well as the serialization.
Definition: data.h:9
Identifies a data segment of a file.
Definition: file_segment.h:20
Contains the information of a place-holder.
Definition: place_holder.h:18
uint64_t data_length
Length of the place-holder data.
Definition: place_holder.h:24
PlaceHolder(const PlaceHolder &place_holder)
Copy constructor.
Definition: place_holder.h:55
int length() const
Returns the length of the place-holder.
Definition: place_holder.h:91
Set of classes for handling (reading and indexing) image files with the format defined in the Part 1 ...
Definition: codestream_index.h:10
PlaceHolder(int id, bool is_jp2c, const FileSegment &header, uint64_t data_length)
Initializes the object.
Definition: place_holder.h:44
T & SerializeWith(T &stream)
Definition: place_holder.h:60
virtual ~PlaceHolder()
Definition: place_holder.h:96
int id
Place-holder identifier.
Definition: place_holder.h:21
FileSegment header
File segment associated to the box header.
Definition: place_holder.h:23
PlaceHolder & operator=(const PlaceHolder &place_holder)
Copy assignment.
Definition: place_holder.h:68
ostream & operator<<(ostream &out, const Request &request)
Definition: request.cc:65
uint64_t length
Length of the data segment.
Definition: file_segment.h:24