ngc 1.5.0
 
Loading...
Searching...
No Matches
ngcdttIPC.hpp
Go to the documentation of this file.
1
8#ifndef ngcdttIPC_H
9#define ngcdttIPC_H
10
11
12#ifndef __cplusplus
13#error This is a C++ include file and cannot be used from plain C
14#endif
15
16/*
17 * System Headers
18 */
19#include <sys/ioctl.h>
20#include <sys/shm.h>
21#include <arpa/inet.h>
22
23/*
24 * IPC
25 */
26#include <ngc/core/ngcbSHM.hpp>
27
28/*
29 * Local Headers
30 */
32
38 int id;
39
41 void *mem;
42
44 ngcdtt_shm_t() {id = -1; mem = NULL;}
45};
46
51{
52public:
54 ngcdttIPC();
55
57 explicit ngcdttIPC(int n);
58
60 virtual ~ngcdttIPC();
61
63 int Configure(const char *name, int nx, int ny);
64
66 void Shutdown();
67
69 int IdxOut();
70
72 int IdxIn();
73
75 int Locked(int idx);
76
78 int Lock(int idx);
79
81 int TryLock(int idx);
82
84 int Unlock(int idx);
85
87 int Wait(int idx);
88
90 int Publish(int idx);
91
93 void Invalidate(int idx);
94
95protected:
96
97private:
99 void Init_();
100
101 /*
102 * Camera display interface
103 */
104
106 int endian_;
107
109 int idxIn_;
110
112 int idxOut_;
113
115 int init_;
116
117 /*
118 * Shared memory interface
119 */
120
122 int numBuf_;
123
125 ngcdtt_shm_t *shm_;
126
128 ngcbSHM *evt_;
129
131 int Sem_(int idx);
132
134 void Shutdown_();
135
136};
137
138#endif
Definition ngcbSHM.hpp:202
int Wait(int idx)
Wait until the image stored in frame[idx] is unlocked.
Definition ngcdttIPC.cpp:309
ngcdttIPC()
Constructor.
Definition ngcdttIPC.cpp:25
int Locked(int idx)
Check whether the image stored in frame[idx] is locked.
Definition ngcdttIPC.cpp:234
int Configure(const char *name, int nx, int ny)
Initialize/configure publisher.
Definition ngcdttIPC.cpp:67
virtual ~ngcdttIPC()
Destructor.
Definition ngcdttIPC.cpp:37
int IdxIn()
Return the buffer index to be used for next transfer.
Definition ngcdttIPC.cpp:230
int IdxOut()
Return actual display buffer index.
Definition ngcdttIPC.cpp:232
void Shutdown()
Shutdown call-back.
Definition ngcdttIPC.cpp:228
int TryLock()
Try to lock current frame bbuffer.
Definition ngcdttPUBLISH.cpp:106
int Lock()
Lock current frame buffer.
Definition ngcdttPUBLISH.cpp:108
void Invalidate()
Invalidate current frame buffer.
Definition ngcdttPUBLISH.cpp:112
int Unlock()
Unlock current frame buffer.
Definition ngcdttPUBLISH.cpp:110
ngcdttPUBLISH()
Constructor.
Definition ngcdttPUBLISH.cpp:23
int Publish()
Publish current frame buffer.
Definition ngcdttPUBLISH.cpp:104
Definition ngcdttIPC.hpp:36
int id
Shared memory id.
Definition ngcdttIPC.hpp:38
ngcdtt_shm_t()
Constructor.
Definition ngcdttIPC.hpp:44
void * mem
Shared memory buffer.
Definition ngcdttIPC.hpp:41