void send(Mailbox &chan, void*payload, size_t simulatedSize);
protected:
- smx_process_t getInferior() {return inferior_;}
+ smx_process_t getInferior() {return pimpl_;}
private:
- smx_process_t inferior_;
+ smx_process_t pimpl_;
};
}} // namespace simgrid::s4u
virtual ~Async();
private:
- simgrid::simix::Synchro *inferior_ = NULL;
+ simgrid::simix::Synchro *pimpl_ = NULL;
private:
e_s4u_async_state_t state_ = inited;
File(const char *fullpath, void* userdata);
~File();
private:
- smx_file_t inferior_;
+ smx_file_t pimpl_;
const char *path_;
public:
~Mailbox();
protected:
- smx_mailbox_t getInferior() { return inferior_; }
+ smx_mailbox_t getInferior() { return pimpl_; }
public:
/** Get the name of that mailbox */
private:
std::string name_;
- smx_mailbox_t inferior_;
+ smx_mailbox_t pimpl_;
static boost::unordered_map<std::string, Mailbox *> *mailboxes;
friend s4u::Engine;
};
static boost::unordered_map<std::string, Storage *> *storages_;
std::string name_;
- smx_storage_t inferior_;
+ smx_storage_t pimpl_;
public:
using namespace simgrid;
s4u::Actor::Actor(smx_process_t smx_proc) {
- inferior_ = smx_proc;
+ pimpl_ = smx_proc;
}
s4u::Actor::Actor(const char *name, s4u::Host *host, int argc, char **argv)
: s4u::Actor::Actor(name,host, argc,argv, -1) {
}
s4u::Actor::Actor(const char *name, s4u::Host *host, int argc, char **argv, double killTime) {
- inferior_ = simcall_process_create(name, s4u_actor_runner, this, host->name().c_str(), killTime, argc, argv, NULL/*properties*/,0);
+ pimpl_ = simcall_process_create(name, s4u_actor_runner, this, host->name().c_str(), killTime, argc, argv, NULL/*properties*/,0);
- xbt_assert(inferior_,"Cannot create the actor");
+ xbt_assert(pimpl_,"Cannot create the actor");
// TRACE_msg_process_create(procname, simcall_process_get_PID(p_smx_process), host->getInferior());
// simcall_process_on_exit(p_smx_process,(int_f_pvoid_pvoid_t)TRACE_msg_process_kill,p_smx_process);
}
}
void s4u::Actor::setAutoRestart(bool autorestart) {
- simcall_process_auto_restart_set(inferior_,autorestart);
+ simcall_process_auto_restart_set(pimpl_,autorestart);
}
s4u::Host *s4u::Actor::getHost() {
- return s4u::Host::by_name(sg_host_get_name(simcall_process_get_host(inferior_)));
+ return s4u::Host::by_name(sg_host_get_name(simcall_process_get_host(pimpl_)));
}
const char* s4u::Actor::getName() {
- return simcall_process_get_name(inferior_);
+ return simcall_process_get_name(pimpl_);
}
int s4u::Actor::getPid(){
- return simcall_process_get_PID(inferior_);
+ return simcall_process_get_PID(pimpl_);
}
void s4u::Actor::setKillTime(double time) {
- simcall_process_set_kill_time(inferior_,time);
+ simcall_process_set_kill_time(pimpl_,time);
}
double s4u::Actor::getKillTime() {
- return simcall_process_get_kill_time(inferior_);
+ return simcall_process_get_kill_time(pimpl_);
}
void s4u::Actor::killAll() {
simcall_process_killall(1);
}
void s4u::Actor::kill() {
- simcall_process_kill(inferior_);
+ simcall_process_kill(pimpl_);
}
void s4u::Actor::sleep(double duration) {
xbt_assert(state_ == inited);
if (srcBuff_ != NULL) { // Sender side
- inferior_ = simcall_comm_isend(sender_->getInferior(), mailbox_->getInferior(), remains_, rate_,
+ pimpl_ = simcall_comm_isend(sender_->getInferior(), mailbox_->getInferior(), remains_, rate_,
srcBuff_, srcBuffSize_,
matchFunction_, cleanFunction_, copyDataFunction_,
userData_, detached_);
} else if (dstBuff_ != NULL) { // Receiver side
- inferior_ = simcall_comm_irecv(receiver_->getInferior(), mailbox_->getInferior(), dstBuff_, &dstBuffSize_,
+ pimpl_ = simcall_comm_irecv(receiver_->getInferior(), mailbox_->getInferior(), dstBuff_, &dstBuffSize_,
matchFunction_, copyDataFunction_,
userData_, rate_);
xbt_assert(state_ == started || state_ == inited);
if (state_ == started)
- simcall_comm_wait(inferior_, -1/*timeout*/);
+ simcall_comm_wait(pimpl_, -1/*timeout*/);
else {// p_state == inited. Save a simcall and do directly a blocking send/recv
if (srcBuff_ != NULL) {
simcall_comm_send(sender_->getInferior(), mailbox_->getInferior(), remains_, rate_,
xbt_assert(state_ == started || state_ == inited);
if (state_ == started) {
- simcall_comm_wait(inferior_, timeout);
+ simcall_comm_wait(pimpl_, timeout);
state_ = finished;
return;
}
File::File(const char*fullpath, void *userdata) {
// this cannot fail because we get a xbt_die if the mountpoint does not exist
- inferior_ = simcall_file_open(fullpath, Host::current());
+ pimpl_ = simcall_file_open(fullpath, Host::current());
path_ = fullpath;
}
File::~File() {
- simcall_file_close(inferior_, Host::current());
+ simcall_file_close(pimpl_, Host::current());
}
sg_size_t File::read(sg_size_t size) {
- return simcall_file_read(inferior_, size, Host::current());
+ return simcall_file_read(pimpl_, size, Host::current());
}
sg_size_t File::write(sg_size_t size) {
- return simcall_file_write(inferior_,size, Host::current());
+ return simcall_file_write(pimpl_,size, Host::current());
}
sg_size_t File::size() {
- return simcall_file_get_size(inferior_);
+ return simcall_file_get_size(pimpl_);
}
void File::seek(sg_size_t pos) {
- simcall_file_seek(inferior_,pos,SEEK_SET);
+ simcall_file_seek(pimpl_,pos,SEEK_SET);
}
sg_size_t File::tell() {
- return simcall_file_tell(inferior_);
+ return simcall_file_tell(pimpl_);
}
void File::move(const char*fullpath) {
- simcall_file_move(inferior_,fullpath);
+ simcall_file_move(pimpl_,fullpath);
}
void File::unlink() {
sg_host_t attached = Host::current(); // FIXME: we should check where this file is attached
- simcall_file_unlink(inferior_,attached);
+ simcall_file_unlink(pimpl_,attached);
}
}} // namespace simgrid::s4u
s4u::Mailbox::Mailbox(const char*name, smx_mailbox_t inferior) {
- inferior_ = inferior;
+ pimpl_ = inferior;
name_ = name;
mailboxes->insert({name, this});
}
}
bool s4u::Mailbox::empty() {
- return nullptr == simcall_mbox_get_head(inferior_);
+ return nullptr == simcall_mbox_get_head(pimpl_);
}
void s4u::Mailbox::setReceiver(smx_process_t process) {
- simcall_mbox_set_receiver(inferior_, process);
+ simcall_mbox_set_receiver(pimpl_, process);
}
smx_process_t s4u::Mailbox::receiver() {
- return simcall_mbox_get_receiver(inferior_);
+ return simcall_mbox_get_receiver(pimpl_);
}
/*------- C functions -------*/
boost::unordered_map <std::string, Storage *> *Storage::storages_ = new boost::unordered_map<std::string, Storage*> ();
Storage::Storage(std::string name, smx_storage_t inferior) {
name_ = name;
- inferior_ = inferior;
+ pimpl_ = inferior;
storages_->insert({name, this});
}
}
smx_storage_t Storage::inferior() {
- return inferior_;
+ return pimpl_;
}
Storage &Storage::byName(const char*name) {
s4u::Storage *res = NULL;
}
sg_size_t Storage::sizeFree() {
- return simcall_storage_get_free_size(inferior_);
+ return simcall_storage_get_free_size(pimpl_);
}
sg_size_t Storage::sizeUsed() {
- return simcall_storage_get_used_size(inferior_);
+ return simcall_storage_get_used_size(pimpl_);
}
sg_size_t Storage::size() {
- return SIMIX_storage_get_size(inferior_);
+ return SIMIX_storage_get_size(pimpl_);
}
} /* namespace s4u */