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