Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/egg-palettize/paletteGroups.h

Go to the documentation of this file.
00001 // Filename: paletteGroups.h
00002 // Created by:  drose (30Nov00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
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 //       Class : PaletteGroups
00031 // Description : A set of PaletteGroups.  This presents an interface
00032 //               very like an STL set, with a few additional
00033 //               functions.
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   // The TypedWritable interface follows.
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 &params);
00084 
00085 public:
00086   void fillin(DatagramIterator &scan, BamReader *manager);
00087 
00088 private:
00089   // This value is only filled in while reading from the bam file;
00090   // don't use it otherwise.
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 

Generated on Fri May 2 03:17:57 2003 for Panda-Tool by doxygen1.3