/*========================================================================= Program: ITK Program Factory Module: $RCSfile: $ Language: C++ Date: $Date: $ Version: $Revision: $ Copyright (c) INRIA Saclay Île-de-France, Parietal Research Team. All rights reserved. See CodeCopyright.txt for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "itkCommandObjectFactory.h" #include #include namespace itk { CommandObjectBase::Pointer CommandObjectFactory::CreateCommandObject(const char* name) { std::list possibleCommandObject; std::list allobjects = ObjectFactoryBase::CreateAllInstance("itkCommandObjectBase"); for(std::list::iterator i = allobjects.begin(); i != allobjects.end(); ++i) { CommandObjectBase* command = dynamic_cast(i->GetPointer()); if(command) { possibleCommandObject.push_back(command); } else { std::cerr << "Error CommandObject factory did not return an CommandObjectBase: " << (*i)->GetNameOfClass() << std::endl; } } for(std::list::iterator k = possibleCommandObject.begin(); k != possibleCommandObject.end(); ++k) { if( strcmp((*k)->GetCommandName(), name)==0 ) return *k; } return nullptr; } void CommandObjectFactory::PrintHelp(std::ostream &os, Indent indent) { std::list allobjects = ObjectFactoryBase::CreateAllInstance("itkCommandObjectBase"); std::vector commandNames; for(std::list::iterator i = allobjects.begin(); i != allobjects.end(); ++i) { CommandObjectBase* command = dynamic_cast(i->GetPointer()); if(command) { commandNames.push_back ( command->GetCommandName() ); } } std::sort (commandNames.begin(), commandNames.end()); for (unsigned int i=0; iGetShortDescription() << "\n"; os << "\n"; */ } } } // end namespace itk