1 #ifndef _JPIP_DATABIN_WRITER_H_
2 #define _JPIP_DATABIN_WRITER_H_
17 using namespace jpeg2000;
53 if((ptr +
sizeof(T)) >= end) eof =
true;
55 for (
int i =
sizeof(T) - 1; i >= 0; i--)
56 *ptr++ = (value >> (8 * i)) & 0xFF;
79 DataBinWriter& WriteHeader(uint64_t bin_id, uint64_t bin_offset,
80 uint64_t bin_length,
bool last_byte =
false);
91 prev_databin_class = -1;
92 prev_codestream_idx = -1;
93 ini = ptr = end = NULL;
120 prev_databin_class = -1;
121 prev_codestream_idx = -1;
133 if(value < 0) value = 0;
134 codestream_idx = value;
145 this->databin_class = databin_class;
161 bool last_byte =
false);
173 DataBinWriter& WritePlaceHolder(uint64_t bin_id, uint64_t bin_offset,
175 bool last_byte =
false);
207 if((ptr + 3) > end) eof =
true;
210 *ptr++ = (char)reason;
221 operator bool()
const
int GetFree() const
Returns the number of bytes available.
Definition: databin_writer.h:195
int databin_class
Current data-bin class.
Definition: databin_writer.h:40
DataBinWriter & ClearPreviousIds()
Clears the previous identifiers of data-bin class and codestream index numbers.
Definition: databin_writer.h:116
char * end
Pointer to the end of the buffer.
Definition: databin_writer.h:38
Identifies a data segment of a file.
Definition: file_segment.h:20
Class used to generate data-bin segments and write them into a memory buffer.
Definition: databin_writer.h:28
Contains the information of a place-holder.
Definition: place_holder.h:18
virtual ~DataBinWriter()
Definition: databin_writer.h:226
DataBinWriter & WriteEOR(int reason)
Writes a EOR message into the buffer.
Definition: databin_writer.h:205
int prev_codestream_idx
Previous codestream index number.
Definition: databin_writer.h:43
char * ptr
Current position of the buffer.
Definition: databin_writer.h:37
int prev_databin_class
Previous data-bin class.
Definition: databin_writer.h:42
bool eof
true if the end of the buffer has been reached and the last value could not be written.
Definition: databin_writer.h:35
DataBinWriter & SetDataBinClass(int databin_class)
Sets the current data-bin class.
Definition: databin_writer.h:143
DataBinWriter & SetCodestream(int value)
Sets the current codestream.
Definition: databin_writer.h:131
int GetCount() const
Returns the number of bytes written.
Definition: databin_writer.h:187
char * ini
Pointer to the beginning of the buffer.
Definition: databin_writer.h:36
DataBinWriter & WriteValue(T value)
Writes a value into the buffer.
Definition: databin_writer.h:50
int codestream_idx
Current codestream index number.
Definition: databin_writer.h:41
DataBinWriter()
Initializes the object.
Definition: databin_writer.h:86
DataBinWriter & SetBuffer(char *buf, int buf_len)
Sets the associated memory buffer.
Definition: databin_writer.h:102