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: ShMem.h 69 2013-01-09 23:04:42Z 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_SHMEM_H
|
---|
14 | #define DEF_PACPUS_SHMEM_H
|
---|
15 |
|
---|
16 | #ifdef WIN32
|
---|
17 | # include "Win32ShMem.h"
|
---|
18 | /// Defines shared memory as a Windows shared memory
|
---|
19 | # define ShMemType Win32ShMem
|
---|
20 | #else
|
---|
21 | # include "PosixShMem.h"
|
---|
22 | /// Defines shared memory as a POSIX shared memory
|
---|
23 | # define ShMemType PosixShMem
|
---|
24 | #endif
|
---|
25 |
|
---|
26 | namespace pacpus {
|
---|
27 |
|
---|
28 | /// Shared memory class.
|
---|
29 | ///
|
---|
30 | /// Inherits from Win32ShMem on Windows system and from PosixShMem on Unix-like systems.
|
---|
31 | class ShMem
|
---|
32 | : public ShMemType
|
---|
33 | {
|
---|
34 | public:
|
---|
35 | /// Ctor of shared memory class.
|
---|
36 | ///
|
---|
37 | /// Creates a shared memory of size @b size and named @b name.
|
---|
38 | /// If a shared memory with the name @b name already exists, than
|
---|
39 | /// it will return object pointing to the same memory.
|
---|
40 | /// If this existing memory space has a size smaller than @b size,
|
---|
41 | /// a warning will be issued.
|
---|
42 | ///
|
---|
43 | /// @param name Name of the created shared memory space.
|
---|
44 | /// @param size Size of the created shared memory space in [bytes].
|
---|
45 | ShMem(const char * name, int size)
|
---|
46 | : ShMemType(name, size)
|
---|
47 | {
|
---|
48 | }
|
---|
49 |
|
---|
50 | /// Dtor of shared memory class.
|
---|
51 | ///
|
---|
52 | /// Does nothing.
|
---|
53 | ~ShMem()
|
---|
54 | {
|
---|
55 | }
|
---|
56 |
|
---|
57 | protected:
|
---|
58 | private:
|
---|
59 | };
|
---|
60 |
|
---|
61 | } // namespace pacpus
|
---|
62 |
|
---|
63 | #endif // DEF_PACPUS_SHMEM_H
|
---|