KWStyle - itkSimpleDataObjectDecorator.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkSimpleDataObjectDecorator.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:47 $
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 IND *****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 __itkSimpleDataObjectDecorator_h
21 #define __itkSimpleDataObjectDecorator_h
22
23 #include "itkDataObject.h"
24 #include "itkObjectFactory.h"
25
26 namespace itk
27 {
28
29
30 /** \class SimpleDataObjectDecorator
31 LEN  * \brief Decorates any "simple" data type (data types without smart pointers) with a DataObject API
32  *
33  * SimpleDataObjectDecorator decorates an object with a DataObject
34  * API. This allows simple objects to be encapsulated into objects
35  * that can be passed as down the pipeline. This decorator is intended
36  * to be used on native types (float, int, etc.) or any objects not
37  * derived from itkObject.  To decorate a subclass of itkObject, see
38  * DataObjectDecorator. 
39  *
40  * The decorator provides two methods Set() and Get() to access the
41  * decorated object (referred internally as the component).
42  *
43  * Note that when an instance of SimpleDataObjectDecorator is created,
44  * the component is initialized with its default constructor.
45  *
46  * SimpleDataObjectDecorator can decorate any simple data type. Two
47  * other decorators are provided for decorating pointers.
48  * DataObjectDecorator will decorate pointers to subclasses of
49  * itkObject (internally storing the pointer in a
50  * SmartPointer). AutoPointerDataObjectDecorator will decorate any
51  * other pointer and manage the memory deallocationg of the component.
52  *
53  * \sa DataObjectDecorator
54  * \sa AutoPointerDataObjectDecorator
55  * \ingroup ITKSystemObjects
56  *
57  */
58 template<class T>
59 class ITK_EXPORT SimpleDataObjectDecorator : public DataObject
60 {
61 public:
62   /** Standard typedefs. */
63   typedef SimpleDataObjectDecorator           Self;
64 TDA   typedef DataObject  Superclass;
65 TDA   typedef SmartPointer<Self>  Pointer;
66 TDA   typedef SmartPointer<const Self>  ConstPointer;
67
68   /** Typedef for the component type (object being decorated) */
69   typedef T ComponentType;
70   
71   /** Method for creation through the object factory. */
72   itkNewMacro(Self);
73
74   /** Run-time type information (and related methods). */
75   itkTypeMacro(SimpleDataObjectDecorator, DataObject);
76
77   /** Set the contained object */
78   virtual void Set(const T& val);
79   
80   /** Get the contained object */
81   virtual T& Get() { return m_Component; }
82   virtual T Get() const { return m_Component; }
83
84   
85 protected:
86   SimpleDataObjectDecorator();
87   ~SimpleDataObjectDecorator();
88   virtual void PrintSelf(std::ostream& os, Indent indent) const;
89
90 protected:
91
92 private:
93   SimpleDataObjectDecorator(const Self&); //purposely not implemented
94   void operator=(const Self&); //purposely not implemented
95
96   ComponentType m_Component;
97 };
98
99 // end namespace itk
100
101 #ifndef ITK_MANUAL_INSTANTIATION
102 #include "itkSimpleDataObjectDecorator.txx"
103 #endif
104
105 #endif
106
107 EOF

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