Rev 1625 | Rev 1947 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | SVN | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1601 | runge | 1 | /* |
| 2 | * |
||
| 3 | * Copyright (C) 2010 Mattias Runge |
||
| 4 | * |
||
| 5 | * This program is free software; you can redistribute it and/or modify |
||
| 6 | * it under the terms of the GNU General Public License as published by |
||
| 7 | * the Free Software Foundation; either version 2 of the License, or |
||
| 8 | * (at your option) any later version. |
||
| 9 | * |
||
| 10 | * This program is distributed in the hope that it will be useful, |
||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 13 | * GNU General Public License for more details. |
||
| 14 | * |
||
| 15 | * You should have received a copy of the GNU General Public License along |
||
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., |
||
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
||
| 18 | * |
||
| 19 | */ |
||
| 20 | |||
| 21 | #ifndef VM_PLUGIN_H |
||
| 22 | #define VM_PLUGIN_H |
||
| 23 | |||
| 24 | #include <string> |
||
| 25 | #include <map> |
||
| 26 | #include <vector> |
||
| 27 | |||
| 28 | #include <boost/shared_ptr.hpp> |
||
| 1625 | runge | 29 | #include <boost/asio.hpp> |
| 1604 | runge | 30 | #include <v8-debug.h> |
| 1601 | runge | 31 | |
| 32 | #include "types.h" |
||
| 33 | |||
| 34 | namespace atom { |
||
| 35 | namespace vm { |
||
| 36 | |||
| 37 | class Plugin |
||
| 38 | { |
||
| 39 | public: |
||
| 40 | typedef boost::shared_ptr<Plugin> Pointer; |
||
| 41 | |||
| 1625 | runge | 42 | Plugin(boost::asio::io_service& io_service); |
| 1601 | runge | 43 | virtual ~Plugin(); |
| 44 | |||
| 45 | std::string GetName(); |
||
| 46 | ExportFunctionList& GetExportFunctions(); |
||
| 47 | |||
| 48 | virtual void InitializeDone(); |
||
| 1647 | runge | 49 | virtual void CallOutput(unsigned int request_id, std::string output); |
| 1601 | runge | 50 | |
| 51 | protected: |
||
| 1604 | runge | 52 | typedef boost::shared_ptr<char> TrackerPointer; |
| 53 | |||
| 1601 | runge | 54 | std::string name_; |
| 1604 | runge | 55 | TrackerPointer tracker_; |
| 1625 | runge | 56 | boost::asio::io_service& io_service_; |
| 1601 | runge | 57 | |
| 1647 | runge | 58 | bool Call(unsigned int request_id, std::string name, ArgumentListPointer arguments); |
| 1608 | runge | 59 | void Execute(unsigned int request_id, std::string code); |
| 1601 | runge | 60 | void ExportFunction(std::string name, v8::InvocationCallback function); |
| 1608 | runge | 61 | static bool ImportFunction(std::string name); |
| 1601 | runge | 62 | |
| 63 | private: |
||
| 64 | ExportFunctionList export_functions_; |
||
| 65 | }; |
||
| 66 | |||
| 67 | }; // namespace vm |
||
| 68 | }; // namespace atom |
||
| 69 | |||
| 70 | #endif // VM_PLUGIN_H |