a generic simulated object that something can request service from
Inheritance:
Public Methods
-
Resource(const string newName = "Resource", const ID newID = 0)
- Default constructor
-
virtual ~Resource()
- Destructor
-
virtual bool activate(const int numberOfServers = 1)
- "Turn on" the resource.
-
FacStatus request(const Token& tkn)
- Request service from the resource
-
bool release(const int tkn_id)
- Stop using resource's service
-
bool clear(const int tkn_id)
- Release the facility from servicing the current token and dump any queued requests.
-
bool isServicing(const int tkn_id) const
-
-
TIME getInUseTime(void) const
- Returns the amount of time the facility has been in use during the simulation
Inherited from SimObj:
Public Methods
-
string getName(void) const
-
ID getID(void) const
-
void setName(const string newName)
-
void setID(const ID newID)
-
virtual 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
Resource(const string newName = "Resource", const ID newID = 0)
-
virtual ~Resource()
-
virtual 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.
FacStatus 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.
bool 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
bool clear(const int tkn_id)
-
bool isServicing(const int tkn_id) const
-
- Returns:
- true if the given token is receiving service from this resource. False
if it is not.
TIME 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++.