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 Firstname Surname <firstname.surname@utc.fr>
|
---|
7 | /// @date Month, Year
|
---|
8 | /// @version $Id: ShMem.h 76 2013-01-10 17:05:10Z kurdejma $
|
---|
9 | /// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
|
---|
10 | /// @brief Brief description.
|
---|
11 | ///
|
---|
12 | /// Detailed description.
|
---|
13 |
|
---|
14 | #ifndef DEF_PACPUS_SHMEM_H
|
---|
15 | #define DEF_PACPUS_SHMEM_H
|
---|
16 |
|
---|
17 | #ifdef WIN32
|
---|
18 | # include "Win32ShMem.h"
|
---|
19 | /// Defines shared memory as a Windows shared memory
|
---|
20 | # define ShMemType Win32ShMem
|
---|
21 | #else
|
---|
22 | # include "PosixShMem.h"
|
---|
23 | /// Defines shared memory as a POSIX shared memory
|
---|
24 | # define ShMemType PosixShMem
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | namespace pacpus {
|
---|
28 |
|
---|
29 | /// Shared memory class.
|
---|
30 | ///
|
---|
31 | /// Inherits from Win32ShMem on Windows system and from PosixShMem on Unix-like systems.
|
---|
32 | class ShMem
|
---|
33 | : public ShMemType
|
---|
34 | {
|
---|
35 | public:
|
---|
36 | /// Ctor of shared memory class.
|
---|
37 | ///
|
---|
38 | /// Creates a shared memory of size @b size and named @b name.
|
---|
39 | /// If a shared memory with the name @b name already exists, than
|
---|
40 | /// it will return object pointing to the same memory.
|
---|
41 | /// If this existing memory space has a size smaller than @b size,
|
---|
42 | /// a warning will be issued.
|
---|
43 | ///
|
---|
44 | /// @param name Name of the created shared memory space.
|
---|
45 | /// @param size Size of the created shared memory space in [bytes].
|
---|
46 | ShMem(const char * name, int size)
|
---|
47 | : ShMemType(name, size)
|
---|
48 | {
|
---|
49 | }
|
---|
50 |
|
---|
51 | /// Dtor of shared memory class.
|
---|
52 | ///
|
---|
53 | /// Does nothing.
|
---|
54 | ~ShMem()
|
---|
55 | {
|
---|
56 | }
|
---|
57 |
|
---|
58 | protected:
|
---|
59 | private:
|
---|
60 | };
|
---|
61 |
|
---|
62 | } // namespace pacpus
|
---|
63 |
|
---|
64 | #endif // DEF_PACPUS_SHMEM_H
|
---|