class Resource

a generic simulated object that something can request service from

Inheritance:


Public Methods

[more] Resource(const string newName = "Resource", const ID newID = 0)
Default constructor
[more]virtual ~Resource()
Destructor
[more]virtual bool activate(const int numberOfServers = 1)
"Turn on" the resource.
[more]FacStatus request(const Token& tkn)
Request service from the resource
[more]bool release(const int tkn_id)
Stop using resource's service
[more]bool clear(const int tkn_id)
Release the facility from servicing the current token and dump any queued requests.
[more]bool isServicing(const int tkn_id) const
[more]TIME getInUseTime(void) const
Returns the amount of time the facility has been in use during the simulation


Inherited from SimObj:

Public Methods

ostring getName(void) const
oID getID(void) const
ovoid setName(const string newName)
ovoid setID(const ID newID)
ovirtual string toString(void) const


Documentation

A resource is just a SimObj with a SIMPACK facility attached to it (plus attendant methods to make interfacing with the facility easy). Every object in the simulation that provides a service (e.g. CPU, RAM) should be a child of resource

o Resource(const string newName = "Resource", const ID newID = 0)

ovirtual ~Resource()

ovirtual bool activate(const int numberOfServers = 1)
Nothing can request service from resources until they are activated. Once activated, a resource can not be turned off.

oFacStatus request(const Token& tkn)
A token can request service from a resource. If the resource is not busy, it will accept the request.
Returns:
Whether the resource was busy or not.

obool release(const int tkn_id)
Every time something finishes with a resource, they must release it. It is the only way the resource knows that it is done.
Returns:
True if the resource was released. False if the token was never receiving service from this resource in the first place

obool clear(const int tkn_id)

obool isServicing(const int tkn_id) const
Returns:
true if the given token is receiving service from this resource. False if it is not.

oTIME getInUseTime(void) const
This method is mainly used for collecting metrics.


Direct child classes:
NetSwitch
Link
Disk
CPU
Author:
John Oleszkiewicz

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.