~yade-dev/yade/0.80

« back to all changes in this revision

Viewing changes to pkg/common/PyRunner.hpp

  • Committer: Anton Gladky
  • Date: 2012-05-02 21:50:42 UTC
  • Revision ID: gladky.anton@gmail.com-20120502215042-v1fa9r65usqe7kfk
0.80.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// 2008 © Václav Šmilauer <eudoxos@arcig.cz>
 
2
#pragma once
 
3
#include<yade/core/GlobalEngine.hpp>
 
4
#include<yade/core/Scene.hpp>
 
5
#include<yade/pkg/common/PeriodicEngines.hpp>
 
6
#include<yade/lib/pyutil/gil.hpp>
 
7
 
 
8
class PyRunner: public PeriodicEngine {
 
9
        public :
 
10
                /* virtual bool isActivated: not overridden, PeriodicEngine handles that */
 
11
                virtual void action(){ if(command.size()>0) pyRunString(command); }
 
12
        YADE_CLASS_BASE_DOC_ATTRS(PyRunner,PeriodicEngine,
 
13
                "Execute a python command periodically, with defined (and adjustable) periodicity. See :yref:`PeriodicEngine` documentation for details.",
 
14
                ((string,command,"",,"Command to be run by python interpreter. Not run if empty."))
 
15
        );
 
16
};
 
17
REGISTER_SERIALIZABLE(PyRunner);
 
18