35 #ifndef _DATABASE_VIRTUAL_MACHINE_PROGRAM_CODE_HPP_INCLUDED
36 #define _DATABASE_VIRTUAL_MACHINE_PROGRAM_CODE_HPP_INCLUDED
41 #include <boost/shared_ptr.hpp>
68 m_ar.push_back( instr);
71 throw std::runtime_error(
"program code size out of range");
79 if (adr >=
m_ar.size())
throw std::runtime_error(
"address out of bounds");
87 if (adr >=
m_ar.size())
throw std::runtime_error(
"address out of bounds");
136 typedef std::vector<Instruction>::iterator
iterator;
InstructionSet::Address Address
Definition: programCode.hpp:55
ProgramCode & operator()(OpCode opcode, unsigned int arg=0)
More readable program instruction definition operator (no condition -> always executed) ...
Definition: programCode.hpp:112
Definition: instructionSet.hpp:307
Instruction & operator[](const Address &adr)
Get an instruction reference by address (instruction index starting with 0)
Definition: programCode.hpp:77
iterator begin()
Get the program start iterator.
Definition: programCode.hpp:143
InstructionSet::Instruction Instruction
Definition: programCode.hpp:52
Defines the instruction set of the virtual machine defining database transactions.
void append(const ProgramCode &prg)
Append the code of another program without joining argument sets.
Definition: programCode.hpp:121
InstructionSet::CondCode CondCode
Definition: programCode.hpp:53
Definition: instructionSet.hpp:58
Definition: instructionSet.hpp:415
static void printProgramRaw(std::ostream &out, const std::vector< Instruction > &prg)
Print the program code without any symbolic information that is not available here.
Definition: instructionSet.hpp:368
void add(const Instruction &instr)
Add one instruction.
Definition: programCode.hpp:66
CondCode
Enumeration of conditional codes.
Definition: instructionSet.hpp:305
const_iterator at(const Address &adr) const
Get an iterator by address (instruction pointer)
Definition: programCode.hpp:147
InstructionSet::OpCode OpCode
Definition: programCode.hpp:54
boost::uint32_t Address
Address in program code.
Definition: instructionSet.hpp:326
void printRaw(std::ostream &out) const
Print the program code without any symbolic information that is not available here.
Definition: programCode.hpp:152
boost::uint32_t Instruction
Instruction.
Definition: instructionSet.hpp:328
ProgramCode(const ProgramCode &o)
Copy constructor.
Definition: programCode.hpp:61
const_iterator begin() const
Get the program start iterator.
Definition: programCode.hpp:139
Address size() const
Get size of the program code in instructions.
Definition: programCode.hpp:93
std::vector< Instruction >::const_iterator const_iterator
Definition: programCode.hpp:135
static Instruction instruction(CondCode cond, OpCode opcode, unsigned int arg=0)
Build an instruction from its parts.
Definition: instructionSet.hpp:335
iterator end()
Get the program end iterator.
Definition: programCode.hpp:145
std::vector< Instruction >::iterator iterator
Definition: programCode.hpp:136
const Instruction & operator[](const Address &adr) const
Get an instruction const reference by address (instruction index starting with 0) ...
Definition: programCode.hpp:85
const_iterator end() const
Get the program end iterator.
Definition: programCode.hpp:141
std::vector< Instruction > m_ar
Definition: programCode.hpp:158
The structure for the program code as array of instructions.
Definition: programCode.hpp:49
ProgramCode & operator()(CondCode cond, OpCode opcode, unsigned int arg=0)
More readable program instruction definition operator.
Definition: programCode.hpp:103
ProgramCode()
Default constructor.
Definition: programCode.hpp:59
OpCode
Implemented operation codes of the VM.
Definition: instructionSet.hpp:55
iterator at(const Address &adr)
Get an iterator by address (instruction pointer)
Definition: programCode.hpp:149