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 Gerald Dherbomez <firstname.surname@utc.fr>
|
---|
7 | /// @date January, 2007
|
---|
8 | /// @version $Id: Win32ShMem.h 114 2013-06-25 08:55:43Z kurdejma $
|
---|
9 | /// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
|
---|
10 | /// @brief Shared memory implementation for Windows.
|
---|
11 | ///
|
---|
12 | /// Shared memory implementation for Windows.
|
---|
13 | /// @todo Derive from a common base class. Same for @link PosixShMem @endlink.
|
---|
14 |
|
---|
15 | #ifndef DEF_PACPUS_WIN32SHMEM_H
|
---|
16 | #define DEF_PACPUS_WIN32SHMEM_H
|
---|
17 |
|
---|
18 | #include "Pacpus\kernel\PacpusToolsConfig.h"
|
---|
19 |
|
---|
20 | #include <Pacpus/PacpusTools/ShMemBase.h>
|
---|
21 |
|
---|
22 | /// Windows handle (opaque pointer) type definition
|
---|
23 | ///
|
---|
24 | /// Forward declaration of typedefs is impossible.
|
---|
25 | typedef void * HANDLE;
|
---|
26 |
|
---|
27 | #ifdef _MSC_VER
|
---|
28 | # pragma warning(push)
|
---|
29 | # pragma warning(disable: 4275)
|
---|
30 | #endif // _MSC_VER
|
---|
31 |
|
---|
32 | namespace pacpus {
|
---|
33 |
|
---|
34 | /// Shared memory object for Windows.
|
---|
35 | class PACPUSTOOLS_API Win32ShMem
|
---|
36 | : public ShMemBase
|
---|
37 | {
|
---|
38 | public:
|
---|
39 | /// Ctor
|
---|
40 | Win32ShMem(const char * name, int size);
|
---|
41 | /// Dtor
|
---|
42 | ~Win32ShMem();
|
---|
43 |
|
---|
44 | /// @todo Documentation
|
---|
45 | virtual bool wait(unsigned long timeout = 0);
|
---|
46 | /// @todo Documentation
|
---|
47 | virtual void * read();
|
---|
48 | /// @todo Documentation
|
---|
49 | virtual void read(void * mem, int size);
|
---|
50 | /// @todo Documentation
|
---|
51 | virtual void write(void * data, int size, unsigned long offset = 0);
|
---|
52 | /// @todo Documentation
|
---|
53 | virtual void lockMemory();
|
---|
54 | /// @todo Documentation
|
---|
55 | virtual void unlockMemory();
|
---|
56 | /// @todo Documentation
|
---|
57 | virtual void * getEventIdentifier();
|
---|
58 |
|
---|
59 | protected:
|
---|
60 |
|
---|
61 | private:
|
---|
62 | HANDLE semaphore_;
|
---|
63 | HANDLE shMemHandle_;
|
---|
64 | HANDLE event_;
|
---|
65 | };
|
---|
66 |
|
---|
67 | } // namespace pacpus
|
---|
68 |
|
---|
69 | #ifdef _MSC_VER
|
---|
70 | # pragma warning(pop)
|
---|
71 | #endif // _MSC_VER
|
---|
72 |
|
---|
73 | #endif // DEF_PACPUS_WIN32SHMEM_H
|
---|