fw4spl
Buffer.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWMEMORY_STREAM_IN_BUFFER_HPP__
8 #define __FWMEMORY_STREAM_IN_BUFFER_HPP__
9 
10 #include "fwMemory/config.hpp"
11 #include "fwMemory/stream/in/IFactory.hpp"
12 
13 #include <fwCore/macros.hpp>
14 
15 #include <functional>
16 
17 namespace fwMemory
18 {
19 namespace stream
20 {
21 namespace in
22 {
23 
24 class FWMEMORY_CLASS_API Buffer : public IFactory
25 {
26 public:
27  typedef SPTR (void) LockType;
28  typedef std::function< LockType() > CounterFactoryType;
29 
30  Buffer(void* buf, size_t size);
31  Buffer(void* buf, size_t size, CounterFactoryType counterFactory);
32 
33 protected:
34 
35  FWMEMORY_API SPTR(std::istream) get();
36 
37  void* m_buf;
38  size_t m_size;
39  CounterFactoryType m_counterFactory;
40 };
41 
42 } // namespace in
43 } // namespace stream
44 } // namespace fwMemory
45 
46 #endif // __FWMEMORY_STREAM_IN_BUFFER_HPP__
47 
#define SPTR(_cls_)
The namespace fwMemory contains tools to manage memory. Use for dump.
Definition: SReader.hpp:20
This file defines fwCore base macros.