00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef PALETTEGROUPS_H
00016 #define PALETTEGROUPS_H
00017
00018 #include "pandatoolbase.h"
00019 #include "typedWritable.h"
00020 #include "pset.h"
00021
00022 class PaletteGroup;
00023 class FactoryParams;
00024
00025
00026
00027
00028
00029
00030
00031 class PaletteGroups : public TypedWritable {
00032 private:
00033 typedef pset<PaletteGroup *> Groups;
00034
00035 public:
00036 #ifndef WIN32_VC
00037 typedef Groups::const_pointer pointer;
00038 typedef Groups::const_pointer const_pointer;
00039 #endif
00040 typedef Groups::const_reference reference;
00041 typedef Groups::const_reference const_reference;
00042 typedef Groups::const_iterator iterator;
00043 typedef Groups::const_iterator const_iterator;
00044 typedef Groups::const_reverse_iterator reverse_iterator;
00045 typedef Groups::const_reverse_iterator const_reverse_iterator;
00046 typedef Groups::size_type size_type;
00047 typedef Groups::difference_type difference_type;
00048
00049 PaletteGroups();
00050 PaletteGroups(const PaletteGroups ©);
00051 void operator =(const PaletteGroups ©);
00052
00053 void insert(PaletteGroup *group);
00054 size_type count(PaletteGroup *group) const;
00055 void make_complete(const PaletteGroups &a);
00056 void make_union(const PaletteGroups &a, const PaletteGroups &b);
00057 void make_intersection(const PaletteGroups &a, const PaletteGroups &b);
00058 void remove_null();
00059 void clear();
00060
00061 bool empty() const;
00062 size_type size() const;
00063 iterator begin() const;
00064 iterator end() const;
00065
00066 void output(ostream &out) const;
00067 void write(ostream &out, int indent_level = 0) const;
00068
00069 private:
00070 void r_make_complete(Groups &result, PaletteGroup *group);
00071
00072 Groups _groups;
00073
00074
00075 public:
00076 static void register_with_read_factory();
00077 virtual void write_datagram(BamWriter *writer, Datagram &datagram);
00078 virtual int complete_pointers(TypedWritable **p_list,
00079 BamReader *manager);
00080
00081 protected:
00082 static TypedWritable *make_PaletteGroups(const FactoryParams ¶ms);
00083
00084 public:
00085 void fillin(DatagramIterator &scan, BamReader *manager);
00086
00087 private:
00088
00089
00090 int _num_groups;
00091
00092 public:
00093 static TypeHandle get_class_type() {
00094 return _type_handle;
00095 }
00096 static void init_type() {
00097 TypedWritable::init_type();
00098 register_type(_type_handle, "PaletteGroups",
00099 TypedWritable::get_class_type());
00100 }
00101 virtual TypeHandle get_type() const {
00102 return get_class_type();
00103 }
00104
00105 private:
00106 static TypeHandle _type_handle;
00107 };
00108
00109 INLINE ostream &operator << (ostream &out, const PaletteGroups &groups) {
00110 groups.output(out);
00111 return out;
00112 }
00113
00114 #endif
00115