48 _groups = copy._groups;
56 _groups.insert(group);
65 return _groups.count(group);
78 Groups::const_iterator gi;
79 for (gi = a._groups.begin(); gi != a._groups.end(); ++gi) {
80 r_make_complete(result, *gi);
94 Groups::const_iterator ai, bi;
95 ai = a._groups.begin();
96 bi = b._groups.begin();
98 while (ai != a._groups.end() && bi != b._groups.end()) {
100 u.insert(u.end(), *ai);
103 }
else if ((*bi) < (*ai)) {
104 u.insert(u.end(), *bi);
108 u.insert(u.end(), *ai);
114 while (ai != a._groups.end()) {
115 u.insert(u.end(), *ai);
119 while (bi != b._groups.end()) {
120 u.insert(u.end(), *bi);
135 Groups::const_iterator ai, bi;
136 ai = a._groups.begin();
137 bi = b._groups.begin();
139 while (ai != a._groups.end() && bi != b._groups.end()) {
143 }
else if ((*bi) < (*ai)) {
147 i.insert(i.end(), *ai);
164 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
165 if ((*gi)->get_name() ==
"null") {
185 return _groups.empty();
193 return _groups.size();
201 return _groups.begin();
209 return _groups.end();
216 output(std::ostream &out)
const {
217 if (!_groups.empty()) {
220 group_vector.reserve(_groups.size());
221 Groups::const_iterator gi;
222 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
223 group_vector.push_back(*gi);
225 sort(group_vector.begin(), group_vector.end(),
229 out << (*gvi)->get_name();
231 while (gvi != group_vector.end()) {
232 out <<
" " << (*gvi)->get_name();
242 write(std::ostream &out,
int indent_level)
const {
245 group_vector.reserve(_groups.size());
246 Groups::const_iterator gi;
247 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
248 group_vector.push_back(*gi);
250 sort(group_vector.begin(), group_vector.end(),
254 for (gvi = group_vector.begin(); gvi != group_vector.end(); ++gvi) {
255 indent(out, indent_level) << (*gvi)->get_name() <<
"\n";
265 bool inserted = result.insert(group).second;
268 Groups::const_iterator gi;
269 for (gi = group->_dependent._groups.begin();
270 gi != group->_dependent._groups.end();
272 r_make_complete(result, *gi);
283 register_factory(get_class_type(), make_PaletteGroups);
295 Groups::const_iterator gi;
296 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
310 for (
int i = 0; i < _num_groups; i++) {
312 DCAST_INTO_R(group, p_list[pi++], i);
313 _groups.insert(group);
330 me->
fillin(scan, manager);
void make_intersection(const PaletteGroups &a, const PaletteGroups &b)
Computes the intersection of PaletteGroups a and b, and stores the result in this object.
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...
iterator end() const
Returns an iterator suitable for traversing the set.
void remove_null()
Removes the special "null" group from the set.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
virtual void write_datagram(BamWriter *writer, Datagram &datagram)
Fills the indicated datagram up with a binary representation of the current object,...
Base class for objects that can be written to and read from Bam files.
iterator begin() const
Returns an iterator suitable for traversing the set.
size_type count(PaletteGroup *group) const
Returns the number of times the given group appears in the set.
This is the highest level of grouping for TextureImages.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
size_type size() const
Returns the number of elements in 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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void clear()
Empties the set.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
int32_t get_int32()
Extracts a signed 32-bit integer.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class's make_from_bam() method to read in all...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
void add_uint32(uint32_t value)
Adds an unsigned 32-bit integer to the datagram.
This is our own Panda specialization on the default STL vector.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
void read_pointers(DatagramIterator &scan, int count)
A convenience function to read a contiguous list of pointers.
An STL function object class, this is intended to be used on any ordered collection of pointers to cl...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool empty() const
Returns true if the set is empty, false otherwise.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void make_complete(const PaletteGroups &a)
Completes the set with the transitive closure of all dependencies: for each PaletteGroup already in t...
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 insert(PaletteGroup *group)
Inserts a new group to the set, if it is not already there.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Registers the current object as something that can be read from a Bam file.
A class to retrieve the individual data elements previously stored in a Datagram.
TypeHandle is the identifier used to differentiate C++ class types.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to a Bam file.