ngc 1.5.0
 
Loading...
Searching...
No Matches
ngcdcsSHM Class Reference

#include <ngcdcsSHM.hpp>

Inheritance diagram for ngcdcsSHM:
ngcdcsSHM_IPC

Public Member Functions

 ngcdcsSHM ()
 Constructor.
 
 ngcdcsSHM (FILE *wd)
 Constructor with watchdog.
 
 ngcdcsSHM (FILE *wd, int n)
 Constructor with number of buffers.
 
 ngcdcsSHM (FILE *wd, const char *s)
 Constructor with name.
 
 ngcdcsSHM (FILE *wd, const char *s, int n)
 Constructor with name and number of buffers.
 
virtual ~ngcdcsSHM ()
 
int Initialized ()
 Check if initialization was OK.
 
char * ErrMsg ()
 Error message.
 
int NumBuf (int n)
 Set number of buffers.
 
int NumBuf ()
 Return number of buffers.
 
void * Buffer (int noWait=1)
 Get pointer to current buffer.
 
int Update (const ngcdcs_finfo_t &finfo, int endian, int fullFrame=0)
 Update the current buffer.
 
void Next ()
 Switch to the next buffer.
 
int Export (const ngcdcs_finfo_t &finfo, int endian)
 Update the current buffer and switch to the next item.
 
void Wait ()
 Wait until current buffer is unlocked.
 
int TryWait ()
 Return zero when current buffer is not locked.
 
int Locked ()
 Check if next buffer is locked.
 
int LockNext (int noWait=1)
 Lock next buffer.
 
void Unlock (int noWait)
 Unlock resources.
 
virtual void * Alloc (size_t size)
 Allocate shared memory area.
 
virtual void Free ()
 Release allocated resources.
 
virtual int SetName (const char *newName)
 Set new interface name.
 

Public Attributes

char name [64]
 Interface name for attachment.
 
char type [64]
 Interface type.
 
void * spare
 Spare buffer.
 

Protected Member Functions

void Initialized (int flag)
 Set initialization flag.
 
void Reset ()
 Reset buffer index.
 
void InvalidateBuffers ()
 Invalidate buffers.
 
virtual void InvalidateEvent ()
 Invalidate last event.
 
virtual void BufferWait (int idx)
 Wait for buffer[idx].
 
virtual int BufferLocked (int idx)
 Check if buffer[idx] is locked.
 
virtual int BufferLock (int idx)
 Lock buffer[idx].
 
virtual int BufferTryLock (int idx)
 Try to lock buffer[idx].
 
virtual void BufferUnlock (int idx)
 Unlock buffer.
 
virtual int Publish (int idx, const ngcdcs_finfo_t &finfo, int endian, int fullFrame)
 Publish buffer.
 

Protected Attributes

FILE * watchdog
 Watchdog stream.
 
void ** buffer
 Pointers to shared memory buffers.
 
size_t bufferSize
 Buffer size.
 
char thisHost [46]
 This host.
 

Detailed Description

NGC shared memory interface class

Constructor & Destructor Documentation

◆ ngcdcsSHM() [1/5]

ngcdcsSHM::ngcdcsSHM ( )

Constructor.

◆ ngcdcsSHM() [2/5]

ngcdcsSHM::ngcdcsSHM ( FILE * wd)
explicit

Constructor with watchdog.

◆ ngcdcsSHM() [3/5]

ngcdcsSHM::ngcdcsSHM ( FILE * wd,
int n )

Constructor with number of buffers.

◆ ngcdcsSHM() [4/5]

ngcdcsSHM::ngcdcsSHM ( FILE * wd,
const char * s )

Constructor with name.

◆ ngcdcsSHM() [5/5]

ngcdcsSHM::ngcdcsSHM ( FILE * wd,
const char * s,
int n )

Constructor with name and number of buffers.

◆ ~ngcdcsSHM()

ngcdcsSHM::~ngcdcsSHM ( )
virtual

Member Function Documentation

◆ Alloc()

void * ngcdcsSHM::Alloc ( size_t size)
virtual

Allocate shared memory area.

Reimplemented in ngcdcsSHM_IPC.

◆ Buffer()

void * ngcdcsSHM::Buffer ( int noWait = 1)

Get pointer to current buffer.

◆ BufferLock()

int ngcdcsSHM::BufferLock ( int idx)
protectedvirtual

Lock buffer[idx].

Reimplemented in ngcdcsSHM_IPC.

◆ BufferLocked()

int ngcdcsSHM::BufferLocked ( int idx)
protectedvirtual

Check if buffer[idx] is locked.

Reimplemented in ngcdcsSHM_IPC.

◆ BufferTryLock()

int ngcdcsSHM::BufferTryLock ( int idx)
protectedvirtual

Try to lock buffer[idx].

Reimplemented in ngcdcsSHM_IPC.

◆ BufferUnlock()

virtual void ngcdcsSHM::BufferUnlock ( int idx)
inlineprotectedvirtual

Unlock buffer.

Reimplemented in ngcdcsSHM_IPC.

◆ BufferWait()

void ngcdcsSHM::BufferWait ( int idx)
protectedvirtual

Wait for buffer[idx].

Reimplemented in ngcdcsSHM_IPC.

◆ ErrMsg()

char * ngcdcsSHM::ErrMsg ( )
inline

Error message.

◆ Export()

int ngcdcsSHM::Export ( const ngcdcs_finfo_t & finfo,
int endian )

Update the current buffer and switch to the next item.

◆ Free()

void ngcdcsSHM::Free ( )
virtual

Release allocated resources.

Reimplemented in ngcdcsSHM_IPC.

◆ Initialized() [1/2]

int ngcdcsSHM::Initialized ( )
inline

Check if initialization was OK.

◆ Initialized() [2/2]

void ngcdcsSHM::Initialized ( int flag)
inlineprotected

Set initialization flag.

◆ InvalidateBuffers()

void ngcdcsSHM::InvalidateBuffers ( )
inlineprotected

Invalidate buffers.

◆ InvalidateEvent()

virtual void ngcdcsSHM::InvalidateEvent ( )
inlineprotectedvirtual

Invalidate last event.

Reimplemented in ngcdcsSHM_IPC.

◆ Locked()

int ngcdcsSHM::Locked ( )

Check if next buffer is locked.

◆ LockNext()

int ngcdcsSHM::LockNext ( int noWait = 1)

Lock next buffer.

◆ Next()

void ngcdcsSHM::Next ( )

Switch to the next buffer.

◆ NumBuf() [1/2]

int ngcdcsSHM::NumBuf ( )
inline

Return number of buffers.

◆ NumBuf() [2/2]

int ngcdcsSHM::NumBuf ( int n)

Set number of buffers.

◆ Publish()

int ngcdcsSHM::Publish ( int idx,
const ngcdcs_finfo_t & finfo,
int endian,
int fullFrame )
protectedvirtual

Publish buffer.

Reimplemented in ngcdcsSHM_IPC.

◆ Reset()

void ngcdcsSHM::Reset ( )
inlineprotected

Reset buffer index.

◆ SetName()

int ngcdcsSHM::SetName ( const char * newName)
virtual

Set new interface name.

Reimplemented in ngcdcsSHM_IPC.

◆ TryWait()

int ngcdcsSHM::TryWait ( )

Return zero when current buffer is not locked.

◆ Unlock()

void ngcdcsSHM::Unlock ( int noWait)

Unlock resources.

◆ Update()

int ngcdcsSHM::Update ( const ngcdcs_finfo_t & finfo,
int endian,
int fullFrame = 0 )

Update the current buffer.

◆ Wait()

void ngcdcsSHM::Wait ( )

Wait until current buffer is unlocked.

Member Data Documentation

◆ buffer

void** ngcdcsSHM::buffer
protected

Pointers to shared memory buffers.

◆ bufferSize

size_t ngcdcsSHM::bufferSize
protected

Buffer size.

◆ name

char ngcdcsSHM::name[64]

Interface name for attachment.

◆ spare

void* ngcdcsSHM::spare

Spare buffer.

◆ thisHost

char ngcdcsSHM::thisHost[46]
protected

This host.

◆ type

char ngcdcsSHM::type[64]

Interface type.

◆ watchdog

FILE* ngcdcsSHM::watchdog
protected

Watchdog stream.


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