diff options
Diffstat (limited to 'python/gras/GRAS_Factory.i')
-rw-r--r-- | python/gras/GRAS_Factory.i | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/python/gras/GRAS_Factory.i b/python/gras/GRAS_Factory.i index 1124963..eca9d2e 100644 --- a/python/gras/GRAS_Factory.i +++ b/python/gras/GRAS_Factory.i @@ -30,25 +30,18 @@ namespace gras %pythoncode %{ #TODO we need to register this into the real factory _py_factory = dict() -%} -%extend gras::Factory -{ - %insert("python") - %{ - @staticmethod - def register_make(name, fcn): - #TODO we need to register this into the real factory - _py_factory[name] = fcn - - @staticmethod - def make(name, *args, **kwargs): - - #first try the local to python py factory #TODO real factory - if name in _py_factory: return _py_factory[name](*args, **kwargs) - - from PMC import PMC_M - pmcargs = PMC_M(list(args)) - return Factory._handle_make(name, pmcargs) - %} -} +def register_make(name, fcn): + #TODO we need to register this into the real factory + _py_factory[name] = fcn + +def make(name, *args, **kwargs): + + #first try the local to python py factory #TODO real factory + if name in _py_factory: return _py_factory[name](*args, **kwargs) + + from PMC import PMC_M + pmcargs = PMC_M(list(args)) + return Factory._handle_make(name, pmcargs) + +%} |