File: SharedMemoryBlock.h

package info (click to toggle)
bullet 2.83.7%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 48,772 kB
  • sloc: cpp: 355,312; lisp: 12,087; ansic: 11,969; python: 644; makefile: 116; xml: 27
file content (55 lines) | stat: -rw-r--r-- 1,707 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef SHARED_MEMORY_BLOCK_H
#define SHARED_MEMORY_BLOCK_H

#define SHARED_MEMORY_MAGIC_NUMBER 64738
#define SHARED_MEMORY_MAX_COMMANDS 4
#define SHARED_MEMORY_MAX_STREAM_CHUNK_SIZE (256*1024)

#include "SharedMemoryCommands.h"

struct SharedMemoryBlock
{
	int m_magicId;
	struct SharedMemoryCommand m_clientCommands[SHARED_MEMORY_MAX_COMMANDS];
	struct SharedMemoryStatus m_serverCommands[SHARED_MEMORY_MAX_COMMANDS];

	int m_numClientCommands;
	int m_numProcessedClientCommands;

	int m_numServerCommands;
	int m_numProcessedServerCommands;

	//m_bulletStreamDataClientToServer is a way for the client to create collision shapes, rigid bodies and constraints
	//the Bullet data structures are more general purpose than the capabilities of a URDF file.
	char    m_bulletStreamDataClientToServer[SHARED_MEMORY_MAX_STREAM_CHUNK_SIZE];

	//m_bulletStreamDataServerToClient is used to send (debug) data from server to client, for
	//example to provide all details of a multibody including joint/link names, after loading a URDF file.
	char    m_bulletStreamDataServerToClientRefactor[SHARED_MEMORY_MAX_STREAM_CHUNK_SIZE];
};




//http://stackoverflow.com/questions/24736304/unable-to-use-inline-in-declaration-get-error-c2054
#ifdef _WIN32
__inline
#else
inline
#endif
void     InitSharedMemoryBlock(struct SharedMemoryBlock* sharedMemoryBlock)
{
    sharedMemoryBlock->m_numClientCommands = 0;
    sharedMemoryBlock->m_numServerCommands = 0;
    sharedMemoryBlock->m_numProcessedClientCommands=0;
    sharedMemoryBlock->m_numProcessedServerCommands=0;
    sharedMemoryBlock->m_magicId = SHARED_MEMORY_MAGIC_NUMBER;
}

#define SHARED_MEMORY_SIZE sizeof(SharedMemoryBlock)




#endif //SHARED_MEMORY_BLOCK_H