source: flair-src/trunk/lib/FlairCore/src/unexported/SharedMem_impl.h@ 233

Last change on this file since 233 was 203, checked in by Bayard Gildas, 7 years ago

Added timeout on SharedMem Read

File size: 1.2 KB
RevLine 
[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#endif
21
[203]22#include <Semaphore.h>
23
[149]24#include <SharedMem.h>
[2]25
26/*! \class SharedMem_impl
27* \brief Class defining a shared memory
28*
29*/
30
[15]31class SharedMem_impl {
32public:
33 SharedMem_impl(const flair::core::SharedMem *self, std::string name,
[149]34 size_t size, flair::core::SharedMem::Type &type);
[15]35 ~SharedMem_impl();
[2]36
[15]37 void Write(const char *buf, size_t size);
[203]38 bool Read(char *buf, size_t size, flair::core::Time nsTimeout);
[149]39 void ReaderReady();
[2]40
[15]41private:
42 const flair::core::SharedMem *self;
[149]43 flair::core::SharedMem::Type type;
[15]44 size_t size;
45 char *mem_segment;
[203]46 flair::core::Semaphore sem,sem_producer,sem_consumer;
[2]47#ifdef __XENO__
[15]48 RT_HEAP heap;
49 bool heap_binded;
[2]50#else
[15]51 int fd;
[203]52 std::string shm_name;
[2]53#endif
54};
55
56#endif // SHAREDMEM_IMPL_H
Note: See TracBrowser for help on using the repository browser.