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