1 | // %pacpus:license{
|
---|
2 | // This file is part of the PACPUS framework distributed under the
|
---|
3 | // CECILL-C License, Version 1.0.
|
---|
4 | // %pacpus:license}
|
---|
5 | /// @file
|
---|
6 | /// @author Firstname Surname <firstname.surname@utc.fr>
|
---|
7 | /// @date Month, Year
|
---|
8 | /// @version $Id: ShMemBase.h 76 2013-01-10 17:05:10Z kurdejma $
|
---|
9 | /// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
|
---|
10 | /// @brief Brief description.
|
---|
11 | ///
|
---|
12 | /// Detailed description.
|
---|
13 |
|
---|
14 | #ifndef DEF_PACPUS_SHMEMBASE_H
|
---|
15 | #define DEF_PACPUS_SHMEMBASE_H
|
---|
16 |
|
---|
17 | /// Base class for shared memory objects.
|
---|
18 | class ShMemBase
|
---|
19 | {
|
---|
20 | public:
|
---|
21 | /// Ctor
|
---|
22 | ShMemBase()
|
---|
23 | {
|
---|
24 | }
|
---|
25 |
|
---|
26 | /// Dtor
|
---|
27 | virtual ~ShMemBase()
|
---|
28 | {
|
---|
29 | }
|
---|
30 |
|
---|
31 | /// Use this method to get the data of the shared memory
|
---|
32 | virtual void *read() = 0;
|
---|
33 |
|
---|
34 | /// Use this method to write data in shared memory
|
---|
35 | virtual void write(void *data, int size, unsigned long offset = 0) = 0;
|
---|
36 |
|
---|
37 | /// Use this method to wait the incoming of new data
|
---|
38 | /// you can specify a timeout in ms to avoid infinite blocking or 0 (infinite)
|
---|
39 | /// @returns @b true if new data available before the timeout, @b false otherwise
|
---|
40 | virtual bool wait(unsigned long timeout = 0) = 0;
|
---|
41 |
|
---|
42 | /// To lock the access to the memory
|
---|
43 | virtual void lockMemory() = 0;
|
---|
44 |
|
---|
45 | /// To unlock the access to the memory
|
---|
46 | virtual void unlockMemory() = 0;
|
---|
47 |
|
---|
48 | #ifdef WIN32
|
---|
49 | /// Return the event handle under Windows
|
---|
50 | /// @todo ... under Linux ?
|
---|
51 | virtual void * getEventIdentifier() = 0;
|
---|
52 | #endif
|
---|
53 |
|
---|
54 | protected:
|
---|
55 | /// @todo Documentation
|
---|
56 | void * shMem_;
|
---|
57 |
|
---|
58 | private:
|
---|
59 | };
|
---|
60 |
|
---|
61 | #endif // DEF_PACPUS_SHMEMBASE_H
|
---|