ngc 1.4.0
 
Loading...
Searching...
No Matches
ngcdttIPC.hpp
Go to the documentation of this file.
1
7#ifndef ngcdttIPC_H
8#define ngcdttIPC_H
9
10
11#ifndef __cplusplus
12#error This is a C++ include file and cannot be used from plain C
13#endif
14
15/*
16 * System Headers
17 */
18#include <sys/ioctl.h>
19#include <sys/shm.h>
20#include <arpa/inet.h>
21
22/*
23 * IPC
24 */
25#include <ngc/core/ngcbSHM.hpp>
26
27/*
28 * Local Headers
29 */
31
37 int id;
38
40 void *mem;
41
43 ngcdtt_shm_t() {id = -1; mem = NULL;}
44};
45
50{
51public:
53 ngcdttIPC();
54
56 explicit ngcdttIPC(int n);
57
59 virtual ~ngcdttIPC();
60
62 int Configure(const char *name, int nx, int ny);
63
65 void Shutdown();
66
68 int IdxOut();
69
71 int IdxIn();
72
74 int Locked(int idx);
75
77 int Lock(int idx);
78
80 int TryLock(int idx);
81
83 int Unlock(int idx);
84
86 int Wait(int idx);
87
89 int Publish(int idx);
90
92 void Invalidate(int idx);
93
94protected:
95
96private:
98 void Init_();
99
100 /*
101 * Camera display interface
102 */
103
105 int endian_;
106
108 int idxIn_;
109
111 int idxOut_;
112
114 int init_;
115
116 /*
117 * Shared memory interface
118 */
119
121 int numBuf_;
122
124 ngcdtt_shm_t *shm_;
125
127 ngcbSHM *evt_;
128
130 int Sem_(int idx);
131
133 void Shutdown_();
134
135};
136
137#endif
Definition ngcbSHM.hpp:201
int Wait(int idx)
Wait until the image stored in frame[idx] is unlocked.
Definition ngcdttIPC.cpp:308
ngcdttIPC()
Constructor.
Definition ngcdttIPC.cpp:24
int Locked(int idx)
Check whether the image stored in frame[idx] is locked.
Definition ngcdttIPC.cpp:233
int Configure(const char *name, int nx, int ny)
Initialize/configure publisher.
Definition ngcdttIPC.cpp:66
virtual ~ngcdttIPC()
Destructor.
Definition ngcdttIPC.cpp:36
int IdxIn()
Return the buffer index to be used for next transfer.
Definition ngcdttIPC.cpp:229
int IdxOut()
Return actual display buffer index.
Definition ngcdttIPC.cpp:231
void Shutdown()
Shutdown call-back.
Definition ngcdttIPC.cpp:227
int TryLock()
Try to lock current frame bbuffer.
Definition ngcdttPUBLISH.cpp:105
int Lock()
Lock current frame buffer.
Definition ngcdttPUBLISH.cpp:107
void Invalidate()
Invalidate current frame buffer.
Definition ngcdttPUBLISH.cpp:111
int Unlock()
Unlock current frame buffer.
Definition ngcdttPUBLISH.cpp:109
ngcdttPUBLISH()
Constructor.
Definition ngcdttPUBLISH.cpp:22
int Publish()
Publish current frame buffer.
Definition ngcdttPUBLISH.cpp:103
Definition ngcdttIPC.hpp:35
int id
Shared memory id.
Definition ngcdttIPC.hpp:37
ngcdtt_shm_t()
Constructor.
Definition ngcdttIPC.hpp:43
void * mem
Shared memory buffer.
Definition ngcdttIPC.hpp:40