Panda3D
Public Member Functions | Public Attributes | List of all members
ClassTypeDescriptor Class Reference
Inheritance diagram for ClassTypeDescriptor:
BaseTypeDescriptor

Public Member Functions

def __init__ (self)
 
def copyExtensions (self, extensionsDir, file, nesting)
 
def copyParentMethods (self, file, nesting)
 
def copyParentMethodsRecursively (self, parentList, file, nesting)
 
def cullOverloadedMethods (self)
 
def filterOutStaticMethods (self)
 
def generateCode (self, file, nesting, extensionsDir=None)
 
def generateCode1 (self, file, nesting, extensionsDir=None)
 
def generateCode2 (self, file, nesting, extensionsDir, file1module)
 
def generateGlobalCode (self, dir, extensionsDir)
 
def generateOverloadedMethods (self, file, nesting)
 
def generateReturnValueWrapper (self, classTypeDesc, file, userManagesMemory, needsDowncast, nesting)
 indent(file, nesting, 'returnObject.this = returnValue
') Zero this pointers get returned as the Python None object indent(file, nesting, 'if (returnObject.this == 0): return None
') if userManagesMemory: indent(file, nesting, 'returnObject.userManagesMemory = 1
') else: indent(file, nesting, 'returnObject.userManagesMemory = 0
') More...
 
def getCModules (self)
 
def getCModulesRecursively (self, parent)
 
def getExtensionModuleName (self)
 
def getReturnTypeModules (self)
 
def hasMethodNamed (self, methodName)
 
def inheritsMethodNamed (self, parentList, methodName)
 
def outputBaseConstructor (self, file, nesting)
 
def outputBaseDestructor (self, file, nesting)
 
def outputBaseImports (self, file)
 
def outputClassCModules (self, file, nesting)
 
def outputClassComment (self, file, nesting)
 
def outputClassFooter (self, file)
 
def outputClassHeader (self, file, nesting)
 
def outputEmptyConstructor (self, file, nesting)
 
def outputEmptyDestructor (self, file, nesting)
 
def outputImports (self, file, nesting)
 
def outputImportsRecursively (self, parent, file, nesting)
 
def outputNestedTypes (self, file, nesting)
 
def recordClassMethod (self, methodSpec)
 
def recordInstanceMethod (self, methodSpec)
 
def recordOverloadedMethods (self)
 
- Public Member Functions inherited from BaseTypeDescriptor
def __init__ (self)
 
def generateGlobalCode (self, dir, extensionsDir)
 
def generateReturnValueWrapper (self, classTypeDesc, file, userManagesMemory, needsDowncast, nesting)
 
def getFullNestedName (self)
 
def isAtomic (self)
 
def recordOverloadedMethods (self)
 
def recursiveTypeDescriptor (self)
 

Public Attributes

 CModules
 
 constructors
 
 destructor
 
 downcastMethods
 
 foreignTypeName
 
 instanceMethods
 
 nestedTypes
 
 overloadedClassMethods
 
 overloadedInstanceMethods
 
 returnTypeModules
 
 staticMethods
 
 upcastMethods
 
- Public Attributes inherited from BaseTypeDescriptor
 atomicType
 
 comment
 
 foreignTypeName
 
 isNested
 
 moduleName
 
 outerType
 
 parentTypes
 
 prototype
 
 typeIndex
 

Detailed Description

This describes a C++ class. It holds lists of all its methods too.
It can also generate Python shadow class code for itself.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self)

Member Function Documentation

◆ copyExtensions()

def copyExtensions (   self,
  extensionsDir,
  file,
  nesting 
)
Copy in the extension file for this class if one exists
If you want to extend a C++ file, create a file in the extensions directory and
this will append that extension file to the generated code file.

◆ copyParentMethods()

def copyParentMethods (   self,
  file,
  nesting 
)
At multiple inheritance nodes, copy all the parent methods into
this class and call them after upcasting us to that class

◆ copyParentMethodsRecursively()

def copyParentMethodsRecursively (   self,
  parentList,
  file,
  nesting 
)
Copy all the parents instance methods
Do not copy functions if this class already has a function with that name
We need to recurse up the hierarchy copying all our parents nodes all
the way up the tree stopping either at the top, or at another MI node
that has already copied his parent's methods in
Note: Do not copy the downcast methods

◆ cullOverloadedMethods()

def cullOverloadedMethods (   self)
Find all the entries that have multiple indexes for the same method name
Get rid of all others. Do this for class methods and instance methods

◆ filterOutStaticMethods()

def filterOutStaticMethods (   self)
Run through the list of instance methods and filter out the
ones that are static class methods. We can tell this because they
do not have a this pointer in their arg list. Those methods that
are static are then placed in a new staticMethods list and the ones
that are left are stored back in the instanceMethods list. We are
avoiding modifying the instanceMethods list in place while traversing it.
Do not check upcast or downcast methods because we know they are not static.

◆ generateCode()

def generateCode (   self,
  file,
  nesting,
  extensionsDir = None 
)

◆ generateCode1()

def generateCode1 (   self,
  file,
  nesting,
  extensionsDir = None 
)

◆ generateCode2()

def generateCode2 (   self,
  file,
  nesting,
  extensionsDir,
  file1module 
)

◆ generateGlobalCode()

def generateGlobalCode (   self,
  dir,
  extensionsDir 
)
Generate shadow class code for this type.
We make our own file form our foreignTypeName and put it in the dir
passed in.

◆ generateOverloadedMethods()

def generateOverloadedMethods (   self,
  file,
  nesting 
)
Generate code for all the overloaded methods of this class

◆ generateReturnValueWrapper()

def generateReturnValueWrapper (   self,
  classTypeDesc,
  file,
  userManagesMemory,
  needsDowncast,
  nesting 
)

indent(file, nesting, 'returnObject.this = returnValue
') Zero this pointers get returned as the Python None object indent(file, nesting, 'if (returnObject.this == 0): return None
') if userManagesMemory: indent(file, nesting, 'returnObject.userManagesMemory = 1
') else: indent(file, nesting, 'returnObject.userManagesMemory = 0
')

Generate code that creates a shadow object of this type
then sets the this pointer and returns the object. We call the
class destructor with None as the only parameter to get an
empty shadow object.

◆ getCModules()

def getCModules (   self)
Return a list of all the C modules this class references

◆ getCModulesRecursively()

def getCModulesRecursively (   self,
  parent 
)

◆ getExtensionModuleName()

def getExtensionModuleName (   self)
Return a filename for the extensions for this class
Example: NodePath extensions would be found in NodePath-extensions.py

◆ getReturnTypeModules()

def getReturnTypeModules (   self)
Return a list of all the other shadow class modules this
class references.
Be careful about nested types

◆ hasMethodNamed()

def hasMethodNamed (   self,
  methodName 
)

◆ inheritsMethodNamed()

def inheritsMethodNamed (   self,
  parentList,
  methodName 
)
returns true if the named method is a method on this class, or
on any parent class except the last one in the list.

◆ outputBaseConstructor()

def outputBaseConstructor (   self,
  file,
  nesting 
)
Output the __init__ constructor for this class.
There is special login if you pass in None to the constructor, you
will not get an actual C object with memory, you will just get the
shadow class shell object. This is useful for functions that want
to return this type that already have a this pointer and just need
to construct a shadow object to contain it.

◆ outputBaseDestructor()

def outputBaseDestructor (   self,
  file,
  nesting 
)
This destructor overwrites the builtin Python destructor
using the __del__ method. This will get called whenever a
Python object is garbage collected. We are going to overwrite
it with special cleanup for Panda.

◆ outputBaseImports()

def outputBaseImports (   self,
  file 
)

◆ outputClassCModules()

def outputClassCModules (   self,
  file,
  nesting 
)

◆ outputClassComment()

def outputClassComment (   self,
  file,
  nesting 
)
Output the class comment to the file

◆ outputClassFooter()

def outputClassFooter (   self,
  file 
)

◆ outputClassHeader()

def outputClassHeader (   self,
  file,
  nesting 
)
Output the class definition to the file

◆ outputEmptyConstructor()

def outputEmptyConstructor (   self,
  file,
  nesting 
)
If there is no C++ constructor, we output code for a runtime error
You really do not want to create a class with a null this pointer

◆ outputEmptyDestructor()

def outputEmptyDestructor (   self,
  file,
  nesting 
)
If there is no C++ destructor, we just output this
empty one instead

◆ outputImports()

def outputImports (   self,
  file,
  nesting 
)
Generate code that imports the modules we need for this class

◆ outputImportsRecursively()

def outputImportsRecursively (   self,
  parent,
  file,
  nesting 
)

◆ outputNestedTypes()

def outputNestedTypes (   self,
  file,
  nesting 
)

◆ recordClassMethod()

def recordClassMethod (   self,
  methodSpec 
)
Record all class methods in a 2 level dictionary so we can go
through them and see which are overloaded
{ className: {methodName: [methodSpec, methodSpec, methodSpec]}}

◆ recordInstanceMethod()

def recordInstanceMethod (   self,
  methodSpec 
)
Record all instance methods in a 2 level dictionary so we can go
through them and see which are overloaded
{ className: {methodName: [methodSpec, methodSpec, methodSpec]}}

◆ recordOverloadedMethods()

def recordOverloadedMethods (   self)
Record all the methods in dictionaries based on method name
so we can see if they are overloaded

Member Data Documentation

◆ CModules

CModules

◆ constructors

constructors

◆ destructor

destructor

◆ downcastMethods

downcastMethods

◆ foreignTypeName

foreignTypeName

◆ instanceMethods

instanceMethods

◆ nestedTypes

nestedTypes

◆ overloadedClassMethods

overloadedClassMethods

◆ overloadedInstanceMethods

overloadedInstanceMethods

◆ returnTypeModules

returnTypeModules

◆ staticMethods

staticMethods

◆ upcastMethods

upcastMethods