[89] | 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 |
|
---|
[126] | 18 | #include "PacpusToolsConfig.h"
|
---|
| 19 | #include "ShMemBase.h"
|
---|
[89] | 20 |
|
---|
| 21 | /// Windows handle (opaque pointer) type definition
|
---|
| 22 | ///
|
---|
| 23 | /// Forward declaration of typedefs is impossible.
|
---|
| 24 | typedef void * HANDLE;
|
---|
| 25 |
|
---|
| 26 | /// Shared memory object for Windows.
|
---|
[126] | 27 | class PACPUS_TOOLS_API Win32ShMem
|
---|
[89] | 28 | : public ShMemBase
|
---|
| 29 | {
|
---|
| 30 | public:
|
---|
| 31 | /// Ctor
|
---|
| 32 | Win32ShMem(const char * name, int size);
|
---|
| 33 | /// Dtor
|
---|
| 34 | ~Win32ShMem();
|
---|
| 35 |
|
---|
| 36 | /// @todo Documentation
|
---|
| 37 | virtual bool wait(unsigned long timeout = 0);
|
---|
| 38 | /// @todo Documentation
|
---|
| 39 | virtual void * read();
|
---|
| 40 | /// @todo Documentation
|
---|
| 41 | virtual void read(void * mem, int size);
|
---|
| 42 | /// @todo Documentation
|
---|
| 43 | virtual void write(void * data, int size, unsigned long offset = 0);
|
---|
| 44 | /// @todo Documentation
|
---|
| 45 | virtual void lockMemory();
|
---|
| 46 | /// @todo Documentation
|
---|
| 47 | virtual void unlockMemory();
|
---|
| 48 | /// @todo Documentation
|
---|
| 49 | virtual void * getEventIdentifier();
|
---|
| 50 |
|
---|
| 51 | protected:
|
---|
| 52 |
|
---|
| 53 | private:
|
---|
| 54 | HANDLE semaphore_;
|
---|
| 55 | HANDLE shMemHandle_;
|
---|
| 56 | HANDLE event_;
|
---|
| 57 | };
|
---|
| 58 |
|
---|
| 59 | #endif // DEF_PACPUS_WIN32SHMEM_H
|
---|