00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkObjectFactory.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:29:18 $ 00007 Version: $Revision: 1.17 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 Portions of this code are covered under the VTK copyright. 00013 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details. 00014 00015 This software is distributed WITHOUT ANY WARRANTY; without even 00016 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00017 PURPOSE. See the above copyright notices for more information. 00018 00019 =========================================================================*/ 00020 #ifndef __itkObjectFactory_h 00021 #define __itkObjectFactory_h 00022 00023 #include "itkObjectFactoryBase.h" 00024 00025 namespace itk 00026 { 00027 00046 template <class T> 00047 class ObjectFactory : public ObjectFactoryBase 00048 { 00049 public: 00050 static typename T::Pointer Create() 00051 { 00052 LightObject::Pointer ret = ObjectFactory::CreateInstance(typeid(T).name()); 00053 return dynamic_cast<T*>(ret.GetPointer()); 00054 } 00055 }; 00056 00057 } // end namespace itk 00058 00059 #endif 00060 00061 00062 00063