cmVTKMakeInstantiatorCommand.h 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmVTKMakeInstantiatorCommand_h
  14. #define cmVTKMakeInstantiatorCommand_h
  15. #include "cmCommand.h"
  16. /** \class cmVTKMakeInstantiatorCommand
  17. * cmVTKMakeInstantiatorCommand implements the VTK_MAKE_INSTANTIATOR
  18. * command. This generates a source file to add to a VTK library that
  19. * registers instance creation functions with vtkInstantiator for every
  20. * class in that library.
  21. */
  22. class cmVTKMakeInstantiatorCommand : public cmCommand
  23. {
  24. public:
  25. /** This is a virtual constructor for the command. */
  26. virtual cmCommand* Clone()
  27. { return new cmVTKMakeInstantiatorCommand; }
  28. /**
  29. * This is called when the command is first encountered in
  30. * the CMakeLists.txt file.
  31. */
  32. virtual bool InitialPass(std::vector<std::string> const& args);
  33. /** The name of the command as specified in CMakeList.txt. */
  34. virtual const char* GetName() { return "VTK_MAKE_INSTANTIATOR"; }
  35. /** Succinct documentation. */
  36. virtual const char* GetTerseDocumentation()
  37. {
  38. return "Deprecated. For use only in VTK 4.0.";
  39. }
  40. /** More documentation. */
  41. virtual const char* GetFullDocumentation()
  42. {
  43. return
  44. " VTK_MAKE_INSTANTIATOR(className outSourceList\n"
  45. " src-list1 [src-list2 ..]\n"
  46. " EXPORT_MACRO exportMacro\n"
  47. " [HEADER_LOCATION dir]\n"
  48. " [GROUP_SIZE groupSize]\n"
  49. " [INCLUDES [file1 file2 ..]])\n"
  50. "Generates a new class with the given name and adds its files to the "
  51. "given outSourceList. It registers the classes from the other given "
  52. "source lists with vtkInstantiator when it is loaded. The output "
  53. "source list should be added to the library with the classes it "
  54. "registers. "
  55. "The EXPORT_MACRO argument must be given and followed by the export "
  56. "macro to use when generating the class (ex. VTK_COMMON_EXPORT). "
  57. "The HEADER_LOCATION option must be followed by a path. It specifies "
  58. "the directory in which to place the generated class's header file. "
  59. "The generated class implementation files always go in the build "
  60. "directory corresponding to the CMakeLists.txt file containing "
  61. "the command. This is the default location for the header. "
  62. "The INCLUDES option can be followed by a list of zero or more files. "
  63. "These files will be #included by the generated instantiator header, "
  64. "and can be used to gain access to the specified exportMacro in the "
  65. "C++ code.";
  66. }
  67. cmTypeMacro(cmVTKMakeInstantiatorCommand, cmCommand);
  68. protected:
  69. std::string m_ClassName;
  70. std::string m_ExportMacro;
  71. std::vector<cmStdString> m_Includes;
  72. std::vector<cmStdString> m_Classes;
  73. void GenerateHeaderFile(std::ostream&);
  74. void GenerateImplementationFile(std::ostream&);
  75. void OldGenerateHeaderFile(std::ostream&);
  76. void OldGenerateImplementationFile(std::ostream&);
  77. std::string OldGenerateCreationFileName(unsigned int group);
  78. void OldGenerateCreationFile(std::ostream&, unsigned int groupStart,
  79. unsigned int groupSize);
  80. };
  81. #endif