fw4spl
writer/ie/InformationEntity.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
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 #pragma once
8 
9 #include "fwGdcmIO/config.hpp"
10 #include "fwGdcmIO/container/DicomInstance.hpp"
11 
12 #include <fwData/Object.hpp>
13 
14 #include <fwLog/Logger.hpp>
15 
16 #include <gdcmWriter.h>
17 
18 #include <cstdint>
19 
20 namespace fwGdcmIO
21 {
22 namespace writer
23 {
24 namespace ie
25 {
26 
30 template< class DATATYPE >
31 class FWGDCMIO_CLASS_API InformationEntity
32 {
33 
34 public:
35  typedef std::function< void (std::uint64_t) > ProgressCallback;
36  typedef std::function< bool () > CancelRequestedCallback;
37 
47  FWGDCMIO_API InformationEntity(const SPTR(::gdcm::Writer)& writer,
48  const SPTR(::fwGdcmIO::container::DicomInstance)& instance,
49  const CSPTR(DATATYPE)& object,
50  const ::fwLog::Logger::sptr& logger = nullptr,
51  ProgressCallback progress = nullptr,
52  CancelRequestedCallback cancel = nullptr);
53 
55  FWGDCMIO_API virtual ~InformationEntity();
56 
57 protected:
58 
60  SPTR(::gdcm::Writer) m_writer;
61 
63  SPTR(::fwGdcmIO::container::DicomInstance) m_instance;
64 
66  CSPTR(DATATYPE) m_object;
67 
69  ::fwLog::Logger::sptr m_logger;
70 
72  ProgressCallback m_progressCallback;
73 
75  CancelRequestedCallback m_cancelRequestedCallback;
76 };
77 
78 //------------------------------------------------------------------------------
79 
80 template< class DATATYPE >
81 InformationEntity<DATATYPE>::InformationEntity(const SPTR(::gdcm::Writer)& writer,
82  const SPTR(::fwGdcmIO::container::DicomInstance)& instance,
83  const CSPTR(DATATYPE)& object,
84  const ::fwLog::Logger::sptr& logger,
85  ProgressCallback progress,
86  CancelRequestedCallback cancel) :
87  m_writer(writer),
88  m_instance(instance),
89  m_object(object),
90  m_logger(logger),
91  m_progressCallback(progress),
92  m_cancelRequestedCallback(cancel)
93 {
94  SLM_ASSERT("Writer should not be null.", writer);
95  SLM_ASSERT("Instance should not be null.", instance);
96  SLM_ASSERT("Object should not be null.", object);
97 }
98 
99 //------------------------------------------------------------------------------
100 
101 template< class DATATYPE >
103 {
104 }
105 
106 //------------------------------------------------------------------------------
107 
108 } // namespace ie
109 } // namespace writer
110 } // namespace fwGdcmIO
#define SPTR(_cls_)
#define CSPTR(_cls_)
InformationEntity base class used to write modules.
This class defines a DICOM SOP instance. It is useful during the whole writing process. This class allows to share data between module writers.
The namespace fwGdcmIO contains reader, writer and helper for dicom data.
fwLog contains classes used to manage logs.
Definition: Log.hpp:16
virtual FWGDCMIO_API ~InformationEntity()
Destructor.
#define SLM_ASSERT(message, cond)
work like &#39;assert&#39; from &#39;cassert&#39;, with in addition a message logged by spylog (with FATAL loglevel) ...
Definition: spyLog.hpp:308