SimGrid  3.14.159
Versatile Simulation of Distributed Systems
simgrid::surf::Link Class Referenceabstract

Detailed Description

SURF network link interface class.

A Link represents the link between two hosts

#include <network_interface.hpp>

Inheritance diagram for simgrid::surf::Link:
simgrid::surf::Resource simgrid::surf::PropertyHolder simgrid::surf::LinkL07 simgrid::surf::LinkNS3 simgrid::surf::NetworkCm02Link

Public Member Functions

 Link (simgrid::surf::NetworkModel *model, const char *name, lmm_constraint_t constraint)
 Constructor of LMM links. More...
 
void destroy ()
 Fire the required callbacks and destroy the object. More...
 
virtual double bandwidth ()
 Get the bandwidth in bytes per second of current Link. More...
 
virtual void setBandwidth (double value)=0
 Update the bandwidth in bytes per second of current Link. More...
 
virtual double latency ()
 Get the latency in seconds of current Link. More...
 
virtual void setLatency (double value)=0
 Update the latency in seconds of current Link. More...
 
- Public Member Functions inherited from simgrid::surf::Resource
 Resource (Model *model, const char *name, lmm_constraint_t constraint)
 Constructor of LMM Resources. More...
 
virtual ~Resource ()
 
ModelgetModel () const
 Get the Model of the current Resource. More...
 
const char * getName () const
 Get the name of the current Resource. More...
 
bool operator== (const Resource &other) const
 
virtual void apply_event (tmgr_trace_iterator_t event, double value)=0
 Apply an event of external load event to that resource. More...
 
virtual bool isOn () const
 Check if the current Resource is active. More...
 
virtual bool isOff () const
 Check if the current Resource is shut down. More...
 
lmm_constraint_t getConstraint () const
 Get the lmm constraint associated to this Resource if it is part of a LMM component (or null if none) More...
 
- Public Member Functions inherited from simgrid::surf::PropertyHolder
 PropertyHolder ()
 
 ~PropertyHolder ()
 
const char * getProperty (const char *id)
 Return the property associated to the provided key (or nullptr if not existing) More...
 
void setProperty (const char *id, const char *value)
 Change the value of a given key in the property set. More...
 
xbt_dict_t getProperties ()
 Return the whole set of properties. More...
 

Static Public Attributes

static simgrid::xbt::signal< void(surf::Link *)> onCreation
 Callback signal fired when a new Link is created. More...
 
static simgrid::xbt::signal< void(surf::Link *)> onDestruction
 Callback signal fired when a Link is destroyed. More...
 
static simgrid::xbt::signal< void(surf::Link *)> onStateChange
 Callback signal fired when the state of a Link changes (when it is turned on or off) Signature: void(Link*) More...
 
static simgrid::xbt::signal< void(surf::NetworkAction *, s4u::Host *src, s4u::Host *dst)> onCommunicate
 Callback signal fired when a communication starts Signature: void(NetworkAction *action, host *src, host *dst) More...
 

Protected Member Functions

 ~Link () override
 use destroy() instead of this destructor More...
 
tmgr_trace_iterator_t stateEvent_ = nullptr
 
s_surf_metric_t latency_ = {1.0, 0, nullptr}
 
s_surf_metric_t bandwidth_ = {1.0, 0, nullptr}
 
virtual int sharingPolicy ()
 The sharing policy is alink e_surf_link_sharing_policy_t::EType} (0: FATPIPE, 1: SHARED, 2: FULLDUPLEX) More...
 
bool isUsed () override
 Check if the Link is used. More...
 
void turnOn () override
 Turn on the current Resource. More...
 
void turnOff () override
 Turn off the current Resource. More...
 
virtual void setStateTrace (tmgr_trace_t trace)
 
virtual void setBandwidthTrace (tmgr_trace_t trace)
 
virtual void setLatencyTrace (tmgr_trace_t trace)
 
voidgetData ()
 
void setData (void *d)
 
static LinkbyName (const char *name)
 
static int linksCount ()
 Returns the amount of links in the platform. More...
 
static Link ** linksList ()
 Returns a list of all existing links. More...
 
static void linksExit ()
 destructor of the static data More...
 

Additional Inherited Members

- Protected Attributes inherited from simgrid::surf::Resource
const lmm_constraint_t constraint_ = nullptr
 

Constructor & Destructor Documentation

◆ Link()

simgrid::surf::Link::Link ( simgrid::surf::NetworkModel model,
const char *  name,
lmm_constraint_t  constraint 
)

Constructor of LMM links.

◆ ~Link()

simgrid::surf::Link::~Link ( )
overrideprotected

use destroy() instead of this destructor

Member Function Documentation

◆ destroy()

void simgrid::surf::Link::destroy ( )

Fire the required callbacks and destroy the object.

Don't delete directly a Link, call l->destroy() instead.

◆ bandwidth()

double simgrid::surf::Link::bandwidth ( )
virtual

Get the bandwidth in bytes per second of current Link.

◆ setBandwidth()

virtual void simgrid::surf::Link::setBandwidth ( double  value)
pure virtual

Update the bandwidth in bytes per second of current Link.

Implemented in simgrid::surf::LinkL07, simgrid::surf::NetworkCm02Link, and simgrid::surf::LinkNS3.

◆ latency()

double simgrid::surf::Link::latency ( )
virtual

Get the latency in seconds of current Link.

◆ setLatency()

virtual void simgrid::surf::Link::setLatency ( double  value)
pure virtual

Update the latency in seconds of current Link.

Implemented in simgrid::surf::LinkL07, simgrid::surf::NetworkCm02Link, and simgrid::surf::LinkNS3.

◆ sharingPolicy()

int simgrid::surf::Link::sharingPolicy ( )
virtual

The sharing policy is alink e_surf_link_sharing_policy_t::EType} (0: FATPIPE, 1: SHARED, 2: FULLDUPLEX)

◆ isUsed()

bool simgrid::surf::Link::isUsed ( )
overridevirtual

Check if the Link is used.

Implements simgrid::surf::Resource.

Reimplemented in simgrid::surf::LinkL07.

◆ turnOn()

void simgrid::surf::Link::turnOn ( )
overridevirtual

Turn on the current Resource.

Reimplemented from simgrid::surf::Resource.

◆ turnOff()

void simgrid::surf::Link::turnOff ( )
overridevirtual

Turn off the current Resource.

Reimplemented from simgrid::surf::Resource.

◆ setStateTrace()

void simgrid::surf::Link::setStateTrace ( tmgr_trace_t  trace)
virtual

◆ setBandwidthTrace()

void simgrid::surf::Link::setBandwidthTrace ( tmgr_trace_t  trace)
virtual

Reimplemented in simgrid::surf::LinkNS3.

◆ setLatencyTrace()

void simgrid::surf::Link::setLatencyTrace ( tmgr_trace_t  trace)
virtual

Reimplemented in simgrid::surf::LinkNS3.

◆ getData()

void* simgrid::surf::Link::getData ( )
inline

◆ setData()

void simgrid::surf::Link::setData ( void d)
inline

◆ byName()

Link * simgrid::surf::Link::byName ( const char *  name)
static

◆ linksCount()

int simgrid::surf::Link::linksCount ( )
static

Returns the amount of links in the platform.

◆ linksList()

Link ** simgrid::surf::Link::linksList ( )
static

Returns a list of all existing links.

◆ linksExit()

void simgrid::surf::Link::linksExit ( )
static

destructor of the static data

Member Data Documentation

◆ onCreation

simgrid::xbt::signal< void(Link *)> simgrid::surf::Link::onCreation
static

Callback signal fired when a new Link is created.

Signature: void(Link*)

◆ onDestruction

simgrid::xbt::signal< void(Link *)> simgrid::surf::Link::onDestruction
static

Callback signal fired when a Link is destroyed.

Signature: void(Link*)

◆ onStateChange

simgrid::xbt::signal< void(Link *)> simgrid::surf::Link::onStateChange
static

Callback signal fired when the state of a Link changes (when it is turned on or off) Signature: void(Link*)

◆ onCommunicate

simgrid::xbt::signal< void(NetworkAction *, s4u::Host *src, s4u::Host *dst)> simgrid::surf::Link::onCommunicate
static

Callback signal fired when a communication starts Signature: void(NetworkAction *action, host *src, host *dst)

◆ stateEvent_

tmgr_trace_iterator_t simgrid::surf::Link::stateEvent_ = nullptr

◆ latency_

s_surf_metric_t simgrid::surf::Link::latency_ = {1.0, 0, nullptr}

◆ bandwidth_

s_surf_metric_t simgrid::surf::Link::bandwidth_ = {1.0, 0, nullptr}

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