cmCableDefineSetCommand.cxx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2000 National Library of Medicine
  8. All rights reserved.
  9. See COPYRIGHT.txt for copyright details.
  10. =========================================================================*/
  11. #include "cmCabilDefineSetCommand.h"
  12. #include "cmCacheManager.h"
  13. // cmCabilDefineSetCommand
  14. bool cmCabilDefineSetCommand::Invoke(std::vector<std::string>& args)
  15. {
  16. if(args.size() < 2)
  17. {
  18. this->SetError("called with incorrect number of arguments");
  19. return false;
  20. }
  21. std::vector<std::string>::const_iterator arg = args.begin();
  22. // The first argument is the name of the set.
  23. m_SetName = *arg++;
  24. // The rest of the arguments are the elements to be placed in the set.
  25. for(; arg != args.end(); ++arg)
  26. {
  27. m_Elements.push_back(*arg);
  28. }
  29. return true;
  30. }
  31. /**
  32. * Write the CABIL configuration code to define this Set.
  33. */
  34. void cmCabilDefineSetCommand::WriteConfiguration(std::ostream& os) const
  35. {
  36. os << " <Set name=\"" << m_SetName.c_str() << "\">" << std::endl;
  37. for(Elements::const_iterator e = m_Elements.begin();
  38. e != m_Elements.end(); ++e)
  39. {
  40. os << " <Element>" << e->c_str() << "</Element>" << std::endl;
  41. }
  42. os << " </Set>" << std::endl;
  43. }