From af8a72f8287a14c2d6cafde8f0feeba45c54c849 Mon Sep 17 00:00:00 2001 From: aignacio_sf <> Date: Fri, 8 Dec 2006 03:38:52 +0000 Subject: [PATCH] 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. --- panda/src/pgraph/modelPool.I | 10 ++++++++++ panda/src/pgraph/modelPool.cxx | 10 +++++++--- panda/src/pgraph/modelPool.h | 1 + 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/panda/src/pgraph/modelPool.I b/panda/src/pgraph/modelPool.I index 9037576808..da95626d3e 100644 --- a/panda/src/pgraph/modelPool.I +++ b/panda/src/pgraph/modelPool.I @@ -157,6 +157,16 @@ list_contents(ostream &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 // Access: Private diff --git a/panda/src/pgraph/modelPool.cxx b/panda/src/pgraph/modelPool.cxx index fd40e952a2..da7ffb84dc 100644 --- a/panda/src/pgraph/modelPool.cxx +++ b/panda/src/pgraph/modelPool.cxx @@ -218,12 +218,16 @@ void ModelPool:: ns_list_contents(ostream &out) const { MutexHolder holder(_lock); - out << _models.size() << " models:\n"; + out << "model pool contents:\n"; + Models::const_iterator ti; for (ti = _models.begin(); ti != _models.end(); ++ti) { - out << " " << (*ti).first - << " (count = " << (*ti).second->get_model_ref_count() << ")\n"; + out << (*ti).first << "\n" + << " (count = " << (*ti).second->get_model_ref_count() + << ")\n"; } + + out << "total number of models: " << _models.size() << "\n"; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pgraph/modelPool.h b/panda/src/pgraph/modelPool.h index 2655ca5aff..a36790079a 100644 --- a/panda/src/pgraph/modelPool.h +++ b/panda/src/pgraph/modelPool.h @@ -67,6 +67,7 @@ PUBLISHED: INLINE static int garbage_collect(); INLINE static void list_contents(ostream &out); + INLINE static void list_contents(); static void write(ostream &out); private: