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 (std::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 (std::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... | |
Public Member Functions inherited from TypedWritable | |
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... | |
vector_uchar | encode_to_bam_stream () const |
Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object. More... | |
bool | encode_to_bam_stream (vector_uchar &data, BamWriter *writer=nullptr) 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... | |
Public Member Functions inherited from TypedObject | |
TypedObject (const TypedObject ©)=default | |
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... | |
TypedObject & | operator= (const TypedObject ©)=default |
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 Public Member Functions inherited from TypedWritable | |
static bool | decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, vector_uchar data, BamReader *reader=nullptr) |
Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts the single object on those bytes. More... | |
static TypeHandle | get_class_type () |
static void | init_type () |
Static Public Member Functions inherited from TypedObject | |
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 | |
Public Attributes inherited from TypedObject | |
get_type | |
Static Public Attributes inherited from TypedWritable | |
static TypedWritable *const | Null = nullptr |
A set of PaletteGroups.
This presents an interface very like an STL set, with a few additional functions.
Definition at line 28 of file paletteGroups.h.
PaletteGroups::iterator PaletteGroups::begin | ( | ) | const |
Returns an iterator suitable for traversing the set.
Definition at line 200 of file paletteGroups.cxx.
Referenced by TextureImage::assign_groups(), EggFile::choose_placements(), PaletteGroup::get_complete_placements(), PaletteGroup::set_dependency_level(), and PaletteGroup::set_dependency_order().
void PaletteGroups::clear | ( | ) |
Empties the set.
Definition at line 176 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 308 of file paletteGroups.cxx.
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 64 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 184 of file paletteGroups.cxx.
Referenced by TextureImage::assign_groups(), EggFile::build_cross_links(), EggFile::choose_placements(), and EggFile::write_description().
PaletteGroups::iterator PaletteGroups::end | ( | ) | const |
Returns an iterator suitable for traversing the set.
Definition at line 208 of file paletteGroups.cxx.
Referenced by TextureImage::assign_groups(), 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 339 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 55 of file paletteGroups.cxx.
Referenced by TextureImage::assign_groups(), EggFile::build_cross_links(), and PaletteGroup::group_with().
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 75 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 132 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 91 of file paletteGroups.cxx.
Referenced by TextureImage::assign_groups(), and EggFile::match_txa_groups().
|
static |
Registers the current object as something that can be read from a Bam file.
Definition at line 281 of file paletteGroups.cxx.
References BamReader::get_factory().
Referenced by init_palettizer().
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 162 of file paletteGroups.cxx.
Referenced by TextureImage::assign_groups().
PaletteGroups::size_type PaletteGroups::size | ( | ) | const |
Returns the number of elements in the set.
Definition at line 192 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 291 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().