A set of PaletteGroups. More...
#include "paletteGroups.h"
Public Member Functions | |
PaletteGroups (const PaletteGroups ©) | |
iterator | begin () const |
Returns an iterator suitable for traversing the set. More... | |
void | clear () |
Empties the set. More... | |
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. More... | |
size_type | count (PaletteGroup *group) const |
Returns the number of times the given group appears in the set. More... | |
bool | empty () const |
Returns true if the set is empty, false otherwise. More... | |
iterator | end () const |
Returns an iterator suitable for traversing the set. More... | |
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(). More... | |
virtual TypeHandle | get_type () const |
void | insert (PaletteGroup *group) |
Inserts a new group to the set, if it is not already there. More... | |
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. More... | |
void | make_intersection (const PaletteGroups &a, const PaletteGroups &b) |
Computes the intersection of PaletteGroups a and b, and stores the result in this object. More... | |
void | make_union (const PaletteGroups &a, const PaletteGroups &b) |
Computes the union of PaletteGroups a and b, and stores the result in this object. More... | |
void | operator= (const PaletteGroups ©) |
void | output (ostream &out) const |
void | remove_null () |
Removes the special "null" group from the set. More... | |
size_type | size () const |
Returns the number of elements in the set. More... | |
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. More... | |
![]() | |
TypedWritable (const TypedWritable ©) | |
virtual ReferenceCount * | as_reference_count () |
Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. More... | |
string | encode_to_bam_stream () const |
Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string. More... | |
bool | encode_to_bam_stream (string &data, BamWriter *writer=NULL) const |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. More... | |
virtual void | finalize (BamReader *manager) |
Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed. More... | |
virtual TypeHandle | force_init_type () |
UpdateSeq | get_bam_modified () const |
Returns the current bam_modified counter. More... | |
void | mark_bam_modified () |
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More... | |
void | operator= (const TypedWritable ©) |
virtual bool | require_fully_complete () const |
Some objects require all of their nested pointers to have been completed before the objects themselves can be completed. More... | |
virtual void | update_bam_nested (BamWriter *manager) |
Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates. More... | |
![]() | |
TypedObject (const TypedObject ©) | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
int | get_best_parent_from_Set (const std::set< int > &) const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More... | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. More... | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. More... | |
void | operator= (const TypedObject ©) |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
static void | register_with_read_factory () |
Registers the current object as something that can be read from a Bam file. More... | |
![]() | |
static bool | decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, const string &data, BamReader *reader=NULL) |
Reads the string created by a previous call to encode_to_bam_stream(), and extracts the single object on that string. More... | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
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. More... | |
Additional Inherited Members | |
![]() | |
static TypedWritable *const | Null = (TypedWritable*)0L |
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.
PaletteGroups::iterator PaletteGroups::begin | ( | ) | const |
Returns an iterator suitable for traversing the set.
Definition at line 233 of file paletteGroups.cxx.
Referenced by TextureImage::assign_groups(), EggFile::build_cross_links(), EggFile::choose_placements(), PaletteGroup::get_complete_placements(), PaletteGroup::set_dependency_level(), and PaletteGroup::set_dependency_order().
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().
|
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.
References TypedWritable::complete_pointers().
Referenced by EggFile::complete_pointers(), PaletteGroup::complete_pointers(), and TextureImage::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 |
Returns true if the set is empty, false otherwise.
Definition at line 213 of file paletteGroups.cxx.
Referenced by TextureImage::assign_groups(), EggFile::build_cross_links(), EggFile::choose_placements(), TextureImage::note_egg_file(), EggFile::write_description(), and TextureImage::write_source_pathnames().
PaletteGroups::iterator PaletteGroups::end | ( | ) | const |
Returns an iterator suitable for traversing the set.
Definition at line 243 of file paletteGroups.cxx.
Referenced by TextureImage::assign_groups(), EggFile::build_cross_links(), PaletteGroup::get_complete_placements(), PaletteGroup::set_dependency_level(), and PaletteGroup::set_dependency_order().
|
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 TypedWritable::fillin(), DatagramIterator::get_int32(), and BamReader::read_pointers().
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().
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().
|
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().
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().
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(), TypedWritable::write_datagram(), and BamWriter::write_pointer().
Referenced by EggFile::write_datagram(), PaletteGroup::write_datagram(), and TextureImage::write_datagram().