Skip to content
Snippets Groups Projects
Commit 2caff345 authored by florent's avatar florent
Browse files

Implement a function that creates a python class for for each entity C++ class

	  * src/dynamic_graph/entity.py.
parent 9ba9c957
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,32 @@
"""
import wrap, signal_base
entityList = []
def initEntity(self, name):
"""
Common constructor of Entity classes
"""
Entity.__init__(self, self.class_name, name)
def updateEntityClasses():
entityTypeList = wrap.factory_get_entity_class_list()
for e in entityTypeList:
class metacls(type):
def __new__(mcs, name, bases, dict):
return type.__new__(mcs, name, bases, dict)
# Create new class
a = metacls(e, (Entity,), {})
# Store class name in class member
a.class_name = e
print ("new class %s"%e)
# set class constructor
setattr(a, '__init__', initEntity)
# Store new class in dictionary with class name
globals()[e] = a
class Entity (object) :
"""
This class binds dynamicgraph::Entity C++ class
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment