KWStyle - itkCreateObjectFunction.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkCreateObjectFunction.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      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 #ifndef __itkCreateObjectFunction_h
18 #define __itkCreateObjectFunction_h
19
20 #include "itkObject.h"
21
22 namespace itk
23 {
24
25 /** \class CreateObjectFunctionBase
26  * \brief Define API for object creation callback functions.
27  *
28  * \ingroup ITKSystemObjects
29  */
30 class CreateObjectFunctionBase: public Object
31 {
32 public:
33   /** Standard typedefs. */
34   typedef CreateObjectFunctionBase  Self;
35 TDA   typedef Object  Superclass;
36   typedef SmartPointer<Self>        Pointer;
37   typedef SmartPointer<const Self>  ConstPointer;
38   
39   /** Create an object and return a pointer to it as an
40    * itk::LightObject. */
41   virtual SmartPointer<LightObject> CreateObject() = 0;
42
43 protected:
44   CreateObjectFunctionBase() {}
45   ~CreateObjectFunctionBase() {}
46   
47 private:
48   CreateObjectFunctionBase(const Self&); //purposely not implemented
49   void operator=(const Self&); //purposely not implemented  
50 };
51
52
53 /** \class CreateObjectFunction
54  * \brief CreateObjectFunction is used to create callback functions that
55  * create ITK Objects for use with the itk::ObjectFactory.
56  * 
57  * \ingroup ITKSystemObjects
58  */
59 template <class T>
60 class CreateObjectFunction : public CreateObjectFunctionBase
61 {
62 public:
63   /** Standard class typedefs. */
64   typedef CreateObjectFunction  Self;
65   typedef SmartPointer<Self>    Pointer;
66     
67   /** Methods from itk:LightObject. */
68   itkFactorylessNewMacro(Self);
69   LightObject::Pointer CreateObject() { return T::New().GetPointer(); }
70   
71 protected:
72   CreateObjectFunction() {}
73   ~CreateObjectFunction() {}
74   
75 private:
76   CreateObjectFunction(const Self&); //purposely not implemented
77   void operator=(const Self&); //purposely not implemented  
78 };
79
80 // end namespace itk
81
82 #endif
83
84 EOF
85 EOF,EML

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