*** empty log message ***

This commit is contained in:
David Rose 2000-11-30 03:26:25 +00:00
parent bd49219670
commit 615a0bc06c
8 changed files with 162 additions and 4 deletions

View File

@ -2133,11 +2133,20 @@ define_method(CPPInstance *function, InterrogateType &itype,
force_publish = true; force_publish = true;
} }
if ((ftype->_flags & CPPFunctionType::F_destructor) != 0) {
// A destructor is a special case. If it's public, we export it
// (even if it's not published), but if it's protected or private,
// we don't exported it, and we flag it so we don't try to
// synthesize one later.
if (function->_vis > V_public) {
itype._flags |= InterrogateType::F_private_destructor;
return;
}
force_publish = true;
}
if (!force_publish && function->_vis > min_vis) { if (!force_publish && function->_vis > min_vis) {
// The function is not marked to be exported. // The function is not marked to be exported.
if ((ftype->_flags & CPPFunctionType::F_destructor) != 0) {
itype._flags |= InterrogateType::F_private_destructor;
}
return; return;
} }
@ -2165,7 +2174,9 @@ define_method(CPPInstance *function, InterrogateType &itype,
} }
if ((function->_storage_class & CPPInstance::SC_inherited_virtual) != 0 && if ((function->_storage_class & CPPInstance::SC_inherited_virtual) != 0 &&
struct_type->_derivation.size() == 1) { struct_type->_derivation.size() == 1 &&
struct_type->_derivation[0]._vis <= V_public &&
!struct_type->_derivation[0]._is_virtual) {
// If this function is a virtual function whose first appearance // If this function is a virtual function whose first appearance
// is in some base class, we don't need to repeat its definition // is in some base class, we don't need to repeat its definition
// here, since we're already inheriting it properly. However, we // here, since we're already inheriting it properly. However, we

View File

@ -52,6 +52,7 @@ public:
INLINE void draw_direct(Node *node, INLINE void draw_direct(Node *node,
const AllAttributesWrapper &initial_state); const AllAttributesWrapper &initial_state);
PUBLISHED:
void output(ostream &out) const; void output(ostream &out) const;
void write(ostream &out, int indent_level = 0) const; void write(ostream &out, int indent_level = 0) const;

View File

@ -100,6 +100,30 @@ release_all_textures() {
get_ptr()->ns_release_all_textures(); get_ptr()->ns_release_all_textures();
} }
////////////////////////////////////////////////////////////////////
// Function: TexturePool::garbage_collect
// Access: Public, Static
// Description: Releases only those textures in the pool that have a
// reference count of exactly 1; i.e. only those
// textures that are not being used outside of the pool.
// Returns the number of textures released.
////////////////////////////////////////////////////////////////////
INLINE int TexturePool::
garbage_collect() {
return get_ptr()->ns_garbage_collect();
}
////////////////////////////////////////////////////////////////////
// Function: TexturePool::list_contents
// Access: Public, Static
// Description: Lists the contents of the texture pool to the
// indicated output stream.
////////////////////////////////////////////////////////////////////
INLINE void TexturePool::
list_contents(ostream &out) {
get_ptr()->ns_list_contents(out);
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: TexturePool::Constructor // Function: TexturePool::Constructor
// Access: Private // Access: Private

View File

@ -136,6 +136,49 @@ ns_release_all_textures() {
_textures.clear(); _textures.clear();
} }
////////////////////////////////////////////////////////////////////
// Function: TexturePool::ns_garbage_collect
// Access: Private
// Description: The nonstatic implementation of garbage_collect().
////////////////////////////////////////////////////////////////////
int TexturePool::
ns_garbage_collect() {
int num_released = 0;
Textures new_set;
Textures::iterator ti;
for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
Texture *tex = (*ti).second;
if (tex->get_ref_count() == 1) {
if (gobj_cat.is_debug()) {
gobj_cat.debug()
<< "Releasing " << (*ti).first << "\n";
}
num_released++;
} else {
new_set.insert(new_set.end(), *ti);
}
}
_textures.swap(new_set);
return num_released;
}
////////////////////////////////////////////////////////////////////
// Function: TexturePool::ns_list_contents
// Access: Private
// Description: The nonstatic implementation of list_contents().
////////////////////////////////////////////////////////////////////
void TexturePool::
ns_list_contents(ostream &out) {
out << _textures.size() << " textures:\n";
Textures::iterator ti;
for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
out << " " << (*ti).first
<< " (count = " << (*ti).second->get_ref_count() << ")\n";
}
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: TexturePool::get_ptr // Function: TexturePool::get_ptr
// Access: Private, Static // Access: Private, Static

View File

@ -36,6 +36,10 @@ PUBLISHED:
INLINE static void release_texture(Texture *texture); INLINE static void release_texture(Texture *texture);
INLINE static void release_all_textures(); INLINE static void release_all_textures();
INLINE static int garbage_collect();
INLINE static void list_contents(ostream &out);
private: private:
INLINE TexturePool(); INLINE TexturePool();
@ -45,6 +49,8 @@ private:
void ns_add_texture(Texture *texture); void ns_add_texture(Texture *texture);
void ns_release_texture(Texture *texture); void ns_release_texture(Texture *texture);
void ns_release_all_textures(); void ns_release_all_textures();
int ns_garbage_collect();
void ns_list_contents(ostream &out);
static TexturePool *get_ptr(); static TexturePool *get_ptr();

View File

@ -81,6 +81,30 @@ release_all_models() {
get_ptr()->ns_release_all_models(); get_ptr()->ns_release_all_models();
} }
////////////////////////////////////////////////////////////////////
// Function: ModelPool::garbage_collect
// Access: Public, Static
// Description: Releases only those models in the pool that have a
// reference count of exactly 1; i.e. only those
// models that are not being used outside of the pool.
// Returns the number of models released.
////////////////////////////////////////////////////////////////////
INLINE int ModelPool::
garbage_collect() {
return get_ptr()->ns_garbage_collect();
}
////////////////////////////////////////////////////////////////////
// Function: ModelPool::list_contents
// Access: Public, Static
// Description: Lists the contents of the model pool to the
// indicated output stream.
////////////////////////////////////////////////////////////////////
INLINE void ModelPool::
list_contents(ostream &out) {
get_ptr()->ns_list_contents(out);
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: ModelPool::Constructor // Function: ModelPool::Constructor
// Access: Private // Access: Private

View File

@ -90,6 +90,49 @@ ns_release_all_models() {
_models.clear(); _models.clear();
} }
////////////////////////////////////////////////////////////////////
// Function: ModelPool::ns_garbage_collect
// Access: Private
// Description: The nonstatic implementation of garbage_collect().
////////////////////////////////////////////////////////////////////
int ModelPool::
ns_garbage_collect() {
int num_released = 0;
Models new_set;
Models::iterator ti;
for (ti = _models.begin(); ti != _models.end(); ++ti) {
Node *node = (*ti).second;
if (node->get_ref_count() == 1) {
if (loader_cat.is_debug()) {
loader_cat.debug()
<< "Releasing " << (*ti).first << "\n";
}
num_released++;
} else {
new_set.insert(new_set.end(), *ti);
}
}
_models.swap(new_set);
return num_released;
}
////////////////////////////////////////////////////////////////////
// Function: ModelPool::ns_list_contents
// Access: Private
// Description: The nonstatic implementation of list_contents().
////////////////////////////////////////////////////////////////////
void ModelPool::
ns_list_contents(ostream &out) {
out << _models.size() << " models:\n";
Models::iterator ti;
for (ti = _models.begin(); ti != _models.end(); ++ti) {
out << " " << (*ti).first
<< " (count = " << (*ti).second->get_ref_count() << ")\n";
}
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: ModelPool::get_ptr // Function: ModelPool::get_ptr
// Access: Private, Static // Access: Private, Static

View File

@ -42,6 +42,10 @@ PUBLISHED:
INLINE static void release_model(const string &filename); INLINE static void release_model(const string &filename);
INLINE static void release_all_models(); INLINE static void release_all_models();
INLINE static int garbage_collect();
INLINE static void list_contents(ostream &out);
private: private:
INLINE ModelPool(); INLINE ModelPool();
@ -50,6 +54,8 @@ private:
void ns_add_model(const string &filename, Node *model); void ns_add_model(const string &filename, Node *model);
void ns_release_model(const string &filename); void ns_release_model(const string &filename);
void ns_release_all_models(); void ns_release_all_models();
int ns_garbage_collect();
void ns_list_contents(ostream &out);
static ModelPool *get_ptr(); static ModelPool *get_ptr();