LocalVirtualMachine.h
Go to the documentation of this file.
00001 /*
00002         Aseba - an event-based framework for distributed robot control
00003         Copyright (C) 2007--2012:
00004                 Stephane Magnenat <stephane at magnenat dot net>
00005                 (http://stephane.magnenat.net)
00006                 and other contributors, see authors.txt for details
00007         
00008         This program is free software: you can redistribute it and/or modify
00009         it under the terms of the GNU Lesser General Public License as published
00010         by the Free Software Foundation, version 3 of the License.
00011         
00012         This program is distributed in the hope that it will be useful,
00013         but WITHOUT ANY WARRANTY; without even the implied warranty of
00014         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015         GNU Lesser General Public License for more details.
00016         
00017         You should have received a copy of the GNU Lesser General Public License
00018         along with this program. If not, see <http://www.gnu.org/licenses/>.
00019 */
00020 
00021 #ifndef VIRTUALMACHINE_H
00022 #define VIRTUALMACHINE_H
00023 
00024 #include "Target.h"
00025 #include "../compiler/compiler.h"
00026 #include "../vm/vm.h"
00027 
00028 namespace Aseba
00029 {
00031         class LocalVirtualMachine : public Target
00032         {
00033         public:
00035                 LocalVirtualMachine();
00036 
00037                 virtual bool connect() { return true; }
00038                 
00039                 virtual const TargetDescription * const getConstDescription() { return &description; }
00040                 virtual TargetDescription * getDescription() { return &description; }
00041                 virtual void uploadBytecode(const BytecodeVector &bytecode);
00042                 
00043                 virtual void sizesChanged();
00044                 
00045                 virtual void setupEvent(unsigned id);
00046                 
00047                 virtual void next();
00048                 virtual void runStepSwitch();
00049                 virtual void runBackground();
00050                 virtual void stop();
00051                 
00052                 virtual bool setBreakpoint(unsigned line);
00053                 virtual bool clearBreakpoint(unsigned line);
00054                 virtual void clearBreakpoints();
00055         
00056         public:
00057                 // The following functions should only be called by the VM C bindings. They call the corresponding Qt signals or popup a message box
00058                 void emitEvent(unsigned short id, unsigned short start, unsigned short length);
00059                 void emitArrayAccessOutOfBounds(unsigned short pc, unsigned short sp, unsigned short index);
00060                 void emitDivisionByZero(unsigned short pc, unsigned short sp);
00061                 
00062         protected:
00063                 void timerEvent(QTimerEvent *event);
00064                 
00065         protected:
00066                 TargetDescription description; 
00067                 bool runEvent; 
00068                 AsebaVMState vmState; 
00069                 std::valarray<uint16> vmBytecode; 
00070                 std::valarray<sint16> vmVariables; 
00071                 std::valarray<sint16> vmStack; 
00072                 BytecodeVector debugBytecode; 
00073         };
00074 }; // Aseba
00075 
00076 #endif


aseba
Author(s): Stéphane Magnenat
autogenerated on Thu Jan 2 2014 11:17:16