Add list_contents function that takes no parameters which outputs to cout thus making it callable in Python.

Format the output so it is a bit easier to read.
This commit is contained in:
aignacio_sf 2006-12-08 03:38:52 +00:00
parent 335d5a8ade
commit af8a72f828
3 changed files with 18 additions and 3 deletions

View File

@ -157,6 +157,16 @@ list_contents(ostream &out) {
get_ptr()->ns_list_contents(out); get_ptr()->ns_list_contents(out);
} }
////////////////////////////////////////////////////////////////////
// Function: ModelPool::list_contents
// Access: Public, Static
// Description: Lists the contents of the model pool to cout.
////////////////////////////////////////////////////////////////////
INLINE void ModelPool::
list_contents() {
get_ptr()->ns_list_contents(cout);
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: ModelPool::Constructor // Function: ModelPool::Constructor
// Access: Private // Access: Private

View File

@ -218,12 +218,16 @@ void ModelPool::
ns_list_contents(ostream &out) const { ns_list_contents(ostream &out) const {
MutexHolder holder(_lock); MutexHolder holder(_lock);
out << _models.size() << " models:\n"; out << "model pool contents:\n";
Models::const_iterator ti; Models::const_iterator ti;
for (ti = _models.begin(); ti != _models.end(); ++ti) { for (ti = _models.begin(); ti != _models.end(); ++ti) {
out << " " << (*ti).first out << (*ti).first << "\n"
<< " (count = " << (*ti).second->get_model_ref_count() << ")\n"; << " (count = " << (*ti).second->get_model_ref_count()
<< ")\n";
} }
out << "total number of models: " << _models.size() << "\n";
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

View File

@ -67,6 +67,7 @@ PUBLISHED:
INLINE static int garbage_collect(); INLINE static int garbage_collect();
INLINE static void list_contents(ostream &out); INLINE static void list_contents(ostream &out);
INLINE static void list_contents();
static void write(ostream &out); static void write(ostream &out);
private: private: