fw4spl
AlwaysDump.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_POLICY_ALWAYSDUMP_HPP__
8 #define __FWMEMORY_POLICY_ALWAYSDUMP_HPP__
9 
10 #include "fwMemory/BufferInfo.hpp"
11 #include "fwMemory/config.hpp"
12 #include "fwMemory/IPolicy.hpp"
13 #include "fwMemory/policy/factory/new.hpp"
14 
15 #include <fwCore/base.hpp>
16 
17 namespace fwMemory
18 {
19 namespace policy
20 {
21 
28 class FWMEMORY_CLASS_API AlwaysDump : public fwMemory::IPolicy
29 {
30 public:
32  (()),
33  ::fwMemory::policy::factory::New< AlwaysDump >)
34 
35  FWMEMORY_API virtual void allocationRequest( BufferInfo& info,
36  ::fwMemory::BufferManager::ConstBufferPtrType buffer,
37  BufferInfo::SizeType size ) override;
38 
39  FWMEMORY_API virtual void setRequest( BufferInfo& info,
40  ::fwMemory::BufferManager::ConstBufferPtrType buffer,
41  BufferInfo::SizeType size ) override;
42 
43  FWMEMORY_API virtual void reallocateRequest( BufferInfo& info,
44  ::fwMemory::BufferManager::ConstBufferPtrType buffer,
45  BufferInfo::SizeType newSize ) override;
46 
47  FWMEMORY_API virtual void destroyRequest( BufferInfo& info,
48  ::fwMemory::BufferManager::ConstBufferPtrType buffer ) override;
49 
50  FWMEMORY_API virtual void lockRequest( BufferInfo& info,
51  ::fwMemory::BufferManager::ConstBufferPtrType buffer ) override;
52  FWMEMORY_API virtual void unlockRequest( BufferInfo& info,
53  ::fwMemory::BufferManager::ConstBufferPtrType buffer ) override;
54 
55  FWMEMORY_API virtual void dumpSuccess( BufferInfo& info,
56  ::fwMemory::BufferManager::ConstBufferPtrType buffer ) override;
57  FWMEMORY_API virtual void restoreSuccess( BufferInfo& info,
58  ::fwMemory::BufferManager::ConstBufferPtrType buffer ) override;
59 
60  FWMEMORY_API virtual void refresh() override;
61 
62  //------------------------------------------------------------------------------
63 
64  bool setParam(const std::string& name, const std::string& value) override
65  {
66  FwCoreNotUsedMacro(name);
67  FwCoreNotUsedMacro(value);
68  return false;
69  }
70 
71  FWMEMORY_API virtual std::string getParam(const std::string& name, bool* ok = NULL ) const override;
72 
73  const ::fwMemory::IPolicy::ParamNamesType& getParamNames() const override
74  {
75  static ::fwMemory::IPolicy::ParamNamesType names;
76  return names;
77  }
78 
79 protected:
80 
81  FWMEMORY_API size_t dump();
82  FWMEMORY_API void apply();
83 };
84 
85 } // namespace policy
86 
87 } // namespace fwMemory
88 
89 #endif // __FWMEMORY_POLICY_ALWAYSDUMP_HPP__
90 
The namespace fwMemory contains tools to manage memory. Use for dump.
Definition: SReader.hpp:20
STL namespace.
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
Always dump policy.
Definition: AlwaysDump.hpp:28
BufferManager implementation.
Defines the memory dump policy interface.
Definition: IPolicy.hpp:23