cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Types | Protected Attributes | Friends | List of all members
vctPlot2DBase::Signal Class Reference

#include <vctPlot2DBase.h>

Public Member Functions

 Signal (const std::string &name, size_t numberOfPoints, size_t pointDimension=2)
 
 ~Signal ()
 
void CISST_DEPRECATED AddPoint (const vctDouble2 &point)
 
void AppendPoint (const vctDouble2 &point)
 
vctDouble2 GetPointAt (size_t index) throw (std::runtime_error)
 
void SetPointAt (size_t index, const vctDouble2 &point) throw (std::runtime_error)
 
void SetArrayAt (size_t index, const double *pointArray, size_t arraySize, size_t pointDimension=2) throw (std::runtime_error)
 
bool PrependArray (const double *pointArray, size_t arraySize, size_t pointDimension=2) throw (std::runtime_error)
 
bool AppendArray (const double *pointArray, size_t arraySize, size_t pointDimension=2) throw (std::runtime_error)
 
void Freeze (bool freeze)
 
bool GetFreeze (void) const
 
void CISST_DEPRECATED SetNumberOfPoints (size_t numberOfPoints)
 
void CISST_DEPRECATED GetNumberOfPoints (size_t &numberOfPoints, size_t &bufferSize) const
 
size_t GetSize (void) const
 
size_t GetNumberOfPoints (void) const
 
void SetColor (const vctDouble3 &colorInRange0To1)
 
void SetSize (size_t numberOfPoints)
 
bool IsVisible (void) const
 
void SetVisible (const bool visible)
 
void Resize (size_t numberOfPoints, bool trimOlder=true)
 
vctPlot2DBase::SignalAddSignal (const std::string &name)
 
vctPlot2DBase::ScaleGetParent (void)
 
const std::string & GetName (void) const
 
void ComputeDataRangeX (double &min, double &max, bool assumesDataSorted=false) const
 
void ComputeDataRangeY (double &min, double &max) const
 
void ComputeDataRangeXY (vctDouble2 &min, vctDouble2 &max) const
 

Protected Types

typedef vctFixedSizeVectorRef
< double, 2, 1 > 
PointRef
 

Protected Attributes

ScaleParent
 
std::string Name
 
bool Empty
 
bool Visible
 
bool Frozen
 
double * Buffer
 
size_t PointSize
 
vctDynamicVector< PointRefData
 
size_t IndexFirst
 
size_t IndexLast
 
vctDouble3 Color
 
double LineWidth
 

Friends

class vctPlot2DBase
 
class vctPlot2DBase::Scale
 
class vctPlot2DOpenGL
 
class vctPlot2DVTK
 

Detailed Description

Storage for a given signal. Each signal stores the data to display in a vector (vctDynamicVector) of points (vctDouble2). To prevent dynamic re-allocation, this class uses a "circular buffer".

Member Typedef Documentation

typedef vctFixedSizeVectorRef<double, 2, 1> vctPlot2DBase::Signal::PointRef
protected

Vector of references to the data to add, compute min/max, ...

Constructor & Destructor Documentation

vctPlot2DBase::Signal::Signal ( const std::string &  name,
size_t  numberOfPoints,
size_t  pointDimension = 2 
)
vctPlot2DBase::Signal::~Signal ( )

Member Function Documentation

void CISST_DEPRECATED vctPlot2DBase::Signal::AddPoint ( const vctDouble2 point)
vctPlot2DBase::Signal* vctPlot2DBase::Signal::AddSignal ( const std::string &  name)
bool vctPlot2DBase::Signal::AppendArray ( const double *  pointArray,
size_t  arraySize,
size_t  pointDimension = 2 
)
throw (std::runtime_error
)

Append user provided data at the end of the circular buffer. If the buffer is full or doesn't have enough free space, data will be overwritten at the beginning of buffer. This method will throw an exception if either the array size or index is invalid.

void vctPlot2DBase::Signal::AppendPoint ( const vctDouble2 point)

Insert point at last position and move last position forward. If the circular buffer is full, this methods overwrite the first element.

void vctPlot2DBase::Signal::ComputeDataRangeX ( double &  min,
double &  max,
bool  assumesDataSorted = false 
) const

Compute min and max over all points to recenter display. If the buffer contains no point, returns 0.

void vctPlot2DBase::Signal::ComputeDataRangeXY ( vctDouble2 min,
vctDouble2 max 
) const
void vctPlot2DBase::Signal::ComputeDataRangeY ( double &  min,
double &  max 
) const
void vctPlot2DBase::Signal::Freeze ( bool  freeze)
bool vctPlot2DBase::Signal::GetFreeze ( void  ) const
const std::string& vctPlot2DBase::Signal::GetName ( void  ) const
void CISST_DEPRECATED vctPlot2DBase::Signal::GetNumberOfPoints ( size_t &  numberOfPoints,
size_t &  bufferSize 
) const
size_t vctPlot2DBase::Signal::GetNumberOfPoints ( void  ) const

Get number of points.

vctPlot2DBase::Scale* vctPlot2DBase::Signal::GetParent ( void  )
vctDouble2 vctPlot2DBase::Signal::GetPointAt ( size_t  index)
throw (std::runtime_error
)

Get point value in the buffer relative to first element. This method will throw an std::runtime_error if the index is invalid, i.e. greater than the buffer size.

size_t vctPlot2DBase::Signal::GetSize ( void  ) const

Get size of circular buffer.

bool vctPlot2DBase::Signal::IsVisible ( void  ) const
bool vctPlot2DBase::Signal::PrependArray ( const double *  pointArray,
size_t  arraySize,
size_t  pointDimension = 2 
)
throw (std::runtime_error
)

Prepend user provided data at the beginning of the circular buffer. If the buffer is full or doesn't have enough free space, data will be overwritten at the end of buffer. This method will throw an exception if either the array size or index is invalid.

void vctPlot2DBase::Signal::Resize ( size_t  numberOfPoints,
bool  trimOlder = true 
)

Non destructive resize. If the new buffer is bigger, preserves all points. If the new buffer is smaller, preserves the data at the end by default.

void vctPlot2DBase::Signal::SetArrayAt ( size_t  index,
const double *  pointArray,
size_t  arraySize,
size_t  pointDimension = 2 
)
throw (std::runtime_error
)

Replaces "size" points data starting at "index". This methods assumes that the point size of the user provided buffer matches the internal buffer. If either the point size, index or size of user provided data is incorrect, an exception is thrown.

void vctPlot2DBase::Signal::SetColor ( const vctDouble3 colorInRange0To1)
void CISST_DEPRECATED vctPlot2DBase::Signal::SetNumberOfPoints ( size_t  numberOfPoints)
void vctPlot2DBase::Signal::SetPointAt ( size_t  index,
const vctDouble2 point 
)
throw (std::runtime_error
)

Set point value at a given position, relative to first element. This method will throw an std::runtime_error if the index is invalid, i.e. greater than the buffer size.

void vctPlot2DBase::Signal::SetSize ( size_t  numberOfPoints)

Destructive resize, this method resize the circular buffer and sets the first and last pointers to the buffer's beginning.

void vctPlot2DBase::Signal::SetVisible ( const bool  visible)

Friends And Related Function Documentation

friend class vctPlot2DBase
friend
friend class vctPlot2DBase::Scale
friend
friend class vctPlot2DOpenGL
friend
friend class vctPlot2DVTK
friend

Member Data Documentation

double* vctPlot2DBase::Signal::Buffer
protected

Actual buffer containing the data, contiguous for rendering

vctDouble3 vctPlot2DBase::Signal::Color
protected
vctDynamicVector<PointRef> vctPlot2DBase::Signal::Data
protected
bool vctPlot2DBase::Signal::Empty
protected
bool vctPlot2DBase::Signal::Frozen
protected
size_t vctPlot2DBase::Signal::IndexFirst
protected
size_t vctPlot2DBase::Signal::IndexLast
protected
double vctPlot2DBase::Signal::LineWidth
protected
std::string vctPlot2DBase::Signal::Name
protected

Signal name, used for GUI

Scale* vctPlot2DBase::Signal::Parent
protected
size_t vctPlot2DBase::Signal::PointSize
protected
bool vctPlot2DBase::Signal::Visible
protected

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