Last change
on this file since 115 was 15, checked in by Bayard Gildas, 8 years ago |
sources reformatted with flair-format-dir script
|
File size:
1.1 KB
|
Rev | Line | |
---|
[2] | 1 | // %flair:license{
|
---|
[15] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[2] | 4 | // %flair:license}
|
---|
| 5 | /*!
|
---|
| 6 | * \file SharedMem_impl.h
|
---|
| 7 | * \brief Class defining a shared memory
|
---|
| 8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 9 | * \date 2014/02/10
|
---|
| 10 | * \version 4.0
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 | #ifndef SHAREDMEM_IMPL_H
|
---|
| 14 | #define SHAREDMEM_IMPL_H
|
---|
| 15 |
|
---|
| 16 | #include <string>
|
---|
| 17 |
|
---|
| 18 | #ifdef __XENO__
|
---|
| 19 | #include <native/heap.h>
|
---|
| 20 | #include <native/mutex.h>
|
---|
| 21 | #else
|
---|
| 22 | #include <semaphore.h>
|
---|
| 23 | #endif
|
---|
| 24 |
|
---|
[15] | 25 | namespace flair {
|
---|
| 26 | namespace core {
|
---|
| 27 | class SharedMem;
|
---|
[2] | 28 | }
|
---|
[15] | 29 | }
|
---|
[2] | 30 |
|
---|
| 31 | /*! \class SharedMem_impl
|
---|
| 32 | * \brief Class defining a shared memory
|
---|
| 33 | *
|
---|
| 34 | */
|
---|
| 35 |
|
---|
[15] | 36 | class SharedMem_impl {
|
---|
| 37 | public:
|
---|
| 38 | SharedMem_impl(const flair::core::SharedMem *self, std::string name,
|
---|
| 39 | size_t size);
|
---|
| 40 | ~SharedMem_impl();
|
---|
[2] | 41 |
|
---|
[15] | 42 | void Write(const char *buf, size_t size);
|
---|
| 43 | void Read(char *buf, size_t size);
|
---|
[2] | 44 |
|
---|
[15] | 45 | private:
|
---|
| 46 | const flair::core::SharedMem *self;
|
---|
| 47 | size_t size;
|
---|
| 48 | char *mem_segment;
|
---|
[2] | 49 | #ifdef __XENO__
|
---|
[15] | 50 | RT_HEAP heap;
|
---|
| 51 | RT_MUTEX mutex;
|
---|
| 52 | bool heap_binded;
|
---|
| 53 | bool mutex_binded;
|
---|
[2] | 54 | #else
|
---|
[15] | 55 | int fd;
|
---|
| 56 | sem_t *sem;
|
---|
| 57 | std::string sem_name, shm_name;
|
---|
[2] | 58 | #endif
|
---|
| 59 | };
|
---|
| 60 |
|
---|
| 61 | #endif // SHAREDMEM_IMPL_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.