verbose output for CullBinManager

This commit is contained in:
David Rose 2005-10-14 21:39:46 +00:00
parent 0d8cfd3131
commit 9601c8c2cb
3 changed files with 52 additions and 1 deletions

View File

@ -80,7 +80,6 @@ get_bin(int n) const {
// Access: Published
// Description: Returns the name of the bin with the indicated
// bin_index (where bin_index was retrieved by get_bin()
// or find_bin()). The bin's name may not be changed
// during the life of the bin.
////////////////////////////////////////////////////////////////////

View File

@ -175,6 +175,24 @@ find_bin(const string &name) const {
return -1;
}
////////////////////////////////////////////////////////////////////
// Function: CullBinManager::write
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
void CullBinManager::
write(ostream &out) const {
if (!_bins_are_sorted) {
((CullBinManager *)this)->do_sort_bins();
}
SortedBins::const_iterator sbi;
for (sbi = _sorted_bins.begin(); sbi != _sorted_bins.end(); ++sbi) {
int bin_index = (*sbi);
out << get_bin_name(bin_index) << ", " << get_bin_type(bin_index)
<< ", " << get_bin_sort(bin_index) << "\n";
}
}
////////////////////////////////////////////////////////////////////
// Function: CullBinManager::get_global_ptr
// Access: Published, Static
@ -334,3 +352,32 @@ parse_bin_type(const string &bin_type) {
return BT_invalid;
}
}
////////////////////////////////////////////////////////////////////
// Function: CullBinManager::BinType output operator
// Description:
////////////////////////////////////////////////////////////////////
ostream &
operator << (ostream &out, CullBinManager::BinType bin_type) {
switch (bin_type) {
case CullBinManager::BT_invalid:
return out << "invalid";
case CullBinManager::BT_unsorted:
return out << "unsorted";
case CullBinManager::BT_state_sorted:
return out << "state_sorted";
case CullBinManager::BT_back_to_front:
return out << "back_to_front";
case CullBinManager::BT_front_to_back:
return out << "front_to_back";
case CullBinManager::BT_fixed:
return out << "fixed";
}
return out << "**invalid BinType(" << (int)bin_type << ")**";
}

View File

@ -62,6 +62,8 @@ PUBLISHED:
INLINE int get_bin_sort(int bin_index) const;
INLINE void set_bin_sort(int bin_index, int sort);
void write(ostream &out) const;
static CullBinManager *get_global_ptr();
public:
@ -102,6 +104,9 @@ private:
friend class SortBins;
};
EXPCL_PANDA ostream &
operator << (ostream &out, CullBinManager::BinType bin_type);
#include "cullBinManager.I"
#endif