Scope
scope::ScopeImage< T > Class Template Reference

#include <ScopeImage.h>

Public Types

typedef std::pair< typename std::vector< T >::iterator, typename std::vector< T >::iterator > datapart_t
 
typedef std::vector< T >::const_iterator citerator
 
typedef std::vector< T >::size_type size_type
 

Public Member Functions

 ScopeImage (const uint32_t &_lines=128, const uint32_t &_linewidth=128, const uint32_t &_area=0, const bool &_complete_avg=false, const bool &_complete_frame=false)
 
 ScopeImage (const ScopeImage &_si)
 
ScopeImageoperator= (const ScopeImage &_si)
 
Pixel (const uint32_t &_column, const uint32_t &_line) const
 
void FillRandom ()
 
Several accessor methods
uint32_t Area () const
 
uint32_t Lines () const
 
uint32_t Linewidth () const
 
datapart_t Newpart () const
 
bool IsCompleteFrame () const
 
double PercentComplete () const
 
bool IsCompleteAvg () const
 
Mutator methods
void SetCompleteFrame (const bool &_complete)
 
void SetPercentComplete (const double &_percent)
 
void SetCompleteAvg (const bool &_complete)
 

Protected Member Functions

std::vector< T > * GetData ()
 
const std::vector< T > * GetDataConst () const
 
void ReleaseData ()
 
void ReleaseDataConst () const
 

Protected Attributes

const uint32_t area
 
uint32_t lines
 
uint32_t linewidth
 
bool complete_frame
 
bool complete_avg
 
double percent_complete
 
std::vector< T > data
 
std::vector< T >::iterator inserter
 
datapart_t newpart
 
std::mutex pixelmutex
 
std::atomic< int16_t > reading_access
 
std::condition_variable readcond
 

Private Attributes

friend ScopeImageAccess< T >
 
friend ScopeImageConstAccess< T >
 

Detailed Description

template<class T>
class scope::ScopeImage< T >

A general image class.

Templatized for data type, in Scope usually uint16_t. Data is in one vector data order is linewise:
1234
5678
9...
The can only be accessed via ScopeImageAccess and ScopeImageConstAccess.

Definition at line 23 of file ScopeImage.h.

Member Typedef Documentation

template<class T>
typedef std::pair<typename std::vector<T>::iterator, typename std::vector<T>::iterator> scope::ScopeImage< T >::datapart_t

pair of two iterators over the data vector

Definition at line 33 of file ScopeImage.h.

template<class T>
typedef std::vector<T>::const_iterator scope::ScopeImage< T >::citerator

const iterator over the data vector

Definition at line 36 of file ScopeImage.h.

template<class T>
typedef std::vector<T>::size_type scope::ScopeImage< T >::size_type

the size type

Definition at line 39 of file ScopeImage.h.

Constructor & Destructor Documentation

template<class T>
scope::ScopeImage< T >::ScopeImage ( const uint32_t &  _lines = 128,
const uint32_t &  _linewidth = 128,
const uint32_t &  _area = 0,
const bool &  _complete_avg = false,
const bool &  _complete_frame = false 
)
inline

Initialize with zeros.

Definition at line 80 of file ScopeImage.h.

template<class T>
scope::ScopeImage< T >::ScopeImage ( const ScopeImage< T > &  _si)
inline

Safe copy.

Inserter and newpart are not copied!

Definition at line 94 of file ScopeImage.h.

Member Function Documentation

template<class T>
ScopeImage& scope::ScopeImage< T >::operator= ( const ScopeImage< T > &  _si)
inline

Safe assignment.

Inserter and newpart are reset to data.begin()!

Definition at line 109 of file ScopeImage.h.

template<class T>
T scope::ScopeImage< T >::Pixel ( const uint32_t &  _column,
const uint32_t &  _line 
) const
inline
Returns
return the pixel at _column, _line

Definition at line 145 of file ScopeImage.h.

template<class T>
void scope::ScopeImage< T >::FillRandom ( )
inline

Fills the complete image with random pixel data.

Definition at line 151 of file ScopeImage.h.

template<class T>
std::vector<T>* scope::ScopeImage< T >::GetData ( )
inlineprotected
Returns
a pointer to the pixel vector
Postcondition
pixelmutex is locked

Definition at line 162 of file ScopeImage.h.

template<class T>
const std::vector<T>* scope::ScopeImage< T >::GetDataConst ( ) const
inlineprotected
Returns
a const pointer to the pixel vector. Increase reading_access counter

Definition at line 171 of file ScopeImage.h.

template<class T>
void scope::ScopeImage< T >::ReleaseData ( )
inlineprotected
Postcondition
pixelmutex is released from lock

Definition at line 179 of file ScopeImage.h.

template<class T>
void scope::ScopeImage< T >::ReleaseDataConst ( ) const
inlineprotected

Decreases reading_access counter.

Notifies waiting threads.

Definition at line 184 of file ScopeImage.h.

Member Data Documentation

template<class T>
friend scope::ScopeImage< T >::ScopeImageAccess< T >
private

give accessor classes friend access to the data

Definition at line 26 of file ScopeImage.h.

template<class T>
friend scope::ScopeImage< T >::ScopeImageConstAccess< T >
private

give accessor classes friend access to the data

Definition at line 29 of file ScopeImage.h.

template<class T>
const uint32_t scope::ScopeImage< T >::area
protected

area of the image

Definition at line 43 of file ScopeImage.h.

template<class T>
uint32_t scope::ScopeImage< T >::lines
protected

number of lines, y resolution

Definition at line 46 of file ScopeImage.h.

template<class T>
uint32_t scope::ScopeImage< T >::linewidth
protected

width of a line, x resolution

Definition at line 49 of file ScopeImage.h.

template<class T>
bool scope::ScopeImage< T >::complete_frame
protected

false if frame not complete, allows for partial display during acquisition

Definition at line 52 of file ScopeImage.h.

template<class T>
bool scope::ScopeImage< T >::complete_avg
protected

false if this is a not completely averaged frame, it is then only for display purpose and will not be stored

Definition at line 55 of file ScopeImage.h.

template<class T>
double scope::ScopeImage< T >::percent_complete
protected

how many percent of the frame are already filled

Definition at line 58 of file ScopeImage.h.

template<class T>
std::vector<T> scope::ScopeImage< T >::data
protected

vector with pixel data

Definition at line 61 of file ScopeImage.h.

template<class T>
std::vector<T>::iterator scope::ScopeImage< T >::inserter
protected

current insertion position

Definition at line 64 of file ScopeImage.h.

template<class T>
datapart_t scope::ScopeImage< T >::newpart
protected

range of freshly inserted pixels

Definition at line 67 of file ScopeImage.h.

template<class T>
std::mutex scope::ScopeImage< T >::pixelmutex
mutableprotected

mutex for protection of pixel operations

Definition at line 70 of file ScopeImage.h.

template<class T>
std::atomic<int16_t> scope::ScopeImage< T >::reading_access
mutableprotected

>0 if someone got a pointer to the const datavector

Definition at line 73 of file ScopeImage.h.

template<class T>
std::condition_variable scope::ScopeImage< T >::readcond
mutableprotected

condition variable for read access

Definition at line 76 of file ScopeImage.h.


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