Panda3D
|
A set of PaletteGroups. More...
#include "paletteGroups.h"
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 ©) | |
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 ©) |
void | output (std::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 (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. | |
![]() | |
TypedWritable (const TypedWritable ©) | |
virtual ReferenceCount * | as_reference_count () |
Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. | |
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. | |
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. | |
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. | |
virtual TypeHandle | force_init_type () |
UpdateSeq | get_bam_modified () const |
Returns the current bam_modified counter. | |
void | mark_bam_modified () |
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. | |
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. | |
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. | |
![]() | |
TypedObject (const TypedObject ©)=default | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. | |
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. | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. | |
TypedObject & | operator= (const TypedObject ©)=default |
![]() | |
void | operator delete (void *, void *) |
void | operator delete (void *ptr) |
void | operator delete[] (void *, void *) |
void | operator delete[] (void *ptr) |
void * | operator new (size_t size) |
void * | operator new (size_t size, void *ptr) |
void * | operator new[] (size_t size) |
void * | operator new[] (size_t size, void *ptr) |
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. | |
![]() | |
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. | |
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. | |
Additional Inherited Members | |
![]() | |
get_type | |
![]() | |
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.
typedef Groups::const_iterator PaletteGroups::const_iterator |
Definition at line 40 of file paletteGroups.h.
typedef Groups::const_pointer PaletteGroups::const_pointer |
Definition at line 35 of file paletteGroups.h.
typedef Groups::const_reference PaletteGroups::const_reference |
Definition at line 38 of file paletteGroups.h.
typedef Groups::const_reverse_iterator PaletteGroups::const_reverse_iterator |
Definition at line 42 of file paletteGroups.h.
typedef Groups::difference_type PaletteGroups::difference_type |
Definition at line 44 of file paletteGroups.h.
typedef Groups::const_iterator PaletteGroups::iterator |
Definition at line 39 of file paletteGroups.h.
typedef Groups::const_pointer PaletteGroups::pointer |
Definition at line 34 of file paletteGroups.h.
typedef Groups::const_reference PaletteGroups::reference |
Definition at line 37 of file paletteGroups.h.
typedef Groups::const_reverse_iterator PaletteGroups::reverse_iterator |
Definition at line 41 of file paletteGroups.h.
typedef Groups::size_type PaletteGroups::size_type |
Definition at line 43 of file paletteGroups.h.
PaletteGroups::PaletteGroups | ( | ) |
Definition at line 30 of file paletteGroups.cxx.
PaletteGroups::PaletteGroups | ( | const PaletteGroups & | copy | ) |
Definition at line 37 of file paletteGroups.cxx.
PaletteGroups::iterator PaletteGroups::begin | ( | ) | const |
Returns an iterator suitable for traversing the set.
Definition at line 199 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 | ( | ) |
Empties the set.
Definition at line 175 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 307 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 63 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 183 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 207 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 338 of file paletteGroups.cxx.
References TypedWritable::fillin(), DatagramIterator::get_int32(), and BamReader::read_pointers().
|
inlinestatic |
Definition at line 90 of file paletteGroups.h.
|
inlinevirtual |
Reimplemented from TypedWritable.
Definition at line 98 of file paletteGroups.h.
|
inlinestatic |
Definition at line 93 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 54 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 74 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 131 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 90 of file paletteGroups.cxx.
Referenced by TextureImage::assign_groups(), TxaLine::match_texture(), and EggFile::match_txa_groups().
void PaletteGroups::operator= | ( | const PaletteGroups & | copy | ) |
Definition at line 46 of file paletteGroups.cxx.
void PaletteGroups::output | ( | std::ostream & | out | ) | const |
Definition at line 215 of file paletteGroups.cxx.
|
static |
Registers the current object as something that can be read from a Bam file.
Definition at line 280 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 161 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 191 of file paletteGroups.cxx.
Referenced by Palettizer::report_statistics().
void PaletteGroups::write | ( | std::ostream & | out, |
int | indent_level = 0 ) const |
Definition at line 241 of file paletteGroups.cxx.
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 290 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().