diff options
author | Josh Blum | 2013-07-07 20:06:02 -0700 |
---|---|---|
committer | Josh Blum | 2013-07-07 20:06:02 -0700 |
commit | 0793d5b373f0d6ed54b08765be09cc8250fe7f6a (patch) | |
tree | e1d40a47845e7155cb0c0ae2dce584a7fde94762 /python | |
parent | cfd9e8146f7589f3f04fea979c741267b0454546 (diff) | |
download | sandhi-0793d5b373f0d6ed54b08765be09cc8250fe7f6a.tar.gz sandhi-0793d5b373f0d6ed54b08765be09cc8250fe7f6a.tar.bz2 sandhi-0793d5b373f0d6ed54b08765be09cc8250fe7f6a.zip |
gras: some tweaks to factory
Diffstat (limited to 'python')
-rw-r--r-- | python/gras/GRAS_Factory.i | 19 | ||||
-rw-r--r-- | python/gras/__init__.py | 2 |
2 files changed, 9 insertions, 12 deletions
diff --git a/python/gras/GRAS_Factory.i b/python/gras/GRAS_Factory.i index e324d27..b3ba44b 100644 --- a/python/gras/GRAS_Factory.i +++ b/python/gras/GRAS_Factory.i @@ -23,19 +23,16 @@ namespace gras %include <gras/factory.hpp> //////////////////////////////////////////////////////////////////////// -// Create python methods for factories +// Create python make method for the factory //////////////////////////////////////////////////////////////////////// -%pythoncode%{ - -class StaticPyFactory(object): - - def __getattr__(self, name): +%extend gras::Factory +{ + %insert("python") + %{ + @staticmethod def make(name, *args): from PMC import PMC_M pmcargs = PMC_M(list(args)) return Factory._handle_make(name, pmcargs) - return lambda *args: make(name, *args) - -PyFactory = StaticPyFactory() - -%} + %} +} diff --git a/python/gras/__init__.py b/python/gras/__init__.py index 4add913..3c16388 100644 --- a/python/gras/__init__.py +++ b/python/gras/__init__.py @@ -10,7 +10,7 @@ from GRAS_SBuffer import SBufferConfig, SBuffer from GRAS_Tags import Tag, StreamTag, PacketMsg from GRAS_TimeTag import TimeTag from GRAS_Element import Element -from GRAS_Factory import PyFactory as Factory +from GRAS_Factory import Factory import GRAS_Block import GRAS_HierBlock import GRAS_TopBlock |