IBMPC::VirtualMachine Class Reference

#include <ibmpc.h>

Collaboration diagram for IBMPC::VirtualMachine:

Collaboration graph
[legend]
List of all members.

Detailed Description

This is base class for virtual machines.

Definition at line 459 of file ibmpc.h.

Public Member Functions

 VirtualMachine ()
 Create virtual system.
 ~VirtualMachine ()
 Destroy virtual system and release all allocated resources.
void register_driver (Device *driver)
 Attaches driver to this virtual system.
void unregister_driver (Device *driver)
 Detaches driver from this virtual system.
int drivers_count ()
 Returns number of drivers installed (can be used for enumeration).
Deviceget_driver (int index)
 Returns pointer to one of installed drivers.
Devicefind_driver (std::string name)
 Searches among installed drivers by name.
void reset ()
 Reset virtual system (simulate effect of the RESET button on the real IBM PC).
void run (unsigned int cycles)
 Run the virtual machine.
bool was_error () const
 Return true if error occurred inside the virtual machine.
void set_debug (bool debug_on, bool debug_pause)
 Set debugging state.


Constructor & Destructor Documentation

IBMPC::VirtualMachine::VirtualMachine (  ) 

Create virtual system.

Note:
memory is created, but not reserved or allocated - you must do it. Also, no drivers are initially attached. You should attach needed drivers after creation.

Definition at line 311 of file ibmpc.cpp.

IBMPC::VirtualMachine::~VirtualMachine (  ) 

Destroy virtual system and release all allocated resources.

Before exiting, the destructor walks over all installed drivers, and detaches them (causing their done() method to be called)

Definition at line 340 of file ibmpc.cpp.


Member Function Documentation

void IBMPC::VirtualMachine::register_driver ( Device driver  ) 

Attaches driver to this virtual system.

Note:
The virtual machine will manage pointer to this driver (no need to delete it). Internally, this method calls init() method of the driver.

Definition at line 350 of file ibmpc.cpp.

Referenced by VirtualMachine().

void IBMPC::VirtualMachine::unregister_driver ( Device driver  ) 

Detaches driver from this virtual system.

Note:
if driver was not previously installed this is an error. Internally, this method calls done() method of the driver.
Todo:
throw exception in this case?

Definition at line 362 of file ibmpc.cpp.

int IBMPC::VirtualMachine::drivers_count (  ) 

Returns number of drivers installed (can be used for enumeration).

Definition at line 377 of file ibmpc.cpp.

Device * IBMPC::VirtualMachine::get_driver ( int  index  ) 

Returns pointer to one of installed drivers.

Parameters:
index should be (index>=0 and index<=drivers_count())
Returns:
pointer to driver, or NULL if index is out of range.

Definition at line 382 of file ibmpc.cpp.

Device * IBMPC::VirtualMachine::find_driver ( std::string  name  ) 

Searches among installed drivers by name.

Returns:
pointer to driver if found, or NULL if driver with given name is not found.

Definition at line 387 of file ibmpc.cpp.

void IBMPC::VirtualMachine::reset (  ) 

Reset virtual system (simulate effect of the RESET button on the real IBM PC).

Definition at line 396 of file ibmpc.cpp.

void IBMPC::VirtualMachine::run ( unsigned int  cycles  ) 

Run the virtual machine.

Definition at line 402 of file ibmpc.cpp.

bool IBMPC::VirtualMachine::was_error (  )  const

Return true if error occurred inside the virtual machine.

Definition at line 408 of file ibmpc.cpp.

void IBMPC::VirtualMachine::set_debug ( bool  debug_on,
bool  debug_pause 
)

Set debugging state.

Definition at line 413 of file ibmpc.cpp.


The documentation for this class was generated from the following files:
Generated on Sat Sep 9 03:50:55 2006 for Openem APIs by  doxygen 1.4.7