#ifndef OSGSCRIPT_PYTHONSCRIPT
#define OSGSCRIPT_PYTHONSCRIPT 1

#include <osgScript/Export>
#include <osgScript/Script>

#ifndef OBJECT_DWA2002612_HPP
typedef void PyObject;
#endif

namespace osgScript {

/** PythonScript - is a subclass of Script
*/
class OSGSCRIPT_EXPORT PythonScript: public Script
{
    public :
        PythonScript();

        /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
        PythonScript(const PythonScript&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);

        META_Node(osgScript, PythonScript);

        virtual void traverse(osg::NodeVisitor& nv);

        inline void setUpdateFunc(const std::string& func) { _updateFunc = func;}
        inline void setUpdateFunc(const char* func) { _updateFunc = func;}
        inline const std::string& getUpdateFunc() const { return  _updateFunc;}

        inline void setPostUpdateFunc(const std::string& func) { _postUpdateFunc = func;}
        inline void setPostUpdateFunc(const char* func) { _postUpdateFunc = func;}
        inline const std::string& getPostUpdateFunc() const { return  _postUpdateFunc;}

        inline void setCullFunc(const std::string& func) { _cullFunc = func;}
        inline void setCullFunc(const char* func) { _cullFunc = func;}
        inline const std::string& getCullFunc() const { return  _cullFunc;}

        inline void setPostCullFunc(const std::string& func) { _postCullFunc = func;}
        inline void setPostCullFunc(const char* func) { _postCullFunc = func;}
        inline const std::string& getPostCullFunc() const { return  _postCullFunc;}

        inline void setInitFunc(const std::string& func) { _initFunc = func;}
        inline void setInitFunc(const char*  func) { _initFunc = func;}
        inline const std::string& getInitFunc() const { return  _initFunc;}

        inline void setInlineCode(const std::string& func) { _inlineCode = func;}
        inline void setInlineCode(const char*  func) { _inlineCode = func;}
        inline const std::string& getInlineCode() const { return  _inlineCode;}

        inline void setExternCode(const std::string& func) { _externCode = func;}
        inline void setExternCode(const char*  func) { _externCode = func;}
        inline const std::string& getExternCode() const { return  _externCode;}

        inline PyObject * getModule() { return _module; }
        inline PyObject * getUpdateHandle() { return _updateHandle; }
        inline PyObject * getPostUpdateHandle() { return _postUpdateHandle; }
        inline PyObject * getCullHandle() { return _cullHandle; }
        inline PyObject * getPostCullHandle() { return _postCullHandle; }
        inline PyObject * getInitHandle() { return _initHandle; }

    protected :
        virtual ~PythonScript();
        void setup();

        bool       _firstTime;       // On construction set to TRUE, when setup is successful set to FALSE
        PyObject * _module;          // The module in which our script is defined
        PyObject * _initHandle;      // Python handle to the init function, NULL if no init function
        PyObject * _updateHandle;
        PyObject * _postUpdateHandle;
        PyObject * _cullHandle;
        PyObject * _postCullHandle;

        std::string _updateFunc;
        std::string _postUpdateFunc;
        std::string _cullFunc;
        std::string _postCullFunc;
        std::string _initFunc;
        std::string _inlineCode;
        std::string _externCode;

};
} // namespace osgScript

#endif // define OSGSCRIPT_PYTHONSCRIPT
