NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
niftk::IGIDataSourceBuffer Class Reference

Manages a buffer of niftk::IGIDataType. More...

Inheritance diagram for niftk::IGIDataSourceBuffer:
Inheritance graph
[legend]
Collaboration diagram for niftk::IGIDataSourceBuffer:
Collaboration graph
[legend]

Classes

struct  TimeStampComparator
 

Public Types

typedef std::set
< niftk::IGIDataType::Pointer,
TimeStampComparator
BufferType
 

Public Member Functions

 mitkClassMacroItkParent (IGIDataSourceBuffer, itk::Object) mitkNewMacro1Param(IGIDataSourceBuffer
 
BufferType::size_type QString GetName () const
 
void SetName (QString name)
 
bool Contains (const niftk::IGIDataType::IGITimeType &time) const
 Returns true if the buffer already contains a data item with an exactly matching timestamp, false otherwise. More...
 
void AddToBuffer (niftk::IGIDataType::Pointer item)
 Adds an item to the buffer, which if the calling object deletes pointers, then the buffer is effectively the owner. More...
 
void DestroyBuffer ()
 Destroy all items in the buffer. More...
 
virtual void CleanBuffer ()
 Clears down the buffer, leaving behind a minimum size buffer. The deletion policy can be overriden by sub-classes. More...
 
void SetLagInMilliseconds (unsigned int milliseconds)
 Sets the lag in milliseconds. More...
 
unsigned int GetLagInMilliseconds () const
 Retrieves the lag value in milliseconds. More...
 
BufferType::size_type GetBufferSize () const
 Returns the number of items in the buffer. More...
 
niftk::IGIDataType::IGITimeType GetFirstTimeStamp () const
 Returns the time stamp of the first item in the buffer. More...
 
niftk::IGIDataType::IGITimeType GetLastTimeStamp () const
 Returns the time stamp of the last item in the buffer. More...
 
float GetFrameRate () const
 Returns the frame rate, in frames per second. More...
 
niftk::IGIDataType::Pointer GetItem (const niftk::IGIDataType::IGITimeType &time) const
 Gets the item from the buffer most closely before the specified time. More...
 

Protected Member Functions

 IGIDataSourceBuffer (BufferType::size_type minSize)
 
virtual ~IGIDataSourceBuffer ()
 
 IGIDataSourceBuffer (const IGIDataSourceBuffer &)
 
IGIDataSourceBufferoperator= (const IGIDataSourceBuffer &)
 

Protected Attributes

itk::FastMutexLock::Pointer m_Mutex
 
BufferType m_Buffer
 
BufferType::iterator m_BufferIterator
 
BufferType::size_type m_MinimumSize
 
QString m_Name
 

Detailed Description

Manages a buffer of niftk::IGIDataType.

Note: This class MUST be thread-safe.

Note: All errors should thrown as mitk::Exception or sub-classes thereof.

Member Typedef Documentation

typedef std::set<niftk::IGIDataType::Pointer, TimeStampComparator> niftk::IGIDataSourceBuffer::BufferType

Constructor & Destructor Documentation

niftk::IGIDataSourceBuffer::IGIDataSourceBuffer ( BufferType::size_type  minSize)
protected
niftk::IGIDataSourceBuffer::~IGIDataSourceBuffer ( )
protectedvirtual
niftk::IGIDataSourceBuffer::IGIDataSourceBuffer ( const IGIDataSourceBuffer )
protected

Member Function Documentation

void niftk::IGIDataSourceBuffer::AddToBuffer ( niftk::IGIDataType::Pointer  item)

Adds an item to the buffer, which if the calling object deletes pointers, then the buffer is effectively the owner.

This assumes the timestamp on the item is already correctly set.

void niftk::IGIDataSourceBuffer::CleanBuffer ( )
virtual

Clears down the buffer, leaving behind a minimum size buffer. The deletion policy can be overriden by sub-classes.

This class simply has a minimum number of items specified in the constructor, so the CleanBuffer method will never reduce the buffer size to less than this amount.

Reimplemented in niftk::IGIWaitForSavedDataSourceBuffer.

bool niftk::IGIDataSourceBuffer::Contains ( const niftk::IGIDataType::IGITimeType time) const

Returns true if the buffer already contains a data item with an exactly matching timestamp, false otherwise.

void niftk::IGIDataSourceBuffer::DestroyBuffer ( )

Destroy all items in the buffer.

If no items are in the buffer, this does nothing.

IGIDataSourceBuffer::BufferType::size_type niftk::IGIDataSourceBuffer::GetBufferSize ( ) const

Returns the number of items in the buffer.

niftk::IGIDataType::IGITimeType niftk::IGIDataSourceBuffer::GetFirstTimeStamp ( ) const

Returns the time stamp of the first item in the buffer.

Exceptions
mitk::Exceptionif the buffer is empty.
float niftk::IGIDataSourceBuffer::GetFrameRate ( ) const

Returns the frame rate, in frames per second.

niftk::IGIDataType::Pointer niftk::IGIDataSourceBuffer::GetItem ( const niftk::IGIDataType::IGITimeType time) const

Gets the item from the buffer most closely before the specified time.

If there are no items in the buffer, will return NULL. If the lag is specified, will ofset backwards in time and retrieve that item. If that item is not available, will also return NULL.

unsigned int niftk::IGIDataSourceBuffer::GetLagInMilliseconds ( ) const

Retrieves the lag value in milliseconds.

niftk::IGIDataType::IGITimeType niftk::IGIDataSourceBuffer::GetLastTimeStamp ( ) const

Returns the time stamp of the last item in the buffer.

Exceptions
mitk::Exceptionif the buffer is empty.
QString niftk::IGIDataSourceBuffer::GetName ( ) const
niftk::IGIDataSourceBuffer::mitkClassMacroItkParent ( IGIDataSourceBuffer  ,
itk::Object   
)
IGIDataSourceBuffer& niftk::IGIDataSourceBuffer::operator= ( const IGIDataSourceBuffer )
protected
void niftk::IGIDataSourceBuffer::SetLagInMilliseconds ( unsigned int  milliseconds)

Sets the lag in milliseconds.

void niftk::IGIDataSourceBuffer::SetName ( QString  name)

Member Data Documentation

BufferType niftk::IGIDataSourceBuffer::m_Buffer
protected
BufferType::iterator niftk::IGIDataSourceBuffer::m_BufferIterator
protected
BufferType::size_type niftk::IGIDataSourceBuffer::m_MinimumSize
protected
itk::FastMutexLock::Pointer niftk::IGIDataSourceBuffer::m_Mutex
protected
QString niftk::IGIDataSourceBuffer::m_Name
protected

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