cmCableClassSet.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2001 Insight Consortium
  8. All rights reserved.
  9. Redistribution and use in source and binary forms, with or without
  10. modification, are permitted provided that the following conditions are met:
  11. * Redistributions of source code must retain the above copyright notice,
  12. this list of conditions and the following disclaimer.
  13. * Redistributions in binary form must reproduce the above copyright notice,
  14. this list of conditions and the following disclaimer in the documentation
  15. and/or other materials provided with the distribution.
  16. * The name of the Insight Consortium, nor the names of any consortium members,
  17. nor of any contributors, may be used to endorse or promote products derived
  18. from this software without specific prior written permission.
  19. * Modified source versions must be plainly marked as such, and must not be
  20. misrepresented as being the original software.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
  22. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24. ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
  25. ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  27. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  28. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  29. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. =========================================================================*/
  32. #ifndef cmCableClassSet_h
  33. #define cmCableClassSet_h
  34. #include "cmStandardIncludes.h"
  35. #include "cmData.h"
  36. #include "cmMakefile.h"
  37. /** \class cmCableClass
  38. * \brief Holds one class and the set of header files needed to use it.
  39. */
  40. class cmCableClass
  41. {
  42. public:
  43. typedef std::set<std::string> Sources;
  44. cmCableClass() {}
  45. cmCableClass(const std::string& tag): m_Tag(tag) {}
  46. void AddSources(const Sources& sources);
  47. void AddSource(const char*);
  48. Sources::const_iterator SourcesBegin() const { return m_Sources.begin(); }
  49. Sources::const_iterator SourcesEnd() const { return m_Sources.end(); }
  50. const std::string& GetTag() const { return m_Tag; }
  51. private:
  52. /**
  53. * The tag name of this class.
  54. */
  55. std::string m_Tag;
  56. /**
  57. * Store the set of source files (headers) needed to define this class.
  58. */
  59. Sources m_Sources;
  60. };
  61. /** \class cmCableClassSet
  62. * \brief Holds a set of classes, each with their own set of required headers.
  63. */
  64. class cmCableClassSet: public cmData
  65. {
  66. public:
  67. cmCableClassSet(const char* name): cmData(name) {}
  68. virtual ~cmCableClassSet();
  69. /**
  70. * The set is stored internally as a map from class name to cmCableClass
  71. * instance.
  72. */
  73. typedef std::map<cmStdString, cmCableClass*> CableClassMap;
  74. void AddClass(const char*, cmCableClass*);
  75. void AddSource(const char* name);
  76. unsigned int Size() const;
  77. CableClassMap::const_iterator Begin() const;
  78. CableClassMap::const_iterator End() const;
  79. void ParseAndAddElement(const char*, cmMakefile*);
  80. private:
  81. /**
  82. * The set is stored internally as a map from class name to cmCableClass
  83. * instance.
  84. */
  85. CableClassMap m_CableClassMap;
  86. };
  87. #endif