3
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
5
* This file is part of crtmpserver.
6
* crtmpserver is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* crtmpserver is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
20
#include "vm/baseappvirtualmachine.h"
21
#include "vm/lua/luaappvirtualmachine.h"
23
using namespace app_vmapp;
25
BaseAppVirtualMachine::BaseAppVirtualMachine() {
29
BaseAppVirtualMachine *BaseAppVirtualMachine::GetVM(string type, string script,
30
BaseClientApplication *pApplication) {
31
BaseAppVirtualMachine *pResult = NULL;
33
//1. Instantiate the VM
38
else if (type == "lua") {
39
pResult = new LuaAppVirtualMachine();
40
pResult->_pApplication = pApplication;
43
if (pResult == NULL) {
44
FATAL("No machine with type %s available", STR(type));
49
if (!pResult->BindAPI()) {
50
FATAL("Unable to bind API");
55
//3. Initialize the virtual machine
56
if (!pResult->Initialize(script)) {
57
FATAL("Unable to initialize virtual machine with script %s", STR(script));
66
BaseAppVirtualMachine::~BaseAppVirtualMachine() {