ESA JPIP server  0.1
jpip::DataBinServer Class Reference

Contains the core functionality of a (JPIP) data-bin server, which maintains a cache model and is capable of generating data chunks of variable length;. More...

#include <databin_server.h>

Collaboration diagram for jpip::DataBinServer:

Public Member Functions

 DataBinServer ()
 Initializes the obect. More...
 
bool end_woi () const
 Returns true if the end of the WOI has been reached, that is, there is not more associated packets to send. More...
 
bool Reset (const ImageIndex::Ptr image_index)
 Resets the server assigning a new image to serve. More...
 
bool SetRequest (const Request &req)
 Sets the new current request to take into account for generating the chunks of data. More...
 
bool GenerateChunk (char *buff, int *len, bool *last)
 Generates a new chunk of data for the current image and WOI, according to the last indicated request. More...
 
virtual ~DataBinServer ()
 

Private Types

enum  { MINIMUM_SPACE = 60 }
 

Private Member Functions

template<int BIN_CLASS>
int WriteSegment (int num_codestream, int id, FileSegment segment, int offset=0, bool last=true)
 Writes a new data-bin segment or a part of it that is not already cached. More...
 
int WritePlaceHolder (int num_codestream, int id, const PlaceHolder &place_holder, int offset=0, bool last=false)
 Writes a new place-holder segment, only if it is possible to write it completely. More...
 

Private Attributes

WOI woi
 Current WOI. More...
 
int pending
 Number of pending bytes. More...
 
Range range
 Range of codestreams. More...
 
bool has_woi
 true if the last request contained a WOI More...
 
bool metareq
 true if the last request contained a "metareq" More...
 
bool end_woi_
 true if the WOI has been completely sent More...
 
File::Ptr file
 Pointer to the associated image file. More...
 
int current_idx
 Current codestream index. More...
 
bool eof
 true if the end has been reached and the last write operation could not be completed. More...
 
CacheModel cache_model
 Cache model of the client. More...
 
vector< File::Ptrfiles
 List of files (for hyperlinked JPX files) More...
 
WOIComposer woi_composer
 WOI composer for determining the packets. More...
 
ImageIndex::Ptr im_index
 Pointer to the associated image index. More...
 
DataBinWriter data_writer
 Data-bin writer for generating the chunks. More...
 

Detailed Description

Contains the core functionality of a (JPIP) data-bin server, which maintains a cache model and is capable of generating data chunks of variable length;.

Member Enumeration Documentation

anonymous enum
private
Enumerator
MINIMUM_SPACE 

Minimum space in the chunk.

Constructor & Destructor Documentation

jpip::DataBinServer::DataBinServer ( )
inline

Initializes the obect.

virtual jpip::DataBinServer::~DataBinServer ( )
inlinevirtual

Member Function Documentation

bool jpip::DataBinServer::end_woi ( ) const
inline

Returns true if the end of the WOI has been reached, that is, there is not more associated packets to send.

Here is the caller graph for this function:

bool jpip::DataBinServer::GenerateChunk ( char *  buff,
int *  len,
bool *  last 
)

Generates a new chunk of data for the current image and WOI, according to the last indicated request.

Parameters
buffPointer to the memory buffer.
lenLength of the memory buffer. It is modified by the method to indicate how many bytes have been written to the buffer.
lastOutput parameter to indicates if this is the last chunk of data associated to the last request.
Returns
true if successful.

Here is the call graph for this function:

Here is the caller graph for this function:

bool jpip::DataBinServer::Reset ( const ImageIndex::Ptr  image_index)

Resets the server assigning a new image to serve.

It also resets the maintained cache model.

Parameters
image_indexPointer to the new image index to use.
Returns
true if successful.

Here is the caller graph for this function:

bool jpip::DataBinServer::SetRequest ( const Request req)

Sets the new current request to take into account for generating the chunks of data.

Parameters
reqRequest.
Returns
true if successful.

Here is the call graph for this function:

Here is the caller graph for this function:

int jpip::DataBinServer::WritePlaceHolder ( int  num_codestream,
int  id,
const PlaceHolder place_holder,
int  offset = 0,
bool  last = false 
)
inlineprivate

Writes a new place-holder segment, only if it is possible to write it completely.

Parameters
num_codestreamIndex number of the codestream.
idData-bin identifier.
place_holderPlace-holder information.
offsetData-bin offset of the data (0 by default).
lasttrue if this is the last data of the data-bin.
Returns
1 if the segment content was completely written and/or cached, 0 if it was incompletely written (or not at all, if EOF flag is set), or -1 if an error was generated.

Here is the call graph for this function:

Here is the caller graph for this function:

template<int BIN_CLASS>
int jpip::DataBinServer::WriteSegment ( int  num_codestream,
int  id,
FileSegment  segment,
int  offset = 0,
bool  last = true 
)
inlineprivate

Writes a new data-bin segment or a part of it that is not already cached.

Parameters
num_codestreamIndex number of the codestream.
idData-bin identifier.
segmentFile segment associated.
offsetData-bin offset of the data (0 by default).
lasttrue if this is the last data of the data-bin.
Returns
1 if the segment content was completely written and/or cached, 0 if it was incompletely written (or not at all, if EOF flag is set), or -1 if an error was generated.

Here is the call graph for this function:

Member Data Documentation

CacheModel jpip::DataBinServer::cache_model
private

Cache model of the client.

int jpip::DataBinServer::current_idx
private

Current codestream index.

DataBinWriter jpip::DataBinServer::data_writer
private

Data-bin writer for generating the chunks.

bool jpip::DataBinServer::end_woi_
private

true if the WOI has been completely sent

bool jpip::DataBinServer::eof
private

true if the end has been reached and the last write operation could not be completed.

File::Ptr jpip::DataBinServer::file
private

Pointer to the associated image file.

vector<File::Ptr> jpip::DataBinServer::files
private

List of files (for hyperlinked JPX files)

bool jpip::DataBinServer::has_woi
private

true if the last request contained a WOI

ImageIndex::Ptr jpip::DataBinServer::im_index
private

Pointer to the associated image index.

bool jpip::DataBinServer::metareq
private

true if the last request contained a "metareq"

int jpip::DataBinServer::pending
private

Number of pending bytes.

Range jpip::DataBinServer::range
private

Range of codestreams.

WOI jpip::DataBinServer::woi
private

Current WOI.

WOIComposer jpip::DataBinServer::woi_composer
private

WOI composer for determining the packets.


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