SimGrid  3.16
Versatile Simulation of Distributed Systems
simgrid::s4u::Comm Class Reference

Detailed Description

Communication async.

Represents all asynchronous communications, that you can test or wait onto.

#include <Comm.hpp>

Inheritance diagram for simgrid::s4u::Comm:
simgrid::s4u::Activity

Public Member Functions

virtual ~Comm ()
 
void start () override
 Starts a previously created activity. More...
 
void wait () override
 Tests whether the given activity is terminated yet. More...
 
void wait (double timeout) override
 Blocks until the activity is terminated, or until the timeout is elapsed Raises: timeout exception. More...
 
void setRate (double rate)
 Sets the maximal communication rate (in byte/sec). More...
 
void setSrcData (void *buff)
 Specify the data to send. More...
 
void setSrcDataSize (size_t size)
 Specify the size of the data to send. More...
 
void setSrcData (void *buff, size_t size)
 Specify the data to send and its size. More...
 
void setDstData (void **buff)
 Specify where to receive the data. More...
 
void setDstData (void **buff, size_t size)
 Specify the buffer in which the data should be received. More...
 
size_t getDstDataSize ()
 Retrieve the size of the received data. More...
 
bool test ()
 
void cancel ()
 
- Public Member Functions inherited from simgrid::s4u::Activity
 Activity (Activity const &)=delete
 
Activityoperator= (Activity const &)=delete
 
e_s4u_activity_state_t getState ()
 Cancel that activity. More...
 
double getRemains ()
 Get the remaining amount of work that this Activity entails. More...
 
void setRemains (double remains)
 Set the [remaining] amount of work that this Activity will entail. More...
 
void setUserData (void *data)
 Put some user data onto the Activity. More...
 
voidgetUserData ()
 Retrieve the user data of the Activity. More...
 

Static Public Member Functions

template<class I >
static I wait_any (I first, I last)
 
template<class I >
static I wait_any_for (I first, I last, double timeout)
 
static CommPtr send_init (MailboxPtr dest)
 Creates (but don't start) an async send to the mailbox dest. More...
 
static CommPtr send_async (MailboxPtr dest, void *data, int simulatedByteAmount)
 Creates and start an async send to the mailbox dest. More...
 
static CommPtr recv_init (MailboxPtr from)
 Creates (but don't start) an async recv onto the mailbox from. More...
 
static CommPtr recv_async (MailboxPtr from, void **data)
 Creates and start an async recv to the mailbox from. More...
 
static void send_detached (MailboxPtr dest, void *data, int simulatedSize)
 Creates and start a detached send to the mailbox dest TODO: make it possible to detach an already created comm. More...
 

Friends

void intrusive_ptr_release (simgrid::s4u::Comm *c)
 
void intrusive_ptr_add_ref (simgrid::s4u::Comm *c)
 

Additional Inherited Members

- Protected Member Functions inherited from simgrid::s4u::Activity
 Activity ()=default
 
virtual ~Activity ()=default
 

Constructor & Destructor Documentation

◆ ~Comm()

simgrid::s4u::Comm::~Comm ( )
virtual

Member Function Documentation

◆ wait_any()

template<class I >
static I simgrid::s4u::Comm::wait_any ( first,
last 
)
inlinestatic

take a range of s4u::CommPtr (last excluded) and return when one of them is finished. The return value is an iterator on the finished Comms.

◆ wait_any_for()

template<class I >
static I simgrid::s4u::Comm::wait_any_for ( first,
last,
double  timeout 
)
inlinestatic

Same as wait_any, but with a timeout. If the timeout occurs, parameter last is returned.

◆ send_init()

s4u::CommPtr simgrid::s4u::Comm::send_init ( s4u::MailboxPtr  chan)
static

Creates (but don't start) an async send to the mailbox dest.

◆ send_async()

s4u::CommPtr simgrid::s4u::Comm::send_async ( MailboxPtr  dest,
void data,
int  simulatedByteAmount 
)
static

Creates and start an async send to the mailbox dest.

◆ recv_init()

s4u::CommPtr simgrid::s4u::Comm::recv_init ( s4u::MailboxPtr  chan)
static

Creates (but don't start) an async recv onto the mailbox from.

◆ recv_async()

s4u::CommPtr simgrid::s4u::Comm::recv_async ( MailboxPtr  from,
void **  data 
)
static

Creates and start an async recv to the mailbox from.

◆ send_detached()

void simgrid::s4u::Comm::send_detached ( MailboxPtr  dest,
void data,
int  simulatedSize 
)
static

Creates and start a detached send to the mailbox dest TODO: make it possible to detach an already created comm.

◆ start()

void simgrid::s4u::Comm::start ( )
overridevirtual

Starts a previously created activity.

This function is optional: you can call wait() even if you didn't call start()

Implements simgrid::s4u::Activity.

◆ wait() [1/2]

void simgrid::s4u::Comm::wait ( )
overridevirtual

Tests whether the given activity is terminated yet.

This is a pure function. Blocks until the activity is terminated

Implements simgrid::s4u::Activity.

◆ wait() [2/2]

void simgrid::s4u::Comm::wait ( double  timeout)
overridevirtual

Blocks until the activity is terminated, or until the timeout is elapsed Raises: timeout exception.

Implements simgrid::s4u::Activity.

◆ setRate()

void simgrid::s4u::Comm::setRate ( double  rate)

Sets the maximal communication rate (in byte/sec).

Must be done before start

◆ setSrcData() [1/2]

void simgrid::s4u::Comm::setSrcData ( void buff)

Specify the data to send.

◆ setSrcDataSize()

void simgrid::s4u::Comm::setSrcDataSize ( size_t  size)

Specify the size of the data to send.

◆ setSrcData() [2/2]

void simgrid::s4u::Comm::setSrcData ( void buff,
size_t  size 
)

Specify the data to send and its size.

◆ setDstData() [1/2]

void simgrid::s4u::Comm::setDstData ( void **  buff)

Specify where to receive the data.

◆ setDstData() [2/2]

void simgrid::s4u::Comm::setDstData ( void **  buff,
size_t  size 
)

Specify the buffer in which the data should be received.

◆ getDstDataSize()

size_t simgrid::s4u::Comm::getDstDataSize ( )

Retrieve the size of the received data.

◆ test()

bool simgrid::s4u::Comm::test ( )

◆ cancel()

void simgrid::s4u::Comm::cancel ( )

Friends And Related Function Documentation

◆ intrusive_ptr_release

void intrusive_ptr_release ( simgrid::s4u::Comm c)
friend

◆ intrusive_ptr_add_ref

void intrusive_ptr_add_ref ( simgrid::s4u::Comm c)
friend

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