blob: 74d4798b794150bf70fc08a43e3f823eebc1642d (
plain)
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
|
// $Id$
#ifndef SHMEM_H
#define SHMEM_H
// This is where you'll find the ACE_Shared_Memory_SV object
#include "ace/Shared_Memory_SV.h"
// SHMSZ is just enough for the alphabet and a null terminator
#define SHMSZ 27
// Play with this, pick a value you like that isn't used by something else.
#define SHM_KEY 4200
/*
This is what we stuff into shared memory via placement new in the
second client/server pair. Notice that it is a very basic object
with no virtual methods and only concrete data.
*/
class SharedData
{
public:
// Construct the object and optionally initialize buf_.
SharedData (int initialized = 1);
// Put some data into buf_
void set (void);
// Show the data in buf_
void show (void);
// What is the value of available_
int available (void);
// Set the value of available_
void available (int not_in_use);
protected:
// Big enough for a simple message
char buf_[128];
// A cheap mutex
int available_;
};
#endif /* SHMEM_H */
|