KWStyle - itkDataObjectDecorator.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkDataObjectDecorator.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:34 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12   Portions of this code are covered under the VTK copyright.
13   See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
14
15      This software is distributed WITHOUT ANY WARRANTY; without even 
16      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
17 IND *****PURPOSE.  See the above copyright notices for more information.
18
19 =========================================================================*/
20 #ifndef __itkDataObjectDecorator_h
21 #define __itkDataObjectDecorator_h
22
23 #include "itkDataObject.h"
24
25 namespace itk
26 {
27
28
29 /** \class DataObjectDecorator
30  * \brief Decorates any subclass of itkObject with a DataObject API
31  *
32  * DataObjectDecorator decorates an instance of a subclass of
33  * itkObject with a DataObject API. This allows any itkObject to be
34  * encapsulated into a DataObject that can be passed down the
35  * pipeline. To decorate simple types (float, int, std::vector) see
36  * SimpleDataObjectDecorator.
37  *
38  * The decorator provides two methods Set() and Get() to access the
39  * decorated object (referred internally as the component).
40  *
41  * Note that when an instance of DataObjectDecorator is created, the
42  * component is initialized with its default constructor (in this case
43  * a null pointer).
44  *
45  * DataObjectDecorator can decorate any subclass of itkObject. Two
46  * other decorators are provided. SimpleDataObjectDecorator can
47  * encapsulate simple types (float, int, std::vector).
48  * AutoPointerDataObjectDecorator will decorate any pointer type (for
49  * objects other than subclasses of itkObject) and manage the memory
50  * deallocationg of the component.
51  *
52  * \sa SimpleDataObjectDecorator
53  * \sa AutoPointerDataObjectDecorator
54  * \ingroup ITKSystemObjects
55  *
56  */
57 template<class T>
58 class ITK_EXPORT DataObjectDecorator : public DataObject
59 {
60 public:
61   /** Standard typedefs. */
62   typedef DataObjectDecorator           Self;
63 TDA   typedef DataObject  Superclass;
64 TDA   typedef SmartPointer<Self>  Pointer;
65 TDA   typedef SmartPointer<const Self>  ConstPointer;
66
67   /** Typedef for the component type (object being decorated) */
68   typedef T ComponentType;
69 TDA   typedef typename T::Pointer ComponentPointer;
70   
71   /** Method for creation through the object factory. */
72   itkNewMacro(Self);
73
74   /** Run-time type information (and related methods). */
75   itkTypeMacro(DataObjectDecorator, DataObject);
76
77   /** Set the contained object */
78   virtual void Set(T* val);
79   
80   /** Get the contained object */
81   virtual T* Get() { return m_Component; }
82   virtual const T* Get() const { return m_Component; }
83   
84 protected:
85   DataObjectDecorator();
86   ~DataObjectDecorator();
87   virtual void PrintSelf(std::ostream& os, Indent indent) const;
88
89 protected:
90
91 private:
92   DataObjectDecorator(const Self&); //purposely not implemented
93   void operator=(const Self&); //purposely not implemented
94
95   ComponentPointer m_Component;
96 };
97
98 // end namespace itk
99
100 #ifndef ITK_MANUAL_INSTANTIATION
101 #include "itkDataObjectDecorator.txx"
102 #endif
103
104 #endif
105
106 EOF

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:05PM
© Kitware Inc.