00001 // Filename: internalNameCollection.h 00002 // Created by: drose (16Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef INTERNALNAMECOLLECTION_H 00016 #define INTERNALNAMECOLLECTION_H 00017 00018 #include "pandabase.h" 00019 #include "pointerToArray.h" 00020 #include "internalName.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Class : InternalNameCollection 00024 // Description : 00025 //////////////////////////////////////////////////////////////////// 00026 class EXPCL_PANDA_PGRAPH InternalNameCollection { 00027 PUBLISHED: 00028 InternalNameCollection(); 00029 InternalNameCollection(const InternalNameCollection ©); 00030 void operator = (const InternalNameCollection ©); 00031 INLINE ~InternalNameCollection(); 00032 00033 void add_name(InternalName *name); 00034 bool remove_name(InternalName *name); 00035 void add_names_from(const InternalNameCollection &other); 00036 void remove_names_from(const InternalNameCollection &other); 00037 void remove_duplicate_names(); 00038 bool has_name(InternalName *name) const; 00039 void clear(); 00040 00041 int get_num_names() const; 00042 InternalName *get_name(int index) const; 00043 MAKE_SEQ(get_names, get_num_names, get_name); 00044 InternalName *operator [] (int index) const; 00045 int size() const; 00046 INLINE void operator += (const InternalNameCollection &other); 00047 INLINE InternalNameCollection operator + (const InternalNameCollection &other) const; 00048 00049 void output(ostream &out) const; 00050 void write(ostream &out, int indent_level = 0) const; 00051 00052 private: 00053 typedef PTA(PT(InternalName)) InternalNames; 00054 InternalNames _names; 00055 }; 00056 00057 INLINE ostream &operator << (ostream &out, const InternalNameCollection &col) { 00058 col.output(out); 00059 return out; 00060 } 00061 00062 #include "internalNameCollection.I" 00063 00064 #endif 00065 00066