internalNameCollection.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /**
  2. * PANDA 3D SOFTWARE
  3. * Copyright (c) Carnegie Mellon University. All rights reserved.
  4. *
  5. * All use of this software is subject to the terms of the revised BSD
  6. * license. You should have received a copy of this license along
  7. * with this source code in a file named "LICENSE."
  8. *
  9. * @file internalNameCollection.h
  10. * @author drose
  11. * @date 2002-03-16
  12. */
  13. #ifndef INTERNALNAMECOLLECTION_H
  14. #define INTERNALNAMECOLLECTION_H
  15. #include "pandabase.h"
  16. #include "pointerToArray.h"
  17. #include "internalName.h"
  18. /**
  19. *
  20. */
  21. class EXPCL_PANDA_PGRAPH InternalNameCollection {
  22. PUBLISHED:
  23. InternalNameCollection();
  24. InternalNameCollection(const InternalNameCollection &copy);
  25. void operator = (const InternalNameCollection &copy);
  26. INLINE ~InternalNameCollection();
  27. void add_name(const InternalName *name);
  28. bool remove_name(const InternalName *name);
  29. void add_names_from(const InternalNameCollection &other);
  30. void remove_names_from(const InternalNameCollection &other);
  31. void remove_duplicate_names();
  32. bool has_name(const InternalName *name) const;
  33. void clear();
  34. int get_num_names() const;
  35. const InternalName *get_name(int index) const;
  36. MAKE_SEQ(get_names, get_num_names, get_name);
  37. const InternalName *operator [] (int index) const;
  38. int size() const;
  39. INLINE void operator += (const InternalNameCollection &other);
  40. INLINE InternalNameCollection operator + (const InternalNameCollection &other) const;
  41. void output(std::ostream &out) const;
  42. void write(std::ostream &out, int indent_level = 0) const;
  43. private:
  44. typedef PTA(CPT(InternalName)) InternalNames;
  45. InternalNames _names;
  46. };
  47. INLINE std::ostream &operator << (std::ostream &out, const InternalNameCollection &col) {
  48. col.output(out);
  49. return out;
  50. }
  51. #include "internalNameCollection.I"
  52. #endif