The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::Resource Class Reference

The is the base class for all types of resources used by the SPARTA framework. More...

#include <Resource.hpp>

Inheritance diagram for sparta::Resource:

Public Member Functions

 Resource (TreeNode *rc)
 Construct resource with a resource container.
 
 Resource (TreeNode *rc, const std::string &name)
 Construct resource with a specific name and resource container.
 
 Resource (const std::string &name, const Clock *clk)
 Construct a Resource with the given name and clock having NO association with a resource container. This constructor is reserved for free-standing resources owned by other resources (not containers [TreeNodes])
 
virtual ~Resource ()
 Destroy!
 
const ClockgetClock () const
 
SchedulergetScheduler (const bool must_exist=true) const
 
std::string getName () const
 
TreeNodegetContainer ()
 Gets the TreeNode (container) for this resource (if any)
 
const TreeNodegetContainer () const
 Gets the TreeNode (container) for this resource (if any)
 
ResourceContainergetResourceContainer ()
 Gets the ResourceContainer for this resource (if any)
 
const ResourceContainergetResourceContainer () const
 Gets the ResourceContainer for this resource (if any)
 
virtual void addLink (TreeNode *node, const std::string &label)
 
virtual void activateLink (const std::string &label)
 
 Resource (const Resource &)=delete
 Disallow copying.
 
Resourceoperator= (const Resource &)=delete
 

Friends

class TreeNode
 Allow TreeNode access to onStartingTeardown_.
 

Detailed Description

The is the base class for all types of resources used by the SPARTA framework.

Definition at line 43 of file Resource.hpp.

Constructor & Destructor Documentation

◆ Resource() [1/3]

sparta::Resource::Resource ( TreeNode rc)

Construct resource with a resource container.

Parameters
rcResourceContainter that will hold this Resource until the Resource is destructed. Name and clock are extracted from this container. Must not be nullptr

◆ Resource() [2/3]

sparta::Resource::Resource ( TreeNode rc,
const std::string &  name 
)

Construct resource with a specific name and resource container.

Note
It is recommended to use another consturctor with the name extracted from the ResourceContainer instead of specifying a name.
Parameters
rcResourceContainter that will hold this Resource until the Resource is destructed. Clock is extracted from this container. Must not be nullptr
nameName to give the resource

◆ Resource() [3/3]

sparta::Resource::Resource ( const std::string &  name,
const Clock clk 
)

Construct a Resource with the given name and clock having NO association with a resource container. This constructor is reserved for free-standing resources owned by other resources (not containers [TreeNodes])

Parameters
clkThe clock this Resource belongs to
nameThe name of this Resource
Note
This constructor is deprecated

Member Function Documentation

◆ activateLink()

virtual void sparta::Resource::activateLink ( const std::string &  label)
inlinevirtual

Lets the resource know that one of its link are now active

Parameters
labelThe label of the TreeNode the container got linked with

Definition at line 139 of file Resource.hpp.

◆ addLink()

virtual void sparta::Resource::addLink ( TreeNode node,
const std::string &  label 
)
inlinevirtual

Lets the resource know when its container is linked with another TreeNode

Parameters
nodeThe TreeNode the container got linked with
labelThe label of the TreeNode the container got linked with

Definition at line 128 of file Resource.hpp.

◆ getClock()

const Clock * sparta::Resource::getClock ( ) const
Returns
Pointer to this resource's clock

◆ getContainer() [1/2]

TreeNode * sparta::Resource::getContainer ( )

Gets the TreeNode (container) for this resource (if any)

Note
TreeNode is a subclass of ResourcecContainer

◆ getContainer() [2/2]

const TreeNode * sparta::Resource::getContainer ( ) const

Gets the TreeNode (container) for this resource (if any)

Note
TreeNode is a subclass of ResourcecContainer

◆ getName()

std::string sparta::Resource::getName ( ) const
Returns
This Resource's name

◆ getScheduler()

Scheduler * sparta::Resource::getScheduler ( const bool  must_exist = true) const
Returns
Pointer to this resource's scheduler

Friends And Related Symbol Documentation

◆ TreeNode

friend class TreeNode
friend

Allow TreeNode access to onStartingTeardown_.

Definition at line 46 of file Resource.hpp.


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