#include <ngcdcsSHM.hpp>
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. | |
NGC shared memory interface class
| ngcdcsSHM::ngcdcsSHM | ( | ) |
Constructor.
|
explicit |
Constructor with watchdog.
| ngcdcsSHM::ngcdcsSHM | ( | FILE * | wd, |
| int | n ) |
Constructor with number of buffers.
| ngcdcsSHM::ngcdcsSHM | ( | FILE * | wd, |
| const char * | s ) |
Constructor with name.
| ngcdcsSHM::ngcdcsSHM | ( | FILE * | wd, |
| const char * | s, | ||
| int | n ) |
Constructor with name and number of buffers.
|
virtual |
|
virtual |
Allocate shared memory area.
Reimplemented in ngcdcsSHM_IPC.
| void * ngcdcsSHM::Buffer | ( | int | noWait = 1 | ) |
Get pointer to current buffer.
|
protectedvirtual |
Lock buffer[idx].
Reimplemented in ngcdcsSHM_IPC.
|
protectedvirtual |
Check if buffer[idx] is locked.
Reimplemented in ngcdcsSHM_IPC.
|
protectedvirtual |
Try to lock buffer[idx].
Reimplemented in ngcdcsSHM_IPC.
|
inlineprotectedvirtual |
Unlock buffer.
Reimplemented in ngcdcsSHM_IPC.
|
protectedvirtual |
Wait for buffer[idx].
Reimplemented in ngcdcsSHM_IPC.
|
inline |
Error message.
| int ngcdcsSHM::Export | ( | const ngcdcs_finfo_t & | finfo, |
| int | endian ) |
Update the current buffer and switch to the next item.
|
virtual |
Release allocated resources.
Reimplemented in ngcdcsSHM_IPC.
|
inline |
Check if initialization was OK.
|
inlineprotected |
Set initialization flag.
|
inlineprotected |
Invalidate buffers.
|
inlineprotectedvirtual |
Invalidate last event.
Reimplemented in ngcdcsSHM_IPC.
| int ngcdcsSHM::Locked | ( | ) |
Check if next buffer is locked.
| int ngcdcsSHM::LockNext | ( | int | noWait = 1 | ) |
Lock next buffer.
| void ngcdcsSHM::Next | ( | ) |
Switch to the next buffer.
|
inline |
Return number of buffers.
| int ngcdcsSHM::NumBuf | ( | int | n | ) |
Set number of buffers.
|
protectedvirtual |
Publish buffer.
Reimplemented in ngcdcsSHM_IPC.
|
inlineprotected |
Reset buffer index.
|
virtual |
Set new interface name.
Reimplemented in ngcdcsSHM_IPC.
| int ngcdcsSHM::TryWait | ( | ) |
Return zero when current buffer is not locked.
| void ngcdcsSHM::Unlock | ( | int | noWait | ) |
Unlock resources.
| int ngcdcsSHM::Update | ( | const ngcdcs_finfo_t & | finfo, |
| int | endian, | ||
| int | fullFrame = 0 ) |
Update the current buffer.
| void ngcdcsSHM::Wait | ( | ) |
Wait until current buffer is unlocked.
|
protected |
Pointers to shared memory buffers.
|
protected |
Buffer size.
| char ngcdcsSHM::name[64] |
Interface name for attachment.
| void* ngcdcsSHM::spare |
Spare buffer.
|
protected |
This host.
| char ngcdcsSHM::type[64] |
Interface type.
|
protected |
Watchdog stream.