Panda3D
Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions

PaletteGroups Class Reference

A set of PaletteGroups. More...

#include "paletteGroups.h"

Inheritance diagram for PaletteGroups:
TypedWritable TypedObject MemoryBase

List of all members.

Public Types

typedef Groups::const_iterator const_iterator
typedef Groups::const_pointer const_pointer
typedef Groups::const_reference const_reference
typedef
Groups::const_reverse_iterator 
const_reverse_iterator
typedef Groups::difference_type difference_type
typedef Groups::const_iterator iterator
typedef Groups::const_pointer pointer
typedef Groups::const_reference reference
typedef
Groups::const_reverse_iterator 
reverse_iterator
typedef Groups::size_type size_type

Public Member Functions

 PaletteGroups (const PaletteGroups &copy)
iterator begin () const
 Returns an iterator suitable for traversing the set.
void clear ()
 Empties the set.
virtual int complete_pointers (TypedWritable **p_list, BamReader *manager)
 Called after the object is otherwise completely read from a Bam file, this function's job is to store the pointers that were retrieved from the Bam file for each pointer object written.
size_type count (PaletteGroup *group) const
 Returns the number of times the given group appears in the set.
bool empty () const
 Returns true if the set is empty, false otherwise.
iterator end () const
 Returns an iterator suitable for traversing the set.
void fillin (DatagramIterator &scan, BamReader *manager)
 Reads the binary data from the given datagram iterator, which was written by a previous call to write_datagram().
virtual TypeHandle get_type () const
void insert (PaletteGroup *group)
 Inserts a new group to the set, if it is not already there.
void make_complete (const PaletteGroups &a)
 Completes the set with the transitive closure of all dependencies: for each PaletteGroup already in the set a, all of the groups that it depends on are added to the set, and so on.
void make_intersection (const PaletteGroups &a, const PaletteGroups &b)
 Computes the intersection of PaletteGroups a and b, and stores the result in this object.
void make_union (const PaletteGroups &a, const PaletteGroups &b)
 Computes the union of PaletteGroups a and b, and stores the result in this object.
void operator= (const PaletteGroups &copy)
void output (ostream &out) const
void remove_null ()
 Removes the special "null" group from the set.
size_type size () const
 Returns the number of elements in the set.
void write (ostream &out, int indent_level=0) const
virtual void write_datagram (BamWriter *writer, Datagram &datagram)
 Fills the indicated datagram up with a binary representation of the current object, in preparation for writing to a Bam file.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()
 This function is declared non-inline to work around a compiler bug in g++ 2.96.
static void register_with_read_factory ()
 Registers the current object as something that can be read from a Bam file.

Static Protected Member Functions

static TypedWritablemake_PaletteGroups (const FactoryParams &params)
 This method is called by the BamReader when an object of this type is encountered in a Bam file; it should allocate and return a new object with all the data read.

Detailed Description

A set of PaletteGroups.

This presents an interface very like an STL set, with a few additional functions.

Definition at line 31 of file paletteGroups.h.


Member Function Documentation

PaletteGroups::iterator PaletteGroups::begin ( ) const
void PaletteGroups::clear ( void  )

Empties the set.

Definition at line 203 of file paletteGroups.cxx.

Referenced by EggFile::build_cross_links(), PaletteGroup::clear_depends(), and EggFile::match_txa_groups().

int PaletteGroups::complete_pointers ( TypedWritable **  p_list,
BamReader manager 
) [virtual]

Called after the object is otherwise completely read from a Bam file, this function's job is to store the pointers that were retrieved from the Bam file for each pointer object written.

The return value is the number of pointers processed from the list.

Reimplemented from TypedWritable.

Definition at line 359 of file paletteGroups.cxx.

Referenced by TextureImage::complete_pointers(), PaletteGroup::complete_pointers(), and EggFile::complete_pointers().

PaletteGroups::size_type PaletteGroups::count ( PaletteGroup group) const

Returns the number of times the given group appears in the set.

This is either 1 if it appears at all, or 0 if it does not appear.

Definition at line 77 of file paletteGroups.cxx.

Referenced by EggFile::choose_placements().

bool PaletteGroups::empty ( ) const
PaletteGroups::iterator PaletteGroups::end ( ) const
void PaletteGroups::fillin ( DatagramIterator scan,
BamReader manager 
) [virtual]

Reads the binary data from the given datagram iterator, which was written by a previous call to write_datagram().

Reimplemented from TypedWritable.

Definition at line 396 of file paletteGroups.cxx.

References DatagramIterator::get_int32(), and BamReader::read_pointers().

Referenced by TextureImage::fillin(), PaletteGroup::fillin(), EggFile::fillin(), and make_PaletteGroups().

static void PaletteGroups::init_type ( ) [inline, static]

This function is declared non-inline to work around a compiler bug in g++ 2.96.

Making it inline seems to cause problems in the optimizer.

Reimplemented from TypedWritable.

Definition at line 96 of file paletteGroups.h.

void PaletteGroups::insert ( PaletteGroup group)

Inserts a new group to the set, if it is not already there.

Definition at line 65 of file paletteGroups.cxx.

Referenced by TextureImage::assign_groups(), EggFile::build_cross_links(), PaletteGroup::group_with(), and TxaLine::parse().

void PaletteGroups::make_complete ( const PaletteGroups a)

Completes the set with the transitive closure of all dependencies: for each PaletteGroup already in the set a, all of the groups that it depends on are added to the set, and so on.

The indicated set a may be the same as this set.

Definition at line 91 of file paletteGroups.cxx.

Referenced by EggFile::build_cross_links(), PaletteGroup::get_complete_placements(), and Palettizer::report_statistics().

void PaletteGroups::make_intersection ( const PaletteGroups a,
const PaletteGroups b 
)

Computes the intersection of PaletteGroups a and b, and stores the result in this object.

The result may be the same object as either a or b.

Definition at line 154 of file paletteGroups.cxx.

Referenced by TextureImage::assign_groups(), and EggFile::choose_placements().

TypedWritable * PaletteGroups::make_PaletteGroups ( const FactoryParams params) [static, protected]

This method is called by the BamReader when an object of this type is encountered in a Bam file; it should allocate and return a new object with all the data read.

Definition at line 378 of file paletteGroups.cxx.

References fillin().

Referenced by register_with_read_factory().

void PaletteGroups::make_union ( const PaletteGroups a,
const PaletteGroups b 
)

Computes the union of PaletteGroups a and b, and stores the result in this object.

The result may be the same object as either a or b.

Definition at line 110 of file paletteGroups.cxx.

Referenced by TextureImage::assign_groups(), TxaLine::match_texture(), and EggFile::match_txa_groups().

void PaletteGroups::register_with_read_factory ( ) [static]

Registers the current object as something that can be read from a Bam file.

Definition at line 326 of file paletteGroups.cxx.

References BamReader::get_factory(), and make_PaletteGroups().

void PaletteGroups::remove_null ( )

Removes the special "null" group from the set.

This is a special group that egg files may be assigned to, but which textures never are; it indicates that the egg file should not influence the palette assignment.

Definition at line 187 of file paletteGroups.cxx.

Referenced by TextureImage::assign_groups(), and TxaLine::match_texture().

PaletteGroups::size_type PaletteGroups::size ( ) const

Returns the number of elements in the set.

Definition at line 223 of file paletteGroups.cxx.

Referenced by Palettizer::report_statistics().

void PaletteGroups::write_datagram ( BamWriter writer,
Datagram datagram 
) [virtual]

Fills the indicated datagram up with a binary representation of the current object, in preparation for writing to a Bam file.

Reimplemented from TypedWritable.

Definition at line 339 of file paletteGroups.cxx.

References Datagram::add_uint32(), and BamWriter::write_pointer().

Referenced by TextureImage::write_datagram(), PaletteGroup::write_datagram(), and EggFile::write_datagram().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations