contur2
Loading...
Searching...
No Matches
contur::ProcessImage Class Reference

Full in-memory representation of a process. More...

#include <process_image.h>

Public Member Functions

 ProcessImage (ProcessId id, std::string name, std::vector< Block > code, Priority priority=Priority{}, Tick arrivalTime=0)
 Constructs a ProcessImage with the given parameters.
 ~ProcessImage ()
 ProcessImage (const ProcessImage &)=delete
ProcessImageoperator= (const ProcessImage &)=delete
 ProcessImage (ProcessImage &&) noexcept
ProcessImageoperator= (ProcessImage &&) noexcept
const PCBpcb () const noexcept
 Returns a const reference to the PCB.
PCBpcb () noexcept
 Returns a mutable reference to the PCB.
const RegisterFileregisters () const noexcept
 Returns a const reference to the register file.
RegisterFileregisters () noexcept
 Returns a mutable reference to the register file.
const std::vector< Block > & code () const noexcept
 Returns a const reference to the code segment.
std::size_t codeSize () const noexcept
 Returns the size of the code segment (number of Blocks).
const BlockreadCode (std::size_t offset) const
 Reads a single Block from the code segment.
void setCode (std::vector< Block > newCode)
 Replaces the code segment with new code.
ProcessId id () const noexcept
 Returns the process ID.
std::string_view name () const noexcept
 Returns the process name.
ProcessState state () const noexcept
 Returns the current process state.
const Prioritypriority () const noexcept
 Returns the process priority.

Private Attributes

std::unique_ptr< Impl > impl_

Detailed Description

Full in-memory representation of a process.

Contains all data needed to execute a process:

  • PCB for lifecycle management
  • Code segment (vector<Block>) for the interpreter
  • RegisterFile for CPU context save/restore

Ownership: ProcessImage owns all three components.

Definition at line 35 of file process_image.h.

Constructor & Destructor Documentation

◆ ProcessImage() [1/3]

contur::ProcessImage::ProcessImage ( ProcessId id,
std::string name,
std::vector< Block > code,
Priority priority = Priority{},
Tick arrivalTime = 0 )

Constructs a ProcessImage with the given parameters.

Parameters
idUnique process identifier.
nameHuman-readable process name.
codeThe program code (vector of Blocks).
priorityProcess priority (defaults to Normal).
arrivalTimeSimulation tick at creation.

◆ ~ProcessImage()

contur::ProcessImage::~ProcessImage ( )

◆ ProcessImage() [2/3]

contur::ProcessImage::ProcessImage ( const ProcessImage & )
delete

◆ ProcessImage() [3/3]

contur::ProcessImage::ProcessImage ( ProcessImage && )
noexcept

Member Function Documentation

◆ code()

const std::vector< Block > & contur::ProcessImage::code ( ) const
nodiscardnoexcept

Returns a const reference to the code segment.

◆ codeSize()

std::size_t contur::ProcessImage::codeSize ( ) const
nodiscardnoexcept

Returns the size of the code segment (number of Blocks).

◆ id()

ProcessId contur::ProcessImage::id ( ) const
nodiscardnoexcept

Returns the process ID.

◆ name()

std::string_view contur::ProcessImage::name ( ) const
nodiscardnoexcept

Returns the process name.

◆ operator=() [1/2]

ProcessImage & contur::ProcessImage::operator= ( const ProcessImage & )
delete

◆ operator=() [2/2]

ProcessImage & contur::ProcessImage::operator= ( ProcessImage && )
noexcept

◆ pcb() [1/2]

const PCB & contur::ProcessImage::pcb ( ) const
nodiscardnoexcept

Returns a const reference to the PCB.

◆ pcb() [2/2]

PCB & contur::ProcessImage::pcb ( )
nodiscardnoexcept

Returns a mutable reference to the PCB.

◆ priority()

const Priority & contur::ProcessImage::priority ( ) const
nodiscardnoexcept

Returns the process priority.

◆ readCode()

const Block & contur::ProcessImage::readCode ( std::size_t offset) const
nodiscard

Reads a single Block from the code segment.

Parameters
offsetIndex into the code segment.
Returns
The Block at the given offset.
Precondition
offset < codeSize()

◆ registers() [1/2]

const RegisterFile & contur::ProcessImage::registers ( ) const
nodiscardnoexcept

Returns a const reference to the register file.

◆ registers() [2/2]

RegisterFile & contur::ProcessImage::registers ( )
nodiscardnoexcept

Returns a mutable reference to the register file.

◆ setCode()

void contur::ProcessImage::setCode ( std::vector< Block > newCode)

Replaces the code segment with new code.

Parameters
newCodeThe replacement program.

◆ state()

ProcessState contur::ProcessImage::state ( ) const
nodiscardnoexcept

Returns the current process state.

Member Data Documentation

◆ impl_

std::unique_ptr<Impl> contur::ProcessImage::impl_
private

Definition at line 104 of file process_image.h.


The documentation for this class was generated from the following file: