36 #ifndef EVENTSHAREDMEMMANAGER_EVENTS_H
37 #define EVENTSHAREDMEMMANAGER_EVENTS_H
54 #include <QSharedMemory>
69 enum SharedMemoryMode { READ, WRITE, READWRITE };
72 namespace EVENTSINTERNAL {
181 void init(EVENTSLIB::SharedMemoryMode mode);
230 void attachToSharedSegment(QSharedMemory::AccessMode mode);
239 bool createSharedSegment(
int bufferSize, QSharedMemory::AccessMode mode);
245 void launchSharedMemoryWatcherThread();
252 void attachToOrCreateSharedSegment(QSharedMemory::AccessMode mode);
258 void stopSharedMemoryWatcherThread();
264 void detachFromSharedMemory();
271 inline static int generateId();
291 void printLocalBuffer();
298 void copyNewUpdateToSharedMemory(
EventUpdate& newUpdate);
304 void initializeSharedMemory();
310 void copySharedMemoryToLocalBuffer();
316 void processLocalBuffer();
322 void bufferWatcher();
328 void createGroupIfNeeded();
330 static int m_iLastUpdateIndex;
332 QSharedMemory m_SharedMemory;
333 std::atomic_bool m_IsInit;
334 std::string m_sGroupName;
335 bool m_bGroupCreated;
337 int m_SharedMemorySize;
338 int m_fTimerCheckBuffer;
339 std::thread m_BufferWatcherThread;
340 std::atomic_bool m_BufferWatcherThreadRunning;
341 std::atomic_bool m_WritingToSharedMemory;
342 long long m_lastCheckTime;
346 enum EVENTSLIB::SharedMemoryMode m_Mode;
354 inline int EventSharedMemManager::generateId()
362 #endif // EVENTSHAREDMEMMANAGER_EVENTS_H