[76] | 1 | // %pacpus:license{
|
---|
[62] | 2 | // This file is part of the PACPUS framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[76] | 4 | // %pacpus:license}
|
---|
[66] | 5 | /// @file
|
---|
[62] | 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.
|
---|
[67] | 13 | /// @todo Derive from a common base class. Same for @link PosixShMem @endlink.
|
---|
[3] | 14 |
|
---|
[31] | 15 | #ifndef DEF_PACPUS_WIN32SHMEM_H
|
---|
| 16 | #define DEF_PACPUS_WIN32SHMEM_H
|
---|
[3] | 17 |
|
---|
[103] | 18 | #include "Pacpus\kernel\PacpusToolsConfig.h"
|
---|
| 19 |
|
---|
[31] | 20 | #include <Pacpus/PacpusTools/ShMemBase.h>
|
---|
[3] | 21 |
|
---|
[69] | 22 | /// Windows handle (opaque pointer) type definition
|
---|
| 23 | ///
|
---|
| 24 | /// Forward declaration of typedefs is impossible.
|
---|
[3] | 25 | typedef void * HANDLE;
|
---|
| 26 |
|
---|
[114] | 27 | #ifdef _MSC_VER
|
---|
| 28 | # pragma warning(push)
|
---|
| 29 | # pragma warning(disable: 4275)
|
---|
| 30 | #endif // _MSC_VER
|
---|
| 31 |
|
---|
| 32 | namespace pacpus {
|
---|
| 33 |
|
---|
[69] | 34 | /// Shared memory object for Windows.
|
---|
[103] | 35 | class PACPUSTOOLS_API Win32ShMem
|
---|
[3] | 36 | : public ShMemBase
|
---|
| 37 | {
|
---|
| 38 | public:
|
---|
[69] | 39 | /// Ctor
|
---|
[3] | 40 | Win32ShMem(const char * name, int size);
|
---|
[69] | 41 | /// Dtor
|
---|
[3] | 42 | ~Win32ShMem();
|
---|
| 43 |
|
---|
[69] | 44 | /// @todo Documentation
|
---|
[3] | 45 | virtual bool wait(unsigned long timeout = 0);
|
---|
[69] | 46 | /// @todo Documentation
|
---|
[3] | 47 | virtual void * read();
|
---|
[69] | 48 | /// @todo Documentation
|
---|
[3] | 49 | virtual void read(void * mem, int size);
|
---|
[69] | 50 | /// @todo Documentation
|
---|
[3] | 51 | virtual void write(void * data, int size, unsigned long offset = 0);
|
---|
[69] | 52 | /// @todo Documentation
|
---|
[3] | 53 | virtual void lockMemory();
|
---|
[69] | 54 | /// @todo Documentation
|
---|
[3] | 55 | virtual void unlockMemory();
|
---|
[69] | 56 | /// @todo Documentation
|
---|
[3] | 57 | virtual void * getEventIdentifier();
|
---|
| 58 |
|
---|
| 59 | protected:
|
---|
| 60 |
|
---|
| 61 | private:
|
---|
| 62 | HANDLE semaphore_;
|
---|
| 63 | HANDLE shMemHandle_;
|
---|
| 64 | HANDLE event_;
|
---|
| 65 | };
|
---|
| 66 |
|
---|
[114] | 67 | } // namespace pacpus
|
---|
| 68 |
|
---|
| 69 | #ifdef _MSC_VER
|
---|
| 70 | # pragma warning(pop)
|
---|
| 71 | #endif // _MSC_VER
|
---|
| 72 |
|
---|
[31] | 73 | #endif // DEF_PACPUS_WIN32SHMEM_H
|
---|