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 76 2013-01-10 17:05:10Z 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 "PacpusToolsConfig.h"
|
---|
19 | #include "ShMemBase.h"
|
---|
20 |
|
---|
21 | /// Windows handle (opaque pointer) type definition
|
---|
22 | ///
|
---|
23 | /// Forward declaration of typedefs is impossible.
|
---|
24 | typedef void * HANDLE;
|
---|
25 |
|
---|
26 | #ifdef _MSC_VER
|
---|
27 | # pragma warning(push)
|
---|
28 | # pragma warning(disable: 4275)
|
---|
29 | #endif // _MSC_VER
|
---|
30 |
|
---|
31 | namespace pacpus {
|
---|
32 |
|
---|
33 | /// Shared memory object for Windows.
|
---|
34 | class PACPUSTOOLS_API Win32ShMem
|
---|
35 | : public ShMemBase
|
---|
36 | {
|
---|
37 | public:
|
---|
38 | /// Ctor
|
---|
39 | Win32ShMem(const char * name, int size);
|
---|
40 | /// Dtor
|
---|
41 | ~Win32ShMem();
|
---|
42 |
|
---|
43 | /// @todo Documentation
|
---|
44 | virtual bool wait(unsigned long timeout = 0);
|
---|
45 | /// @todo Documentation
|
---|
46 | virtual void * read();
|
---|
47 | /// @todo Documentation
|
---|
48 | virtual void read(void * mem, int size);
|
---|
49 | /// @todo Documentation
|
---|
50 | virtual void write(void * data, int size, unsigned long offset = 0);
|
---|
51 | /// @todo Documentation
|
---|
52 | virtual void lockMemory();
|
---|
53 | /// @todo Documentation
|
---|
54 | virtual void unlockMemory();
|
---|
55 | /// @todo Documentation
|
---|
56 | virtual void * getEventIdentifier();
|
---|
57 |
|
---|
58 | protected:
|
---|
59 |
|
---|
60 | private:
|
---|
61 | HANDLE semaphore_;
|
---|
62 | HANDLE shMemHandle_;
|
---|
63 | HANDLE event_;
|
---|
64 | };
|
---|
65 |
|
---|
66 | } // namespace pacpus
|
---|
67 |
|
---|
68 | #ifdef _MSC_VER
|
---|
69 | # pragma warning(pop)
|
---|
70 | #endif // _MSC_VER
|
---|
71 |
|
---|
72 | #endif // DEF_PACPUS_WIN32SHMEM_H
|
---|