ldas-tools-framecpp 3.0.4
Loading...
Searching...
No Matches
FrameCPP::Common::DynamicMemoryBufferT< BT > Class Template Referenceabstract

Buffer appropriate for caching frame data. More...

#include <DynamicMemoryBuffer.hh>

Inheritance diagram for FrameCPP::Common::DynamicMemoryBufferT< BT >:
Collaboration diagram for FrameCPP::Common::DynamicMemoryBufferT< BT >:

Public Types

typedef INT_8U size_type
 type for number of bytes to read and size of buffer
typedef INT_8U size_type
 type for number of bytes to read and size of buffer

Public Member Functions

 DynamicMemoryBufferT (bool ParentAutoDelete=true)
 Default constructor.
virtual ~DynamicMemoryBufferT ()
 Destructor.
virtual void NextBlock (const char *Buffer, size_type Size)
 Add a buffer to the frame file memory image.
virtual void Reset ()
 Initialize buffer to accumulate a frame file.
 DynamicMemoryBufferT (bool ParentAutoDelete=true)
 Default constructor.
virtual ~DynamicMemoryBufferT ()
 Destructor.
virtual void NextBlock (const char *Buffer, size_type Size)
 Add a buffer to the frame file memory image.
virtual void Reset ()
 Initialize buffer to accumulate a frame file.
bool FilterInternally () const
 Returns true if filtering happens internally; false otherwise.
virtual void FilterAdd (FrameCPP::Common::StreamFilter *Filter)
 Adds a filter to the stream.
virtual void FilterAdd (FrameCPP::Common::StreamFilter *Filter)
 Adds a filter to the stream.
virtual void FilterRemove (FrameCPP::Common::StreamFilter *Filter)
 Removes a filter from the stream.
virtual void FilterRemove (FrameCPP::Common::StreamFilter *Filter)
 Removes a filter from the stream.
const std::string & BufferId () const
 Retrieve the string identification of the buffer.
const std::string & BufferId () const
 Retrieve the string identification of the buffer.
delta_t_type DeltaT () const
 Retrieve the duration of the stream.
delta_t_type DeltaT () const
 Retrieve the duration of the stream.
size_type NextBlockSize () const
 Return the number of bytes to be made available.
size_type NextBlockSize () const
 Return the number of bytes to be made available.
size_type Position () const
 Return the current position in the stream being scanned.
size_type Position () const
 Return the current position in the stream being scanned.
bool Ready () const
 Check if a complete frame file is ready for processing.
bool Ready () const
 Check if a complete frame file is ready for processing.
start_time_type StartTime () const
 Retrieve the start time of the stream.
start_time_type StartTime () const
 Retrieve the start time of the stream.

Static Public Attributes

static const buffer_size_type M_BUFFER_SIZE_DEFAULT = 256 * 1024
 The default size for buffered input and output.

Protected Types

typedef std::list< FrameCPP::Common::StreamFilter * > filters_type
 Type specifying the container holding the active filters.
typedef std::list< FrameCPP::Common::StreamFilter * > filters_type
 Type specifying the container holding the active filters.

Protected Member Functions

virtual MemoryBufferTsetbuf (char_type *S, std::streamsize N)
 Routine to register if the caller has specified a buffer.
virtual void buffer ()
 Initialization of the buffer.

Protected Attributes

filters_type m_filters
 Container holding all active filters.

Detailed Description

template<typename BT = std::stringbuf>
class FrameCPP::Common::DynamicMemoryBufferT< BT >

Buffer appropriate for caching frame data.

If the buffer is for input, then the buffer needs to be initialized with the contents. The initialization needs to be done as via by reading chuncks of data and having the class stitch them together until a complete frame file object is available for processing.

//---------------------------------------------------------------
// The following example uses input from a file to show how
// chuncks of data would be requested and then supplied
// to the class for inclussion in the in memory frame file
// stream.
//===============================================================
// Make sure that everything is reset to the initial conditions
//---------------------------------------------------------------
mb.Reset( );
boost::scoped_array read_buffer;
DynamicMemoryBuffer::size_type read_buffer_size = 0;
std::ifstream s;
s.open( filename.c_str( ) );
//---------------------------------------------------------------
// Keep looping till we are informed that a complete frame file
// image is ready for processing
//---------------------------------------------------------------
while ( ! mb.Ready( ) )
{
//-------------------------------------------------------------
// Request the number of bytes upon which to wait
//-------------------------------------------------------------
read_size = mb.NextBlockSize( );
//-------------------------------------------------------------
// Make sure the buffer which hold the temporary results is
// large enough for the results.
//-------------------------------------------------------------
if ( read_buffer_size < read_size )
{
read_buffer.reset( new char[ read_size ] );
read_buffer_size = read_size;
}
//-------------------------------------------------------------
// Read the requested number of bytes, blocking if need be
//-------------------------------------------------------------
s.read( read_buffer.get( ), read_size );
//-------------------------------------------------------------
// Send them off for processing
//-------------------------------------------------------------
mb.NextBlock( read_buffer.get( ), read_size );
}
s.close( );
INT_8U size_type
type for number of bytes to read and size of buffer
Definition FrameBufferInterface.hh:95

Constructor & Destructor Documentation

◆ DynamicMemoryBufferT() [1/2]

template<typename BT>
FrameCPP::Common::DynamicMemoryBufferT< BT >::DynamicMemoryBufferT ( bool ParentAutoDelete = true)

Default constructor.

Parameters
[in]ParentAutoDeleteTrue if dynamic memory associated with the temporary buffer should be release once this object goes out of scope.
Returns
A new class instance.

The default constructor will initialize all the parts used in the general case.

◆ ~DynamicMemoryBufferT()

template<typename BT>
FrameCPP::Common::DynamicMemoryBufferT< BT >::~DynamicMemoryBufferT ( )
virtual

Destructor.

Be careful to release all the resources that were created for this object.

◆ DynamicMemoryBufferT() [2/2]

template<typename BT = std::stringbuf>
FrameCPP::Common::DynamicMemoryBufferT< BT >::DynamicMemoryBufferT ( bool ParentAutoDelete = true)

Default constructor.

Parameters
[in]ParentAutoDeleteTrue if dynamic memory associated with the temporary buffer should be release once this object goes out of scope.
Returns
A new class instance.

Member Function Documentation

◆ BufferId() [1/2]

const std::string & FrameCPP::Common::FrameBufferInterface::BufferId ( ) const
inlineinherited

Retrieve the string identification of the buffer.

Returns
An identifier associated with the open buffer.

◆ BufferId() [2/2]

const std::string & FrameCPP::Common::FrameBufferInterface::BufferId ( ) const
inherited

Retrieve the string identification of the buffer.

Returns
An identifier associated with the open buffer.

◆ FilterAdd() [1/2]

void FrameCPP::Common::FrameBufferInterface::FilterAdd ( FrameCPP::Common::StreamFilter * Filter)
virtualinherited

Adds a filter to the stream.

Parameters
[in]FilterFilter function to add to the stream

◆ FilterAdd() [2/2]

virtual void FrameCPP::Common::FrameBufferInterface::FilterAdd ( FrameCPP::Common::StreamFilter * Filter)
virtualinherited

Adds a filter to the stream.

Parameters
[in]FilterFilter function to add to the stream

◆ FilterInternally()

bool FrameCPP::Common::MemoryBufferT< std::stringbuf >::FilterInternally ( ) const
inherited

Returns true if filtering happens internally; false otherwise.

Filtering currently is not optimized at the this layer so this method will always return false.

◆ FilterRemove() [1/2]

void FrameCPP::Common::FrameBufferInterface::FilterRemove ( FrameCPP::Common::StreamFilter * Filter)
virtualinherited

Removes a filter from the stream.

Parameters
[in]FilterFilter function to remove from the stream

◆ FilterRemove() [2/2]

virtual void FrameCPP::Common::FrameBufferInterface::FilterRemove ( FrameCPP::Common::StreamFilter * Filter)
virtualinherited

Removes a filter from the stream.

Parameters
[in]FilterFilter function to remove from the stream

◆ NextBlock() [1/2]

template<typename BT>
void FrameCPP::Common::DynamicMemoryBufferT< BT >::NextBlock ( const char * Buffer,
size_type Size )
virtual

Add a buffer to the frame file memory image.

Parameters
[in]BufferThe buffer to scan
[in]SizeThe number of bytes in Buffer

Reimplemented from FrameCPP::Common::FrameBufferInterface::Scanner.

◆ NextBlock() [2/2]

template<typename BT = std::stringbuf>
virtual void FrameCPP::Common::DynamicMemoryBufferT< BT >::NextBlock ( const char * Buffer,
size_type Size )
virtual

Add a buffer to the frame file memory image.

Parameters
[in]BufferThe buffer to scan
[in]SizeThe number of bytes in Buffer

Reimplemented from FrameCPP::Common::FrameBufferInterface::Scanner.


The documentation for this class was generated from the following files:
  • /home/abuild/rpmbuild/BUILD/ldas-tools-framecpp-3.0.4-build/ldas-tools-framecpp-3.0.4/build/include/framecpp/Common/DynamicMemoryBuffer.hh
  • /home/abuild/rpmbuild/BUILD/ldas-tools-framecpp-3.0.4-build/ldas-tools-framecpp-3.0.4/src/Common/DynamicMemoryBuffer.hh
  • /home/abuild/rpmbuild/BUILD/ldas-tools-framecpp-3.0.4-build/ldas-tools-framecpp-3.0.4/src/Common/DynamicMemoryBuffer.cc