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