functionWriters.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Filename: functionWriters.h
  2. // Created by: drose (14Sep01)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) Carnegie Mellon University. All rights reserved.
  8. //
  9. // All use of this software is subject to the terms of the revised BSD
  10. // license. You should have received a copy of this license along
  11. // with this source code in a file named "LICENSE."
  12. //
  13. ////////////////////////////////////////////////////////////////////
  14. #ifndef FUNCTIONWRITERS_H
  15. #define FUNCTIONWRITERS_H
  16. #include "dtoolbase.h"
  17. #include "functionWriter.h"
  18. #include <set>
  19. ////////////////////////////////////////////////////////////////////
  20. // Class : FunctionWriters
  21. // Description : A set of zero or more FunctionWriter pointers
  22. // accumulated by the various InterfaceMaker objects
  23. // that are generating code for one particular output
  24. // source file.
  25. ////////////////////////////////////////////////////////////////////
  26. class FunctionWriters {
  27. public:
  28. FunctionWriters();
  29. ~FunctionWriters();
  30. FunctionWriter *add_writer(FunctionWriter *writer);
  31. void write_prototypes(ostream &out);
  32. void write_code(ostream &out);
  33. protected:
  34. class IndirectCompareTo {
  35. public:
  36. bool operator () (const FunctionWriter *a, const FunctionWriter *b) const {
  37. return a->compare_to(*b) < 0;
  38. }
  39. };
  40. typedef set<FunctionWriter *, IndirectCompareTo> Writers;
  41. Writers _writers;
  42. };
  43. #endif