00001 /*========================================================================= 00002 00003 Program: Open IGT Link Library 00004 Module: $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink/Source/igtlObjectFactory.h $ 00005 Language: C++ 00006 Date: $Date: 2008-12-22 19:05:42 -0500 (Mon, 22 Dec 2008) $ 00007 Version: $Revision: 3460 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notices for more information. 00014 00015 =========================================================================*/ 00016 /*========================================================================= 00017 00018 Program: Insight Segmentation & Registration Toolkit 00019 Module: $RCSfile: itkObjectFactory.h,v $ 00020 Language: C++ 00021 Date: $Date: 2008-12-22 19:05:42 -0500 (Mon, 22 Dec 2008) $ 00022 Version: $Revision: 3460 $ 00023 00024 Copyright (c) Insight Software Consortium. All rights reserved. 00025 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00026 00027 Portions of this code are covered under the VTK copyright. 00028 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details. 00029 00030 This software is distributed WITHOUT ANY WARRANTY; without even 00031 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00032 PURPOSE. See the above copyright notices for more information. 00033 00034 =========================================================================*/ 00035 #ifndef __igtlObjectFactory_h 00036 #define __igtlObjectFactory_h 00037 00038 #include "igtlObjectFactoryBase.h" 00039 00040 namespace igtl 00041 { 00042 00061 template <class T> 00062 class ObjectFactory : public ObjectFactoryBase 00063 { 00064 public: 00065 static typename T::Pointer Create() 00066 { 00067 LightObject::Pointer ret = ObjectFactory::CreateInstance(typeid(T).name()); 00068 return dynamic_cast<T*>(ret.GetPointer()); 00069 } 00070 }; 00071 00072 } // end namespace igtl 00073 00074 #endif 00075 00076 00077 00078