Operator Console
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | List of all members
CriticalBuf Class Reference

a buffer class where all access (read or write) to the buffer is protected by critical sections More...

#include <CriticalBuf.h>

Inheritance diagram for CriticalBuf:
[legend]

Public Member Functions

 CriticalBuf (void)
 
 ~CriticalBuf (void)
 
void Get (void *buf)
 
void Set (void *buf)
 
bool Init (unsigned int bufLen)
 
 CriticalBuf (void)
 
 ~CriticalBuf (void)
 
void Get (void *buf)
 
void Set (void *buf)
 
bool Init (unsigned int bufLen)
 

Private Attributes

byte * m_buf
 pointer to the buffer More...
 
unsigned int m_bufLen
 length of m_buf in bytes More...
 

Detailed Description

a buffer class where all access (read or write) to the buffer is protected by critical sections

Constructor & Destructor Documentation

CriticalBuf::CriticalBuf ( void  )

References m_buf, and m_bufLen.

25 {
26  m_buf = NULL;
27  m_bufLen = 0;
28 }
unsigned int m_bufLen
length of m_buf in bytes
Definition: CriticalBuf.h:38
byte * m_buf
pointer to the buffer
Definition: CriticalBuf.h:37
CriticalBuf::~CriticalBuf ( void  )

References m_buf.

32 {
33  if (m_buf != NULL)
34  {
35  delete [] m_buf;
36  }
37 }
byte * m_buf
pointer to the buffer
Definition: CriticalBuf.h:37
CriticalBuf::CriticalBuf ( void  )
CriticalBuf::~CriticalBuf ( void  )

Member Function Documentation

void CriticalBuf::Get ( void *  buf)

References m_buf, and m_bufLen.

Referenced by ImageAcquisition::GetFrame().

60 {
61  if (buf != NULL)
62  {
63  Lock();
64 
65  if (m_buf != NULL)
66  {
67  memcpy(buf, m_buf, m_bufLen); // copy m_buf into buf (buf must be at least m_bufLen bytes)
68  }
69 
70  Unlock();
71  }
72 }
unsigned int m_bufLen
length of m_buf in bytes
Definition: CriticalBuf.h:38
byte * m_buf
pointer to the buffer
Definition: CriticalBuf.h:37

Here is the caller graph for this function:

void CriticalBuf::Get ( void *  buf)
bool CriticalBuf::Init ( unsigned int  bufLen)
bool CriticalBuf::Init ( unsigned int  bufLen)

References m_buf, and m_bufLen.

Referenced by ImageAcquisition::Init().

40 {
41  bool success;
42 
43  Lock();
44 
45  if (m_buf != NULL)
46  {
47  delete [] m_buf;
48  }
49 
50  m_bufLen = bufLen;
51  m_buf = new byte[m_bufLen];
52  success = m_buf != NULL;
53 
54  Unlock();
55 
56  return success;
57 }
unsigned int m_bufLen
length of m_buf in bytes
Definition: CriticalBuf.h:38
byte * m_buf
pointer to the buffer
Definition: CriticalBuf.h:37

Here is the caller graph for this function:

void CriticalBuf::Set ( void *  buf)

References m_buf, and m_bufLen.

Referenced by ImageAcquisition::ThreadProc().

75 {
76  if (buf != NULL)
77  {
78  Lock();
79 
80  if (m_buf != NULL)
81  {
82  memcpy(m_buf, buf, m_bufLen); // copy buf into m_buf
83  }
84 
85  Unlock();
86  }
87 }
unsigned int m_bufLen
length of m_buf in bytes
Definition: CriticalBuf.h:38
byte * m_buf
pointer to the buffer
Definition: CriticalBuf.h:37

Here is the caller graph for this function:

void CriticalBuf::Set ( void *  buf)

Member Data Documentation

byte * CriticalBuf::m_buf
private

pointer to the buffer

Referenced by CriticalBuf(), Get(), Init(), Set(), and ~CriticalBuf().

unsigned int CriticalBuf::m_bufLen
private

length of m_buf in bytes

Referenced by CriticalBuf(), Get(), Init(), and Set().


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