public:
ThrowPoint() = default;
explicit ThrowPoint(const char* file, int line, const char* function, Backtrace bt, std::string actor_name, int pid)
- : file_(file), line_(line), function_(function), backtrace_(std::move(bt)), procname_(actor_name), pid_(pid)
+ : file_(file)
+ , line_(line)
+ , function_(function)
+ , backtrace_(std::move(bt))
+ , procname_(std::move(actor_name))
+ , pid_(pid)
{
}
class Exception : public std::runtime_error {
public:
Exception(simgrid::xbt::ThrowPoint throwpoint, std::string message)
- : std::runtime_error(message), throwpoint_(throwpoint)
+ : std::runtime_error(std::move(message)), throwpoint_(std::move(throwpoint))
{
}
* @param throwpoint Throw point (use XBT_THROW_POINT)
* @param message Exception message
*/
- xbt_ex(simgrid::xbt::ThrowPoint throwpoint, std::string message) : simgrid::Exception(throwpoint, message) {}
-
+ xbt_ex(simgrid::xbt::ThrowPoint throwpoint, std::string message)
+ : simgrid::Exception(std::move(throwpoint), std::move(message))
+ {
+ }
+
xbt_ex(const xbt_ex&) = default;
~xbt_ex(); // DO NOT define it here -- see ex.cpp for a rationale
/** Exception raised when a timeout elapsed */
class TimeoutError : public xbt_ex {
public:
- TimeoutError(simgrid::xbt::ThrowPoint throwpoint, std::string message) : xbt_ex(throwpoint, message)
+ TimeoutError(simgrid::xbt::ThrowPoint throwpoint, std::string message)
+ : xbt_ex(std::move(throwpoint), std::move(message))
{
category = timeout_error;
}
/** Exception raised when a host fails */
class HostFailureException : public xbt_ex {
public:
- HostFailureException(simgrid::xbt::ThrowPoint throwpoint, std::string message) : xbt_ex(throwpoint, message)
+ HostFailureException(simgrid::xbt::ThrowPoint throwpoint, std::string message)
+ : xbt_ex(std::move(throwpoint), std::move(message))
{
category = host_error;
}
/** Exception raised when a communication fails because of the network */
class NetworkFailureException : public xbt_ex {
public:
- NetworkFailureException(simgrid::xbt::ThrowPoint throwpoint, std::string message) : xbt_ex(throwpoint, message)
+ NetworkFailureException(simgrid::xbt::ThrowPoint throwpoint, std::string message)
+ : xbt_ex(std::move(throwpoint), std::move(message))
{
category = network_error;
}
/** @brief Get the tracing category associated to the current action */
std::string get_category() const { return category_; }
/** @brief Set the tracing category of the current Action */
- void set_category(std::string category) { category_ = category; }
+ void set_category(std::string category) { category_ = std::move(category); }
/** @brief Get the priority of the current Action */
double get_priority() const { return sharing_priority_; };
private:
void generate_routers();
void generate_links();
- void create_link(const std::string& id, int numlinks, resource::LinkImpl** linkup, resource::LinkImpl** linkdown);
+ void create_link(std::string id, int numlinks, resource::LinkImpl** linkup, resource::LinkImpl** linkdown);
simgrid::s4u::Link::SharingPolicy sharing_policy_;
double bw_ = 0;
*/
template <class F> static ActorPtr create(std::string name, s4u::Host* host, F code)
{
- return create(name, host, std::function<void()>(std::move(code)));
+ return create(std::move(name), host, std::function<void()>(std::move(code)));
}
/** Create an actor using a callable thing and its arguments.
typename = typename std::result_of<F(Args...)>::type>
static ActorPtr create(std::string name, s4u::Host* host, F code, Args... args)
{
- return create(name, host, std::bind(std::move(code), std::move(args)...));
+ return create(std::move(name), host, std::bind(std::move(code), std::move(args)...));
}
// Create actor from function name:
T args;
public:
- explicit ReplayAction(std::string name) : name(name), my_proc_id(simgrid::s4u::this_actor::get_pid()) {}
+ explicit ReplayAction(std::string name) : name(std::move(name)), my_proc_id(simgrid::s4u::this_actor::get_pid()) {}
virtual ~ReplayAction() = default;
void execute(simgrid::xbt::ReplayAction& action)
RequestStorage& req_storage;
public:
- explicit SendAction(std::string name, RequestStorage& storage) : ReplayAction(name), req_storage(storage) {}
+ explicit SendAction(std::string name, RequestStorage& storage) : ReplayAction(std::move(name)), req_storage(storage)
+ {
+ }
void kernel(simgrid::xbt::ReplayAction& action) override;
};
RequestStorage& req_storage;
public:
- explicit RecvAction(std::string name, RequestStorage& storage) : ReplayAction(name), req_storage(storage) {}
+ explicit RecvAction(std::string name, RequestStorage& storage) : ReplayAction(std::move(name)), req_storage(storage)
+ {
+ }
void kernel(simgrid::xbt::ReplayAction& action) override;
};
class GatherAction : public ReplayAction<GatherArgParser> {
public:
- explicit GatherAction(std::string name) : ReplayAction(name) {}
+ explicit GatherAction(std::string name) : ReplayAction(std::move(name)) {}
void kernel(simgrid::xbt::ReplayAction& action) override;
};
class GatherVAction : public ReplayAction<GatherVArgParser> {
public:
- explicit GatherVAction(std::string name) : ReplayAction(name) {}
+ explicit GatherVAction(std::string name) : ReplayAction(std::move(name)) {}
void kernel(simgrid::xbt::ReplayAction& action) override;
};
}
NetZoneContainer::NetZoneContainer(std::string name, unsigned int level, NetZoneContainer* father)
- : Container::Container(name, "", father)
+ : Container::Container(std::move(name), "", father)
{
- netpoint_ = simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(name);
- xbt_assert(netpoint_, "Element '%s' not found", name.c_str());
+ netpoint_ = simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(get_name());
+ xbt_assert(netpoint_, "Element '%s' not found", get_cname());
if (father_) {
std::string type_name = std::string("L") + std::to_string(level);
type_ = father_->type_->by_name_or_create<ContainerType>(type_name);
}
}
-RouterContainer::RouterContainer(std::string name, Container* father) : Container::Container(name, "ROUTER", father)
+RouterContainer::RouterContainer(std::string name, Container* father)
+ : Container::Container(std::move(name), "ROUTER", father)
{
xbt_assert(father, "Only the Root container has no father");
- netpoint_ = simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(name);
- xbt_assert(netpoint_, "Element '%s' not found", name.c_str());
+ netpoint_ = simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(get_name());
+ xbt_assert(netpoint_, "Element '%s' not found", get_cname());
trivaNodeTypes.insert(type_->get_name());
}
trivaNodeTypes.insert(type_->get_name());
}
-Container::Container(std::string name, std::string type_name, Container* father) : name_(name), father_(father)
+Container::Container(std::string name, std::string type_name, Container* father)
+ : name_(std::move(name)), father_(father)
{
static long long int container_id = 0;
id_ = container_id; // id (or alias) of the container
void Container::create_child(std::string name, std::string type_name)
{
- new Container(name, type_name, this);
+ new Container(std::move(name), std::move(type_name), this);
}
Container* Container::by_name_or_null(std::string name)
std::string key, int size)
: PajeEvent(container, type, SIMIX_get_clock(), event_type)
, endpoint_(sourceContainer)
- , value_(value)
+ , value_(std::move(value))
, key_(key)
, size_(size)
{
namespace instr {
Type::Type(std::string name, std::string alias, std::string color, Type* father)
- : id_(instr_new_paje_id()), name_(name), color_(color), father_(father)
+ : id_(instr_new_paje_id()), name_(std::move(name)), color_(std::move(color)), father_(father)
{
- if (name.empty() || alias.empty())
+ if (name_.empty() || alias.empty())
THROWF(tracing_error, 0, "can't create a new type with no name or alias");
if (father != nullptr){
- father->children_.insert({alias, this});
+ father->children_.insert({std::move(alias), this});
XBT_DEBUG("new type %s, child of %s", name_.c_str(), father->get_cname());
}
if (trace_format == simgrid::instr::TraceFormat::Paje) {
log_definition(PAJE_DefineContainerType);
}
-EventType::EventType(std::string name, Type* father) : ValueType(name, father)
+EventType::EventType(std::string name, Type* father) : ValueType(std::move(name), father)
{
XBT_DEBUG("EventType %s(%lld), child of %s(%lld)", get_cname(), get_id(), father->get_cname(), father->get_id());
log_definition(PAJE_DefineEventType);
}
-StateType::StateType(std::string name, Type* father) : ValueType(name, father)
+StateType::StateType(std::string name, Type* father) : ValueType(std::move(name), father)
{
XBT_DEBUG("StateType %s(%lld), child of %s(%lld)", get_cname(), get_id(), father->get_cname(), father->get_id());
log_definition(PAJE_DefineStateType);
events_.push_back(new StateEvent(issuer_, this, PAJE_PopState, nullptr, extra));
}
-VariableType::VariableType(std::string name, std::string color, Type* father) : Type(name, name, color, father)
+VariableType::VariableType(std::string name, std::string color, Type* father)
+ : Type(name, name, std::move(color), father)
{
XBT_DEBUG("VariableType %s(%lld), child of %s(%lld)", get_cname(), get_id(), father->get_cname(), father->get_id());
log_definition(PAJE_DefineVariableType);
events_.push_back(new VariableEvent(timestamp, issuer_, this, PAJE_SubVariable, value));
}
-LinkType::LinkType(std::string name, std::string alias, Type* father) : ValueType(name, alias, father)
+LinkType::LinkType(std::string name, std::string alias, Type* father)
+ : ValueType(std::move(name), std::move(alias), father)
{
}
void LinkType::start_event(Container* startContainer, std::string value, std::string key)
{
- start_event(startContainer, value, key, -1);
+ start_event(startContainer, value, std::move(key), -1);
}
void LinkType::start_event(Container* startContainer, std::string value, std::string key, int size)
{
- new LinkEvent(issuer_, this, PAJE_StartLink, startContainer, value, key, size);
+ new LinkEvent(issuer_, this, PAJE_StartLink, startContainer, value, std::move(key), size);
}
void LinkType::end_event(Container* endContainer, std::string value, std::string key)
{
- new LinkEvent(issuer_, this, PAJE_EndLink, endContainer, value, key, -1);
+ new LinkEvent(issuer_, this, PAJE_EndLink, endContainer, value, std::move(key), -1);
}
void Type::log_definition(e_event_type event_type)
auto it = values_.find(name);
if (it == values_.end()) {
- EntityValue* new_val = new EntityValue(name, color, this);
+ EntityValue* new_val = new EntityValue(name, std::move(color), this);
values_.insert({name, new_val});
XBT_DEBUG("new value %s, child of %s", name.c_str(), get_cname());
new_val->print();
VariableType* Type::by_name_or_create(std::string name, std::string color)
{
auto cont = children_.find(name);
- std::string mycolor = color.empty() ? "1 1 1" : color;
- return cont == children_.end() ? new VariableType(name, mycolor, this) : static_cast<VariableType*>(cont->second);
+ std::string mycolor = color.empty() ? "1 1 1" : std::move(color);
+ return cont == children_.end() ? new VariableType(name, std::move(mycolor), this)
+ : static_cast<VariableType*>(cont->second);
}
LinkType* Type::by_name_or_create(std::string name, Type* source, Type* dest)
class ValueType : public Type {
public:
std::map<std::string, EntityValue*> values_;
- ValueType(std::string name, std::string alias, Type* father) : Type(name, alias, "", father){};
+ ValueType(std::string name, std::string alias, Type* father) : Type(std::move(name), std::move(alias), "", father){};
ValueType(std::string name, Type* father) : Type(name, name, "", father){};
virtual ~ValueType();
void add_entity_value(std::string name, std::string color);
namespace instr {
EntityValue::EntityValue(std::string name, std::string color, Type* father)
- : id_(instr_new_paje_id()), name_(name), color_(color), father_(father){};
+ : id_(instr_new_paje_id()), name_(std::move(name)), color_(std::move(color)), father_(father){};
void EntityValue::print()
{
std::string recv_type = "";
// NoOpTI: init, finalize, test, wait, barrier
- explicit TIData(std::string name) : name_(name){};
+ explicit TIData(std::string name) : name_(std::move(name)){};
// CPuTI: compute, sleep (+ waitAny and waitall out of laziness)
- explicit TIData(std::string name, double amount) : name_(name), amount_(amount){};
+ explicit TIData(std::string name, double amount) : name_(std::move(name)), amount_(amount){};
// Pt2PtTI: send, isend, sssend, issend, recv, irecv
explicit TIData(std::string name, int endpoint, int size, std::string datatype)
- : name_(name), endpoint(endpoint), send_size(size), send_type(datatype){};
+ : name_(std::move(name)), endpoint(endpoint), send_size(size), send_type(std::move(datatype)){};
// CollTI: bcast, reduce, allreduce, gather, scatter, allgather, alltoall
explicit TIData(std::string name, int root, double amount, int send_size, int recv_size, std::string send_type,
std::string recv_type)
- : name_(name)
+ : name_(std::move(name))
, amount_(amount)
, endpoint(root)
, send_size(send_size)
, recv_size(recv_size)
- , send_type(send_type)
- , recv_type(recv_type){};
+ , send_type(std::move(send_type))
+ , recv_type(std::move(recv_type)){};
// VarCollTI: gatherv, scatterv, allgatherv, alltoallv (+ reducescatter out of laziness)
explicit TIData(std::string name, int root, int send_size, std::vector<int>* sendcounts, int recv_size,
std::vector<int>* recvcounts, std::string send_type, std::string recv_type)
- : TIData(name, root, send_size, std::shared_ptr<std::vector<int>>(sendcounts), recv_size,
- std::shared_ptr<std::vector<int>>(recvcounts), send_type, recv_type){};
+ : TIData(std::move(name), root, send_size, std::shared_ptr<std::vector<int>>(sendcounts), recv_size,
+ std::shared_ptr<std::vector<int>>(recvcounts), std::move(send_type), std::move(recv_type)){};
explicit TIData(std::string name, int root, int send_size, std::shared_ptr<std::vector<int>> sendcounts,
int recv_size, std::shared_ptr<std::vector<int>> recvcounts, std::string send_type,
std::string recv_type)
- : name_(name)
+ : name_(std::move(name))
, endpoint(root)
, send_size(send_size)
, sendcounts(sendcounts)
, recv_size(recv_size)
, recvcounts(recvcounts)
- , send_type(send_type)
- , recv_type(recv_type){};
+ , send_type(std::move(send_type))
+ , recv_type(std::move(recv_type)){};
virtual ~TIData() {}
class NoOpTIData : public TIData {
public:
- explicit NoOpTIData(std::string name) : TIData(name){};
+ explicit NoOpTIData(std::string name) : TIData(std::move(name)){};
std::string print() override { return getName(); }
std::string display_size() override { return "NA"; }
};
class CpuTIData : public TIData {
public:
- explicit CpuTIData(std::string name, double amount) : TIData(name, amount){};
+ explicit CpuTIData(std::string name, double amount) : TIData(std::move(name), amount){};
std::string print() override
{
std::stringstream stream;
int tag;
public:
explicit Pt2PtTIData(std::string name, int endpoint, int size, int tag, std::string datatype)
- : TIData(name, endpoint, size, datatype), tag(tag) {};
+ : TIData(std::move(name), endpoint, size, std::move(datatype)), tag(tag){};
explicit Pt2PtTIData(std::string name, int endpoint, int size, std::string datatype)
- : TIData(name, endpoint, size, datatype), tag(0) {};
+ : TIData(std::move(name), endpoint, size, std::move(datatype)), tag(0){};
std::string print() override
{
std::stringstream stream;
public:
explicit CollTIData(std::string name, int root, double amount, int send_size, int recv_size, std::string send_type,
std::string recv_type)
- : TIData(name, root, amount, send_size, recv_size, send_type, recv_type){};
+ : TIData(std::move(name), root, amount, send_size, recv_size, std::move(send_type), std::move(recv_type)){};
std::string print() override
{
std::stringstream stream;
public:
explicit VarCollTIData(std::string name, int root, int send_size, std::vector<int>* sendcounts, int recv_size,
std::vector<int>* recvcounts, std::string send_type, std::string recv_type)
- : TIData(name, root, send_size, sendcounts, recv_size, recvcounts, send_type, recv_type){};
+ : TIData(std::move(name), root, send_size, sendcounts, recv_size, recvcounts, std::move(send_type),
+ std::move(recv_type)){};
explicit VarCollTIData(std::string name, int root, int send_size, std::shared_ptr<std::vector<int>> sendcounts,
int recv_size, std::shared_ptr<std::vector<int>> recvcounts, std::string send_type,
std::string recv_type)
- : TIData(name, root, send_size, sendcounts, recv_size, recvcounts, send_type, recv_type){};
+ : TIData(std::move(name), root, send_size, sendcounts, recv_size, recvcounts, std::move(send_type),
+ std::move(recv_type)){};
std::string print() override
{
namespace jedule{
Event::Event(std::string name, double start_time, double end_time, std::string type)
- : name_(name), start_time_(start_time), end_time_(end_time), type_(type)
+ : name_(std::move(name)), start_time_(start_time), end_time_(end_time), type_(std::move(type))
{
this->resource_subsets_ = new std::vector<jed_subset_t>();
}
nres=end_idx-start_idx+1;
}
-
-Container::Container(std::string name): name(name)
+Container::Container(std::string name) : name(std::move(name))
{
container_name2container.insert({this->name, this});
}
void ActivityImpl::set_category(std::string category)
{
if (surf_action_)
- surf_action_->set_category(category);
+ surf_action_->set_category(std::move(category));
}
// boost::intrusive_ptr<Activity> support:
class XBT_PUBLIC ActivityImpl {
public:
ActivityImpl() = default;
- explicit ActivityImpl(std::string name) : name_(name) {}
+ explicit ActivityImpl(std::string name) : name_(std::move(name)) {}
virtual ~ActivityImpl() = default;
e_smx_state_t state_ = SIMIX_WAITING; /* State of the activity */
std::string name_; /* Activity name if any */
namespace activity {
ExecImpl::ExecImpl(std::string name, std::string tracing_category, resource::Action* timeout_detector, s4u::Host* host)
- : ActivityImpl(name), host_(host), timeout_detector_(timeout_detector)
+ : ActivityImpl(std::move(name)), host_(host), timeout_detector_(timeout_detector)
{
this->state_ = SIMIX_RUNNING;
- this->set_category(tracing_category);
+ this->set_category(std::move(tracing_category));
if (timeout_detector != nullptr)
timeout_detector_->set_data(this);
namespace kernel {
namespace activity {
-IoImpl::IoImpl(std::string name, surf::StorageImpl* storage) : ActivityImpl(name), storage_(storage)
+IoImpl::IoImpl(std::string name, surf::StorageImpl* storage) : ActivityImpl(std::move(name)), storage_(storage)
{
this->state_ = SIMIX_RUNNING;
friend mc::CommunicationDeterminismChecker;
explicit MailboxImpl(std::string name)
- : piface_(this), name_(name), comm_queue_(MAX_MAILBOX_SIZE), done_comm_queue_(MAX_MAILBOX_SIZE)
+ : piface_(this), name_(std::move(name)), comm_queue_(MAX_MAILBOX_SIZE), done_comm_queue_(MAX_MAILBOX_SIZE)
{
}
namespace kernel {
namespace routing {
ClusterZone::ClusterZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
- : NetZoneImpl(father, name, netmodel)
+ : NetZoneImpl(father, std::move(name), netmodel)
{
}
};
DijkstraZone::DijkstraZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel, bool cached)
- : RoutedZone(father, name, netmodel), cached_(cached)
+ : RoutedZone(father, std::move(name), netmodel), cached_(cached)
{
}
namespace routing {
DragonflyZone::DragonflyZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
- : ClusterZone(father, name, netmodel)
+ : ClusterZone(father, std::move(name), netmodel)
{
}
}
}
-void DragonflyZone::create_link(const std::string& id, int numlinks, resource::LinkImpl** linkup,
+void DragonflyZone::create_link(std::string id, int numlinks, resource::LinkImpl** linkup,
resource::LinkImpl** linkdown)
{
*linkup = nullptr;
linkTemplate.bandwidth = this->bw_ * numlinks;
linkTemplate.latency = this->lat_;
linkTemplate.policy = this->sharing_policy_;
- linkTemplate.id = id;
+ linkTemplate.id = std::move(id);
sg_platf_new_link(&linkTemplate);
- XBT_DEBUG("Generating link %s", id.c_str());
+ XBT_DEBUG("Generating link %s", linkTemplate.id.c_str());
resource::LinkImpl* link;
if (this->sharing_policy_ == s4u::Link::SharingPolicy::SPLITDUPLEX) {
*linkup = s4u::Link::by_name(linkTemplate.id + "_UP")->get_impl(); // check link?
namespace routing {
EmptyZone::EmptyZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
- : NetZoneImpl(father, name, netmodel)
+ : NetZoneImpl(father, std::move(name), netmodel)
{
}
namespace routing {
FatTreeZone::FatTreeZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
- : ClusterZone(father, name, netmodel)
+ : ClusterZone(father, std::move(name), netmodel)
{
XBT_DEBUG("Creating a new fat tree.");
}
namespace routing {
FloydZone::FloydZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
- : RoutedZone(father, name, netmodel)
+ : RoutedZone(father, std::move(name), netmodel)
{
predecessor_table_ = nullptr;
cost_table_ = nullptr;
namespace kernel {
namespace routing {
FullZone::FullZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
- : RoutedZone(father, name, netmodel)
+ : RoutedZone(father, std::move(name), netmodel)
{
}
simgrid::xbt::signal<void(NetPoint*)> NetPoint::on_creation;
NetPoint::NetPoint(std::string name, NetPoint::Type componentType, NetZoneImpl* netzone_p)
- : name_(name), component_type_(componentType), englobing_zone_(netzone_p)
+ : name_(std::move(name)), component_type_(componentType), englobing_zone_(netzone_p)
{
if (netzone_p != nullptr)
id_ = netzone_p->add_component(this);
};
NetZoneImpl::NetZoneImpl(NetZoneImpl* father, std::string name, resource::NetworkModel* network_model)
- : network_model_(network_model), piface_(this), father_(father), name_(name)
+ : network_model_(network_model), piface_(this), father_(father), name_(std::move(name))
{
- xbt_assert(nullptr == simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(name.c_str()),
- "Refusing to create a second NetZone called '%s'.", name.c_str());
+ xbt_assert(nullptr == simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(name_.c_str()),
+ "Refusing to create a second NetZone called '%s'.", name_.c_str());
- netpoint_ = new NetPoint(name, NetPoint::Type::NetZone, father);
- XBT_DEBUG("NetZone '%s' created with the id '%u'", name.c_str(), netpoint_->id());
+ netpoint_ = new NetPoint(name_, NetPoint::Type::NetZone, father);
+ XBT_DEBUG("NetZone '%s' created with the id '%u'", name_.c_str(), netpoint_->id());
}
NetZoneImpl::~NetZoneImpl()
namespace routing {
RoutedZone::RoutedZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
- : NetZoneImpl(father, name, netmodel)
+ : NetZoneImpl(father, std::move(name), netmodel)
{
}
namespace kernel {
namespace routing {
TorusZone::TorusZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
- : ClusterZone(father, name, netmodel)
+ : ClusterZone(father, std::move(name), netmodel)
{
}
}
VivaldiZone::VivaldiZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
- : ClusterZone(father, name, netmodel)
+ : ClusterZone(father, std::move(name), netmodel)
{
}
simgrid::xbt::Extension<Storage, FileSystemStorageExt> FileSystemStorageExt::EXTENSION_ID;
simgrid::xbt::Extension<Host, FileDescriptorHostExt> FileDescriptorHostExt::EXTENSION_ID;
-File::File(std::string fullpath, void* userdata) : File(fullpath, Host::current(), userdata){};
+File::File(std::string fullpath, void* userdata) : File(std::move(fullpath), Host::current(), userdata){};
-File::File(std::string fullpath, sg_host_t host, void* userdata) : fullpath_(fullpath), userdata_(userdata)
+File::File(std::string fullpath, sg_host_t host, void* userdata) : fullpath_(std::move(fullpath)), userdata_(userdata)
{
// this cannot fail because we get a xbt_die if the mountpoint does not exist
Storage* st = nullptr;
size_t longest_prefix_length = 0;
- XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath.c_str(), host->get_cname());
+ XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath_.c_str(), host->get_cname());
for (auto const& mnt : host->get_mounted_storages()) {
XBT_DEBUG("See '%s'", mnt.first.c_str());
- mount_point_ = fullpath.substr(0, mnt.first.length());
+ mount_point_ = fullpath_.substr(0, mnt.first.length());
if (mount_point_ == mnt.first && mnt.first.length() > longest_prefix_length) {
/* The current mount name is found in the full path and is bigger than the previous*/
st = mnt.second;
}
}
- if (longest_prefix_length > 0) { /* Mount point found, split fullpath into mount_name and path+filename*/
- mount_point_ = fullpath.substr(0, longest_prefix_length);
- path_ = fullpath.substr(longest_prefix_length, fullpath.length());
+ if (longest_prefix_length > 0) { /* Mount point found, split fullpath_ into mount_name and path+filename*/
+ mount_point_ = fullpath_.substr(0, longest_prefix_length);
+ path_ = fullpath_.substr(longest_prefix_length, fullpath_.length());
} else
- xbt_die("Can't find mount point for '%s' on '%s'", fullpath.c_str(), host->get_cname());
+ xbt_die("Can't find mount point for '%s' on '%s'", fullpath_.c_str(), host->get_cname());
local_storage_ = st;
simgrid::xbt::signal<void(VirtualMachine&)> VirtualMachine::on_migration_end;
VirtualMachine::VirtualMachine(std::string name, s4u::Host* physical_host, int core_amount)
- : VirtualMachine(name, physical_host, core_amount, 1024)
+ : VirtualMachine(std::move(name), physical_host, core_amount, 1024)
{
}
VirtualMachine::VirtualMachine(std::string name, s4u::Host* physical_host, int core_amount, size_t ramsize)
- : Host(name), pimpl_vm_(new vm::VirtualMachineImpl(this, physical_host, core_amount, ramsize))
+ : Host(std::move(name)), pimpl_vm_(new vm::VirtualMachineImpl(this, physical_host, core_amount, ramsize))
{
// xbt_assert(s4u::Host::by_name(name) == nullptr,
- // "Cannot create a VM named %s: this name is already used by a host or a VM", name.c_str());
+ // "Cannot create a VM named %s: this name is already used by a host or a VM", get_cname());
- XBT_DEBUG("Create VM %s", name.c_str());
+ XBT_DEBUG("Create VM %s", get_cname());
/* Currently, a VM uses the network resource of its physical host */
pimpl_netpoint = physical_host->pimpl_netpoint;
ActorPtr Actor::create(std::string name, s4u::Host* host, std::function<void()> code)
{
- simgrid::kernel::actor::ActorImpl* actor = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
+ simgrid::kernel::actor::ActorImpl* actor =
+ simcall_process_create(std::move(name), std::move(code), nullptr, host, nullptr);
return actor->iface();
}
ActorPtr Actor::create(std::string name, s4u::Host* host, std::string function, std::vector<std::string> args)
{
simgrid::simix::ActorCodeFactory& factory = SIMIX_get_actor_code_factory(function);
- return create(name, host, factory(std::move(args)));
+ return create(std::move(name), host, factory(std::move(args)));
}
void intrusive_ptr_add_ref(Actor* actor)
void Actor::set_property(std::string key, std::string value)
{
- simgrid::simix::simcall([this, key, value] { pimpl_->set_property(key, value); });
+ simgrid::simix::simcall([this, key, value] { pimpl_->set_property(key, std::move(value)); });
}
Actor* Actor::restart()
ExecPtr Exec::set_name(std::string name)
{
xbt_assert(state_ == State::INITED, "Cannot change the name of an exec after its start");
- name_ = name;
+ name_ = std::move(name);
return this;
}
ExecPtr Exec::set_tracing_category(std::string category)
{
xbt_assert(state_ == State::INITED, "Cannot change the tracing category of an exec after its start");
- tracing_category_ = category;
+ tracing_category_ = std::move(category);
return this;
}
simgrid::xbt::signal<void(Host&)> Host::on_state_change;
simgrid::xbt::signal<void(Host&)> Host::on_speed_change;
-Host::Host(std::string name) : name_(name)
+Host::Host(std::string name) : name_(std::move(name))
{
- xbt_assert(Host::by_name_or_null(name) == nullptr, "Refusing to create a second host named '%s'.", name.c_str());
+ xbt_assert(Host::by_name_or_null(name_) == nullptr, "Refusing to create a second host named '%s'.", name_.c_str());
Engine::get_instance()->host_register(std::string(name_), this);
new simgrid::surf::HostImpl(this);
}
void Host::set_property(std::string key, std::string value)
{
- simgrid::simix::simcall([this, key, value] { this->pimpl_->set_property(key, value); });
+ simgrid::simix::simcall([this, key, value] { this->pimpl_->set_property(key, std::move(value)); });
}
/** Specify a profile turning the host on and off according to a exhaustive list or a stochastic law.
* The profile must contain boolean values. */
}
void Link::set_property(std::string key, std::string value)
{
- simgrid::simix::simcall([this, key, value] { this->pimpl_->set_property(key, value); });
+ simgrid::simix::simcall([this, key, value] { this->pimpl_->set_property(key, std::move(value)); });
}
} // namespace s4u
} // namespace simgrid
}
void NetZone::set_property(std::string key, std::string value)
{
- simgrid::simix::simcall([this, key, value] { properties_[key] = value; });
+ simgrid::simix::simcall([this, key, value] { properties_[key] = std::move(value); });
}
/** @brief Returns the list of direct children (no grand-children) */
simgrid::xbt::signal<void(s4u::Storage&)> Storage::on_destruction;
simgrid::xbt::signal<void(s4u::Storage&)> Storage::on_state_change;
-Storage::Storage(std::string name, surf::StorageImpl* pimpl) : pimpl_(pimpl), name_(name)
+Storage::Storage(std::string name, surf::StorageImpl* pimpl) : pimpl_(pimpl), name_(std::move(name))
{
- simgrid::s4u::Engine::get_instance()->storage_register(name, this);
+ simgrid::s4u::Engine::get_instance()->storage_register(name_, this);
}
Storage* Storage::by_name(std::string name)
{
smx_actor_t self = SIMIX_process_self();
return simgrid::simix::simcall([name, code, data, host, properties, self] {
- return simgrid::kernel::actor::ActorImpl::create(name, std::move(code), data, host, properties, self).get();
+ return simgrid::kernel::actor::ActorImpl::create(std::move(name), std::move(code), data, host, properties, self)
+ .get();
});
}
xbt_assert(std::isfinite(rate), "rate is not finite!");
return simgrid::simix::simcall([name, host_nb, host_list, flops_amount, bytes_amount, rate, timeout] {
- return SIMIX_execution_parallel_start(name, host_nb, host_list, flops_amount, bytes_amount, rate, timeout);
+ return SIMIX_execution_parallel_start(std::move(name), host_nb, host_list, flops_amount, bytes_amount, rate,
+ timeout);
});
}
{
return simgrid::simix::simcall([name, category, flops_amount, priority, bound, host] {
return simgrid::kernel::activity::ExecImplPtr(
- new simgrid::kernel::activity::ExecImpl(name, category, nullptr, host))
+ new simgrid::kernel::activity::ExecImpl(std::move(name), std::move(category), nullptr, host))
->start(flops_amount, priority, bound);
});
}
}
simgrid::kernel::activity::ExecImplPtr exec = simgrid::kernel::activity::ExecImplPtr(
- new simgrid::kernel::activity::ExecImpl(name, "", timeout_detector, nullptr));
+ new simgrid::kernel::activity::ExecImpl(std::move(name), "", timeout_detector, nullptr));
if (surf_action != nullptr) {
exec->surf_action_ = surf_action;
exec->surf_action_->set_data(exec.get());
TRACE_category(category.c_str());
if (not category.empty())
- process_category[SIMIX_process_self()] = category;
+ process_category[SIMIX_process_self()] = std::move(category);
}
std::string TRACE_internal_smpi_get_category()
class Instance {
public:
- Instance(const std::string name, int max_no_processes, MPI_Comm comm, simgrid::s4u::Barrier* finalization_barrier)
- : name(name)
+ Instance(std::string name, int max_no_processes, MPI_Comm comm, simgrid::s4u::Barrier* finalization_barrier)
+ : name(std::move(name))
, size(max_no_processes)
, present_processes(0)
, comm_world(comm)
{
if (not properties_)
properties_ = new std::unordered_map<std::string, std::string>;
- (*properties_)[key] = value;
+ (*properties_)[key] = std::move(value);
}
/** @brief Return the whole set of properties. Don't mess with it, dude! */
std::string attach)
: Resource(model, name.c_str(), maxminSystem->constraint_new(this, std::max(bread, bwrite)))
, piface_(name, this)
- , typeId_(type_id)
- , content_name(content_name)
+ , typeId_(std::move(type_id))
+ , content_name(std::move(content_name))
, size_(size)
- , attach_(attach)
+ , attach_(std::move(attach))
{
StorageImpl::turn_on();
XBT_DEBUG("Create resource with Bread '%f' Bwrite '%f' and Size '%llu'", bread, bwrite, size);
StorageType(std::string id, std::string model, std::string content,
std::unordered_map<std::string, std::string>* properties,
std::unordered_map<std::string, std::string>* model_properties, sg_size_t size)
- : id(id), model(model), content(content), properties(properties), model_properties(model_properties), size(size)
+ : id(std::move(id))
+ , model(std::move(model))
+ , content(std::move(content))
+ , properties(properties)
+ , model_properties(model_properties)
+ , size(size)
{
}
};
xbt_assert(nullptr == simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(name),
"Refusing to create a router named '%s': this name already describes a node.", name.c_str());
- simgrid::kernel::routing::NetPoint* netpoint =
- new simgrid::kernel::routing::NetPoint(name, simgrid::kernel::routing::NetPoint::Type::Router, current_routing);
- XBT_DEBUG("Router '%s' has the id %u", name.c_str(), netpoint->id());
+ simgrid::kernel::routing::NetPoint* netpoint = new simgrid::kernel::routing::NetPoint(
+ std::move(name), simgrid::kernel::routing::NetPoint::Type::Router, current_routing);
+ XBT_DEBUG("Router '%s' has the id %u", netpoint->get_cname(), netpoint->id());
if (coords && strcmp(coords, ""))
new simgrid::kernel::routing::vivaldi::Coords(netpoint, coords);
double Bwrite = surf_parse_get_bandwidth(storage_type->model_properties->at("Bwrite").c_str(),
"property Bwrite, storage", type_id.c_str());
- StorageImpl* storage =
- new StorageN11(this, id, get_maxmin_system(), Bread, Bwrite, type_id, content_name, storage_type->size, attach);
-
XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s'\n\t\tBread '%f'\n", id.c_str(), type_id.c_str(),
Bread);
- return storage;
+ return new StorageN11(this, std::move(id), get_maxmin_system(), Bread, Bwrite, std::move(type_id),
+ std::move(content_name), storage_type->size, std::move(attach));
}
double StorageN11Model::next_occuring_event(double now)
{
if (simgrid_config == nullptr)
simgrid_config = new simgrid::config::Config();
- simgrid_config->register_option<T>(name, description, std::move(value), std::move(callback));
+ simgrid_config->register_option<T>(name, std::move(description), std::move(value), std::move(callback));
}
template XBT_PUBLIC void declare_flag(std::string name, std::string description, int value,
static void run_test_process(std::string name, simgrid::s4u::Host *location, int size)
{
std::vector<std::string> arg = {std::to_string(size)};
- simgrid::s4u::Actor::create(name, location, computation_fun, arg);
+ simgrid::s4u::Actor::create(std::move(name), location, computation_fun, arg);
}
static void test_energy_consumption(std::string name, int nb_cores)