2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-21 17:12:22 +00:00

Clean up formatting to conform to coding convention.

[SVN r8000]
This commit is contained in:
Dave Abrahams
2000-10-18 14:49:20 +00:00
parent b43865d494
commit 49bd8a8651

View File

@@ -218,28 +218,26 @@ ExtensionClassBase::ExtensionClassBase(const char* name)
{
}
/*
This function is used in from_python() to convert wrapped classes that are
related by inheritance. The problem is this: although C++ provides all necessary
conversion operators, source and target of a conversion must be known at compile
time. However, in Python we want to convert classes at runtime. The solution is to
generate conversion functions at compile time, register them within the appropriate
class objects and call them when a particular runtime conversion is required.
If functions for any possible conversion have to be stored, their number will grow
qudratically. To reduce this number, we actually store only conversion functions
between adjacent levels in the inheritance tree. By traversing the tree recursively,
we can build any allowed conversion as a concatenation of simple conversions. This
traversal is done in the functions try_base_class_conversions() and
try_derived_class_conversions(). If a particular conversion is impossible, all
conversion functions will return a NULL pointer.
The function extract_object_from_holder() attempts to actually extract the pointer
to the contained object from an InstanceHolderBase (a wrapper class). A conversion
of the held object to 'T *' is allowed when the conversion
'dynamic_cast<InstanceHolder<T> *>(an_instance_holder_base)' succeeds.
*/
void * ExtensionClassBase::try_class_conversions(InstanceHolderBase* object) const
// This function is used in from_python() to convert wrapped classes that are
// related by inheritance. The problem is this: although C++ provides all necessary
// conversion operators, source and target of a conversion must be known at compile
// time. However, in Python we want to convert classes at runtime. The solution is to
// generate conversion functions at compile time, register them within the appropriate
// class objects and call them when a particular runtime conversion is required.
// If functions for any possible conversion have to be stored, their number will grow
// qudratically. To reduce this number, we actually store only conversion functions
// between adjacent levels in the inheritance tree. By traversing the tree recursively,
// we can build any allowed conversion as a concatenation of simple conversions. This
// traversal is done in the functions try_base_class_conversions() and
// try_derived_class_conversions(). If a particular conversion is impossible, all
// conversion functions will return a NULL pointer.
// The function extract_object_from_holder() attempts to actually extract the pointer
// to the contained object from an InstanceHolderBase (a wrapper class). A conversion
// of the held object to 'T *' is allowed when the conversion
// 'dynamic_cast<InstanceHolder<T> *>(an_instance_holder_base)' succeeds.
void* ExtensionClassBase::try_class_conversions(InstanceHolderBase* object) const
{
void* result = try_derived_class_conversions(object);
if(result)