Talk:FGPythonSys

From FlightGear wiki
Revision as of 16:18, 11 February 2016 by Hooray (talk | contribs) (→‎FGNasalSys vs FGPythonSys - common baseclass: http://forum.flightgear.org/viewtopic.php?f=6&p=275777#p275754)
Jump to navigation Jump to search

FGNasalSys vs FGPythonSys - common baseclass

These are APIs that are sufficiently generic in nature to be moved to a common baseclass that can be shared by FGPythonSys/FGNasalSys:

  • printlog(), i.e. wrapping SG_LOG() [1]
  • loadModule()
  • loadPropertyScripts()
  • addcommand()/removecomand()
  • runfgcommand() (with locking, e.g. using SGMutex)


class FGScriptingSystem : public SGSubsystem, public SGPropertyChangeListener {
public:
    FGScriptingSystem();
    virtual ~FGScriptingSystem();

   const char* readfile(const char* file, int* lenOut);

    // Subsystem functions.
    virtual void init();
    virtual void reinit();
    virtual void bind();
    virtual void unbind();
    virtual void update(double dt);
protected:
    // Load and execute a script.
    bool loadModule(SGPath file, const char *module) = 0;
    virtual void loadPropertyScripts() = 0;
    virtual void loadPropertyScripts(SGPropertyNode *n) = 0;

private:

};