source: flair-dev/trunk/include/FlairCore/SharedMem.h @ 2

Last change on this file since 2 was 2, checked in by Sanahuja Guillaume, 5 years ago

initial commit flaircore

File size: 1.7 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5/*!
6 * \file SharedMem.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_H
14#define SHAREDMEM_H
15
16#include <Object.h>
17#include <semaphore.h>
18
19class SharedMem_impl;
20
21namespace flair
22{
23namespace core
24{
25
26    /*! \class SharedMem
27    *
28    * \brief Class defining a shared memory
29    *
30    * Shared memory is identified by its name so it can be accessed
31    * by another processus using its name.
32    */
33
34    class SharedMem: public Object
35    {
36        public:
37            /*!
38            * \brief Constructor
39            *
40            * Construct a shared memory object
41            *
42            * \param parent parent
43            * \param name name
44            * \param size size of the shared memory
45            */
46            SharedMem(const Object* parent,std::string name,size_t size);
47
48            /*!
49            * \brief Destructor
50            *
51            */
52            ~SharedMem();
53
54            /*!
55            * \brief Write
56            *
57            * \param buf input buffer to write to memory
58            * \param size buffer size
59            */
60            void Write(const char* buf,size_t size);
61
62            /*!
63            * \brief Read
64            *
65            * \param buf output buffer to write from memory
66            * \param size buffer size
67            */
68            void Read(char* buf,size_t size) const;
69
70        private:
71            SharedMem_impl* pimpl_;
72    };
73
74} // end namespace core
75} // end namespace flair
76
77#endif // SHAREDMEM_H
Note: See TracBrowser for help on using the repository browser.