SimGrid  3.14.159
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

 ~Comm () override
 
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 ()
 
- 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 Commsend_init (MailboxPtr dest)
 Creates (but don't start) an async send to the mailbox dest. More...
 
static Commsend_async (MailboxPtr dest, void *data, int simulatedByteAmount)
 Creates and start an async send to the mailbox dest. More...
 
static Commrecv_init (MailboxPtr from)
 Creates (but don't start) an async recv onto the mailbox from. More...
 
static Commrecv_async (MailboxPtr from, void **data)
 Creates and start an async recv to the mailbox from. More...
 

Additional Inherited Members

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

Constructor & Destructor Documentation

§ ~Comm()

simgrid::s4u::Comm::~Comm ( )
override

Member Function Documentation

§ wait_any()

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

take a range of s4u::Comm* (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 wait_any_for return because of the timeout last is returned.

§ send_init()

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

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

§ send_async()

s4u::Comm & 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::Comm & simgrid::s4u::Comm::recv_init ( s4u::MailboxPtr  chan)
static

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

§ recv_async()

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

Creates and start an async recv to the mailbox from.

§ 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 ( )

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