ESA JPIP server  0.1
data::FileSegment Class Reference

Identifies a data segment of a file. More...

#include <file_segment.h>

Collaboration diagram for data::FileSegment:

Public Member Functions

 FileSegment ()
 Initializes all the member variables with zero, being a null segment. More...
 
 FileSegment (uint64_t offset, uint64_t length)
 Initializes the segment with the given parameters. More...
 
 FileSegment (const FileSegment &segment)
 Copy constructor. More...
 
FileSegmentoperator= (const FileSegment &segment)
 Copy assignment. More...
 
FileSegmentRemoveFirst (int count)
 Removes the first bytes of the segment. More...
 
FileSegmentRemoveLast (int count)
 Removes the last bytes of the segment. More...
 
bool IsContiguousTo (const FileSegment &segment) const
 Returns true if the segment is contiguous to another given segment, so the first byte of the given segment is just the next byte after the last byte of the segment. More...
 
bool operator== (const FileSegment &segment) const
 
bool operator!= (const FileSegment &segment) const
 
template<typename T >
T & SerializeWith (T &stream)
 
virtual ~FileSegment ()
 

Public Attributes

uint64_t offset
 Offset of the data segment. More...
 
uint64_t length
 Length of the data segment. More...
 

Static Public Attributes

static const FileSegment Null
 Identifies a null segment, with the offset as well as the length set to zero. More...
 

Friends

ostream & operator<< (ostream &out, const FileSegment &segment)
 

Detailed Description

Identifies a data segment of a file.

This segment is defined by an offset and a length (number of bytes), both of them with an unsigned integer of 64 bits. This class is serializable and can be printed.

Constructor & Destructor Documentation

data::FileSegment::FileSegment ( )
inline

Initializes all the member variables with zero, being a null segment.

data::FileSegment::FileSegment ( uint64_t  offset,
uint64_t  length 
)
inline

Initializes the segment with the given parameters.

Parameters
offsetOffset of the segment.
lengthLength of the segment.
data::FileSegment::FileSegment ( const FileSegment segment)
inline

Copy constructor.

virtual data::FileSegment::~FileSegment ( )
inlinevirtual

Member Function Documentation

bool data::FileSegment::IsContiguousTo ( const FileSegment segment) const
inline

Returns true if the segment is contiguous to another given segment, so the first byte of the given segment is just the next byte after the last byte of the segment.

bool data::FileSegment::operator!= ( const FileSegment segment) const
inline
FileSegment& data::FileSegment::operator= ( const FileSegment segment)
inline

Copy assignment.

bool data::FileSegment::operator== ( const FileSegment segment) const
inline
FileSegment& data::FileSegment::RemoveFirst ( int  count)
inline

Removes the first bytes of the segment.

Modifies the segment as if a number of bytes (specified by the parameter) was removed from the beginning of the segment.

Parameters
countNumber of bytes to remove.
Returns
*this.

Here is the caller graph for this function:

FileSegment& data::FileSegment::RemoveLast ( int  count)
inline

Removes the last bytes of the segment.

Modifies the segment as if a number of bytes (specified by the parameter) was removed from the end of the segment.

Parameters
countNumber of bytes to remove.
Returns
*this.
template<typename T >
T& data::FileSegment::SerializeWith ( T &  stream)
inline

Friends And Related Function Documentation

ostream& operator<< ( ostream &  out,
const FileSegment segment 
)
friend

Member Data Documentation

uint64_t data::FileSegment::length

Length of the data segment.

const FileSegment data::FileSegment::Null
static

Identifies a null segment, with the offset as well as the length set to zero.

uint64_t data::FileSegment::offset

Offset of the data segment.


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