*
* Later, this actor class is instantiated within the simulation.
*/
-static void receiver(std::string mailbox_name)
+static void receiver(const std::string& mailbox_name)
{
simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name);
std::string mbox = "mb42";
std::string msg = "GaBuZoMeu";
explicit Sender() = default; /* Sending the default message */
- explicit Sender(std::string arg) : msg(arg) { /* Sending the specified message */}
+ explicit Sender(const std::string& arg) : msg(arg) { /* Sending the specified message */}
explicit Sender(std::vector<std::string> args)
{
/* This constructor is used when we start the actor from the deployment file */
XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Property test");
-static void test_host(std::string hostname)
+static void test_host(const std::string& hostname)
{
simgrid::s4u::Host* thehost = simgrid::s4u::Host::by_name(hostname);
std::unordered_map<std::string, std::string>* props = thehost->get_properties();
class XBT_PUBLIC Event {
public:
- Event(std::string name, double start_time, double end_time, std::string type);
+ Event(const std::string& name, double start_time, double end_time, const std::string& type);
Event(const Event&) = delete;
Event& operator=(const Event&) = delete;
~Event();
namespace jedule{
class XBT_PUBLIC Container {
public:
- explicit Container(std::string name);
+ explicit Container(const std::string& name);
Container(const Container&) = delete;
Container& operator=(const Container&) = delete;
virtual ~Container();
/** @brief Get the tracing category associated to the current action */
const std::string& get_category() const { return category_; }
/** @brief Set the tracing category of the current Action */
- void set_category(std::string category) { category_ = std::move(category); }
+ void set_category(const std::string& category) { category_ = category; }
/** @brief Get the priority of the current Action */
double get_priority() const { return sharing_priority_; };
class ClusterZone : public NetZoneImpl {
public:
- explicit ClusterZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
+ explicit ClusterZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel);
void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
void get_graph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
*/
class XBT_PRIVATE DijkstraZone : public RoutedZone {
public:
- DijkstraZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel, bool cached);
+ DijkstraZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel, bool cached);
DijkstraZone(const DijkstraZone&) = delete;
DijkstraZone& operator=(const DijkstraZone&) = delete;
*/
class XBT_PUBLIC DragonflyZone : public ClusterZone {
public:
- explicit DragonflyZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
+ explicit DragonflyZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel);
DragonflyZone(const DragonflyZone&) = delete;
DragonflyZone& operator=(const DragonflyZone&) = delete;
~DragonflyZone() override;
private:
void generate_routers();
void generate_links();
- void create_link(std::string id, int numlinks, resource::LinkImpl** linkup, resource::LinkImpl** linkdown);
+ void create_link(const std::string& id, int numlinks, resource::LinkImpl** linkup, resource::LinkImpl** linkdown);
simgrid::s4u::Link::SharingPolicy sharing_policy_;
double bw_ = 0;
class XBT_PRIVATE EmptyZone : public NetZoneImpl {
public:
- explicit EmptyZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
+ explicit EmptyZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel);
~EmptyZone() override;
void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override
*/
class XBT_PRIVATE FatTreeZone : public ClusterZone {
public:
- explicit FatTreeZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
+ explicit FatTreeZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel);
FatTreeZone(const FatTreeZone&) = delete;
FatTreeZone& operator=(const FatTreeZone&) = delete;
~FatTreeZone() override;
*/
class XBT_PRIVATE FloydZone : public RoutedZone {
public:
- explicit FloydZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
+ explicit FloydZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel);
FloydZone(const FloydZone&) = delete;
FloydZone& operator=(const FloydZone&) = delete;
~FloydZone() override;
*/
class XBT_PRIVATE FullZone : public RoutedZone {
public:
- explicit FullZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
+ explicit FullZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel);
FullZone(const FullZone&) = delete;
FullZone& operator=(const FullZone) = delete;
~FullZone() override;
public:
enum class Type { Host, Router, NetZone };
- NetPoint(std::string name, NetPoint::Type component_type, NetZoneImpl* netzone_p);
+ NetPoint(const std::string& name, NetPoint::Type component_type, NetZoneImpl* netzone_p);
~NetPoint() = default;
// Our rank in the vertices_ array of the netzone that contains us.
friend simgrid::kernel::EngineImpl; // it destroys netRoot_
protected:
- explicit NetZoneImpl(NetZoneImpl* father, std::string name, resource::NetworkModel* network_model);
+ explicit NetZoneImpl(NetZoneImpl* father, const std::string& name, resource::NetworkModel* network_model);
NetZoneImpl(const NetZoneImpl&) = delete;
NetZoneImpl& operator=(const NetZoneImpl&) = delete;
virtual ~NetZoneImpl();
class XBT_PRIVATE RoutedZone : public NetZoneImpl {
public:
- explicit RoutedZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
+ explicit RoutedZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel);
void get_graph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
std::map<std::string, xbt_edge_t>* edges) override;
class XBT_PRIVATE TorusZone : public ClusterZone {
public:
- explicit TorusZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
+ explicit TorusZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel);
void create_links_for_node(ClusterCreationArgs* cluster, int id, int rank, unsigned int position) override;
void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
void parse_specific_arguments(ClusterCreationArgs* cluster) override;
class XBT_PRIVATE VivaldiZone : public ClusterZone {
public:
- explicit VivaldiZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
+ explicit VivaldiZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel);
void set_peer_link(NetPoint* netpoint, double bw_in, double bw_out, const std::string& coord);
void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
*/
class XBT_PUBLIC File {
public:
- File(std::string fullpath, void* userdata);
- File(std::string fullpath, sg_host_t host, void* userdata);
+ File(const std::string& fullpath, void* userdata);
+ File(const std::string& fullpath, sg_host_t host, void* userdata);
File(const File&) = delete;
File& operator=(const File&) = delete;
~File();
*
* If the actor is restarted, the actor has a fresh copy of the function.
*/
- static ActorPtr create(std::string name, s4u::Host* host, const std::function<void()>& code);
- static ActorPtr init(std::string name, s4u::Host* host);
+ static ActorPtr create(const std::string& name, s4u::Host* host, const std::function<void()>& code);
+ static ActorPtr init(const std::string& name, s4u::Host* host);
ActorPtr start(const std::function<void()>& code);
/** Create an actor from a std::function
*
* If the actor is restarted, the actor has a fresh copy of the function.
*/
- template <class F> static ActorPtr create(std::string name, s4u::Host* host, F code)
+ template <class F> static ActorPtr create(const std::string& name, s4u::Host* host, F code)
{
- return create(std::move(name), host, std::function<void()>(std::move(code)));
+ return create(name, host, std::function<void()>(std::move(code)));
}
/** Create an actor using a callable thing and its arguments.
template <class F, class... Args,
// This constructor is enabled only if the call code(args...) is valid:
typename = typename std::result_of<F(Args...)>::type>
- static ActorPtr create(std::string name, s4u::Host* host, F code, Args... args)
+ static ActorPtr create(const std::string& name, s4u::Host* host, F code, Args... args)
{
- return create(std::move(name), host, std::bind(std::move(code), std::move(args)...));
+ return create(name, host, std::bind(std::move(code), std::move(args)...));
}
// Create actor from function name:
- static ActorPtr create(std::string name, s4u::Host* host, const std::string& function, std::vector<std::string> args);
+ static ActorPtr create(const std::string& name, s4u::Host* host, const std::string& function,
+ std::vector<std::string> args);
// ***** Methods *****
/** This actor will be automatically terminated when the last non-daemon actor finishes **/
std::unordered_map<std::string, std::string>*
get_properties(); // FIXME: do not export the map, but only the keys or something
const char* get_property(const std::string& key);
- void set_property(const std::string& key, std::string value);
+ void set_property(const std::string& key, const std::string& value);
#ifndef DOXYGEN
XBT_ATTRIB_DEPRECATED_v325("Please use Actor::on_exit(fun) instead") void on_exit(
* Example:
* e->set_config("host/model:ptask_L07");
*/
- void set_config(std::string str);
+ void set_config(const std::string& str);
private:
simgrid::kernel::EngineImpl* const pimpl;
#ifndef DOXYGEN
public:
/** @deprecated See Engine::load_platform() */
- XBT_ATTRIB_DEPRECATED_v323("Please use Engine::load_platform()") void loadPlatform(std::string platf)
+ XBT_ATTRIB_DEPRECATED_v323("Please use Engine::load_platform()") void loadPlatform(const std::string& platf)
{
load_platform(platf);
}
/** @deprecated See Engine::register_function() */
- XBT_ATTRIB_DEPRECATED_v323("Please use Engine::register_function()") void registerFunction(std::string name,
+ XBT_ATTRIB_DEPRECATED_v323("Please use Engine::register_function()") void registerFunction(const std::string& name,
int (*code)(int, char**))
{
register_function(name, code);
}
/** @deprecated See Engine::register_actor() */
template <class F>
- XBT_ATTRIB_DEPRECATED_v323("Please use Engine::register_actor()") void registerFunction(std::string name)
+ XBT_ATTRIB_DEPRECATED_v323("Please use Engine::register_actor()") void registerFunction(const std::string& name)
{
register_actor<F>(name);
}
/** @deprecated See Engine::register_actor() */
template <class F>
- XBT_ATTRIB_DEPRECATED_v323("Please use Engine::register_actor()") void registerFunction(std::string name, F code)
+ XBT_ATTRIB_DEPRECATED_v323("Please use Engine::register_actor()") void registerFunction(const std::string& name,
+ F code)
{
register_actor<F>(name, code);
}
/** @deprecated See Engine::load_deployment() */
- XBT_ATTRIB_DEPRECATED_v323("Please use Engine::load_deployment()") void loadDeployment(std::string deploy)
+ XBT_ATTRIB_DEPRECATED_v323("Please use Engine::load_deployment()") void loadDeployment(const std::string& deploy)
{
load_deployment(deploy);
}
/** @deprecated See Engine::host_by_name() */
- XBT_ATTRIB_DEPRECATED_v323("Please use Engine::host_by_name()") simgrid::s4u::Host* hostByName(std::string name)
+ XBT_ATTRIB_DEPRECATED_v323("Please use Engine::host_by_name()") simgrid::s4u::Host* hostByName(
+ const std::string& name)
{
return host_by_name(name);
}
/** @deprecated See Engine::host_by_name_or_null() */
XBT_ATTRIB_DEPRECATED_v323("Please use Engine::host_by_name_or_null()") simgrid::s4u::Host* hostByNameOrNull(
- std::string name)
+ const std::string& name)
{
return host_by_name_or_null(name);
}
/** @deprecated See Engine::storage_by_name() */
XBT_ATTRIB_DEPRECATED_v323("Please use Engine::storage_by_name()") simgrid::s4u::Storage* storageByName(
- std::string name)
+ const std::string& name)
{
return storage_by_name(name);
}
/** @deprecated See Engine::storage_by_name_or_null() */
XBT_ATTRIB_DEPRECATED_v323("Please use Engine::storage_by_name_or_null()") simgrid::s4u::Storage* storageByNameOrNull(
- std::string name)
+ const std::string& name)
{
return storage_by_name_or_null(name);
}
XBT_ATTRIB_DEPRECATED_v323("Please use Engine::get_all_netpoints()") void getNetpointList(
std::vector<simgrid::kernel::routing::NetPoint*>* list);
/** @deprecated See Engine::netpoint_by_name_or_null() */
- XBT_ATTRIB_DEPRECATED_v323("Please use Engine::netpoint_by_name_or_null()") simgrid::kernel::routing::NetPoint* getNetpointByNameOrNull(std::string name)
+ XBT_ATTRIB_DEPRECATED_v323("Please use Engine::netpoint_by_name_or_null()")
+ simgrid::kernel::routing::NetPoint* getNetpointByNameOrNull(const std::string& name)
{
return netpoint_by_name_or_null(name);
}
return get_netzone_root();
}
/** @deprecated See Engine::netzone_by_name_or_null() */
- XBT_ATTRIB_DEPRECATED_v323(
- "Please use Engine::netzone_by_name_or_null()") simgrid::s4u::NetZone* getNetzoneByNameOrNull(std::string name)
+ XBT_ATTRIB_DEPRECATED_v323("Please use Engine::netzone_by_name_or_null()")
+ simgrid::s4u::NetZone* getNetzoneByNameOrNull(const std::string& name)
{
return netzone_by_name_or_null(name);
}
return is_initialized();
}
/** @deprecated See Engine::set_config() */
- XBT_ATTRIB_DEPRECATED_v323("Please use Engine::set_config()") void setConfig(std::string str) { set_config(str); }
+ XBT_ATTRIB_DEPRECATED_v323("Please use Engine::set_config()") void setConfig(const std::string& str)
+ {
+ set_config(str);
+ }
#endif
};
bool test() override;
ExecPtr set_bound(double bound);
- ExecPtr set_name(std::string name);
+ ExecPtr set_name(const std::string& name);
ExecPtr set_priority(double priority);
- ExecPtr set_tracing_category(std::string category);
+ ExecPtr set_tracing_category(const std::string& category);
ExecPtr set_timeout(double timeout);
Exec* cancel() override;
friend simgrid::vm::VirtualMachineImpl; // creates the the pimpl_cpu
public:
- explicit Host(std::string name);
+ explicit Host(const std::string& name);
/** Host destruction logic */
protected:
XBT_ATTRIB_DEPRECATED_v325("Please use !is_on()") bool is_off() const { return not is_on(); }
const char* get_property(const std::string& key) const;
- void set_property(const std::string& key, std::string value);
+ void set_property(const std::string& key, const std::string& value);
std::unordered_map<std::string, std::string>* get_properties();
void set_state_profile(kernel::profile::Profile* p);
return get_property(key);
}
/** @deprecated See Host::set_property() */
- XBT_ATTRIB_DEPRECATED_v323("Please use Host::set_property()") void setProperty(std::string key, std::string value)
+ XBT_ATTRIB_DEPRECATED_v323("Please use Host::set_property()") void setProperty(const std::string& key,
+ const std::string& value)
{
set_property(key, value);
}
void set_latency_profile(kernel::profile::Profile* profile);
const char* get_property(const std::string& key);
- void set_property(const std::string& key, std::string value);
+ void set_property(const std::string& key, const std::string& value);
/* The signals */
/** @brief Callback signal fired when a new Link is created */
/** @deprecated */
XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_property()") const char* getProperty(const char* key) {return get_property(key);}
/** @deprecated */
- XBT_ATTRIB_DEPRECATED_v323("Please use Link::set_property()") void setProperty(std::string key, std::string value) {set_property(key, value);}
+ XBT_ATTRIB_DEPRECATED_v323("Please use Link::set_property()") void setProperty(const std::string& key,
+ const std::string& value)
+ {
+ set_property(key, value);
+ }
/** @deprecated */
XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_data()") void* getData() {return get_data();}
return by_name(name);
}
/** @deprecated Mailbox::by_name() */
- XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::by_name()") static MailboxPtr byName(std::string name)
+ XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::by_name()") static MailboxPtr byName(const std::string& name)
{
return by_name(name);
}
/** Retrieve the property value (or nullptr if not set) */
const char* get_property(const std::string& key);
- void set_property(const std::string& key, std::string value);
+ void set_property(const std::string& key, const std::string& value);
/* Add content to the netzone, at parsing time. It should be sealed afterward. */
int add_component(kernel::routing::NetPoint* elm); /* A host, a router or a netzone, whatever */
friend simgrid::surf::StorageImpl;
public:
- explicit Storage(std::string name, surf::StorageImpl * pimpl);
+ explicit Storage(const std::string& name, surf::StorageImpl* pimpl);
protected:
virtual ~Storage() = default;
std::unordered_map<std::string, std::string>* get_properties();
const char* get_property(const std::string& key);
- void set_property(const std::string&, std::string value);
+ void set_property(const std::string&, const std::string& value);
void set_data(void* data) { userdata_ = data; }
void* get_data() { return userdata_; }
// Deprecated functions
#ifndef DOXYGEN
/** @deprecated Storage::by_name() */
- XBT_ATTRIB_DEPRECATED_v323("Please use Storage::by_name()") Storage* byName(std::string name)
+ XBT_ATTRIB_DEPRECATED_v323("Please use Storage::by_name()") Storage* byName(const std::string& name)
{
return by_name(name);
}
return get_property(key);
}
/** @deprecated Storage::set_property() */
- XBT_ATTRIB_DEPRECATED_v323("Please use Storage::set_property()") void setProperty(std::string key, std::string value)
+ XBT_ATTRIB_DEPRECATED_v323("Please use Storage::set_property()") void setProperty(const std::string& key,
+ const std::string& value)
{
set_property(key, value);
}
virtual ~VirtualMachine();
public:
- explicit VirtualMachine(std::string name, s4u::Host* physical_host, int core_amount);
- explicit VirtualMachine(std::string name, s4u::Host* physical_host, int core_amount, size_t ramsize);
+ explicit VirtualMachine(const std::string& name, s4u::Host* physical_host, int core_amount);
+ explicit VirtualMachine(const std::string& name, s4u::Host* physical_host, int core_amount, size_t ramsize);
// No copy/move
VirtualMachine(VirtualMachine const&) = delete;
} // namespace simix
} // namespace simgrid
-XBT_PUBLIC smx_actor_t simcall_process_create(std::string name, const simgrid::simix::ActorCode& code, void* data,
- sg_host_t host, std::unordered_map<std::string, std::string>* properties);
+XBT_PUBLIC smx_actor_t simcall_process_create(const std::string& name, const simgrid::simix::ActorCode& code,
+ void* data, sg_host_t host,
+ std::unordered_map<std::string, std::string>* properties);
XBT_PUBLIC smx_timer_t SIMIX_timer_set(double date, simgrid::xbt::Task<void()> callback);
T args;
public:
- explicit ReplayAction(std::string name) : name(std::move(name)), my_proc_id(simgrid::s4u::this_actor::get_pid()) {}
+ explicit ReplayAction(const std::string& name) : name(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(std::move(name)), req_storage(storage)
- {
- }
+ explicit SendAction(const std::string& name, RequestStorage& storage) : ReplayAction(name), req_storage(storage) {}
void kernel(simgrid::xbt::ReplayAction& action) override;
};
RequestStorage& req_storage;
public:
- explicit RecvAction(std::string name, RequestStorage& storage) : ReplayAction(std::move(name)), req_storage(storage)
- {
- }
+ explicit RecvAction(const std::string& name, RequestStorage& storage) : ReplayAction(name), req_storage(storage) {}
void kernel(simgrid::xbt::ReplayAction& action) override;
};
class GatherAction : public ReplayAction<GatherArgParser> {
public:
- explicit GatherAction(std::string name) : ReplayAction(std::move(name)) {}
+ explicit GatherAction(const std::string& name) : ReplayAction(name) {}
void kernel(simgrid::xbt::ReplayAction& action) override;
};
class GatherVAction : public ReplayAction<GatherVArgParser> {
public:
- explicit GatherVAction(std::string name) : ReplayAction(std::move(name)) {}
+ explicit GatherVAction(const std::string& name) : ReplayAction(name) {}
void kernel(simgrid::xbt::ReplayAction& action) override;
};
extern template XBT_PUBLIC void set_value<std::string>(const char* name, std::string value);
XBT_PUBLIC void set_as_string(const char* name, const std::string& value);
-XBT_PUBLIC void set_parse(std::string options);
+XBT_PUBLIC void set_parse(const std::string& options);
// Get config
* @param callback called with the option value
*/
template <class T>
-XBT_PUBLIC void declare_flag(const std::string& name, std::string description, T value,
+XBT_PUBLIC void declare_flag(const std::string& name, const std::string& description, T value,
std::function<void(const T&)> callback = std::function<void(const T&)>());
-extern template XBT_PUBLIC void declare_flag(const std::string& name, std::string description, int value,
+extern template XBT_PUBLIC void declare_flag(const std::string& name, const std::string& description, int value,
std::function<void(int const&)> callback);
-extern template XBT_PUBLIC void declare_flag(const std::string& name, std::string description, double value,
+extern template XBT_PUBLIC void declare_flag(const std::string& name, const std::string& description, double value,
std::function<void(double const&)> callback);
-extern template XBT_PUBLIC void declare_flag(const std::string& name, std::string description, bool value,
+extern template XBT_PUBLIC void declare_flag(const std::string& name, const std::string& description, bool value,
std::function<void(bool const&)> callback);
-extern template XBT_PUBLIC void declare_flag(const std::string& name, std::string description, std::string value,
+extern template XBT_PUBLIC void declare_flag(const std::string& name, const std::string& description, std::string value,
std::function<void(std::string const&)> callback);
// ***** alias *****
/** Build a path from the provided parameter */
explicit Path(const char* path): path_(path) {}
/** Build a path from the provided parameter */
- explicit Path(std::string path): path_(std::move(path)) {}
+ explicit Path(const std::string& path) : path_(path) {}
/** @brief Returns the full path name */
const std::string& get_name() const { return path_; }
return rootContainer;
}
-NetZoneContainer::NetZoneContainer(std::string name, unsigned int level, NetZoneContainer* father)
- : Container::Container(std::move(name), "", father)
+NetZoneContainer::NetZoneContainer(const std::string& name, unsigned int level, NetZoneContainer* father)
+ : Container::Container(name, "", father)
{
netpoint_ = simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(get_name());
xbt_assert(netpoint_, "Element '%s' not found", get_cname());
}
}
-RouterContainer::RouterContainer(std::string name, Container* father)
- : Container::Container(std::move(name), "ROUTER", father)
+RouterContainer::RouterContainer(const std::string& name, Container* father)
+ : Container::Container(name, "ROUTER", father)
{
xbt_assert(father, "Only the Root container has no father");
trivaNodeTypes.insert(type_->get_name());
}
-Container::Container(std::string name, const std::string& type_name, Container* father)
- : name_(std::move(name)), father_(father)
+Container::Container(const std::string& name, const std::string& type_name, Container* father)
+ : name_(name), father_(father)
{
static long long int container_id = 0;
id_ = container_id; // id (or alias) of the container
allContainers.erase(name_);
}
-void Container::create_child(std::string name, const std::string& type_name)
+void Container::create_child(const std::string& name, const std::string& type_name)
{
- new Container(std::move(name), type_name, this);
+ new Container(name, type_name, this);
}
Container* Container::by_name_or_null(const std::string& name)
long long int id_;
std::string name_; /* Unique name of this container */
public:
- Container(std::string name, const std::string& type_name, Container* father);
+ Container(const std::string& name, const std::string& type_name, Container* father);
Container(const Container&) = delete;
Container& operator=(const Container&) = delete;
virtual ~Container();
StateType* get_state(const std::string& name);
LinkType* get_link(const std::string& name);
VariableType* get_variable(const std::string& name);
- void create_child(std::string name, const std::string& type_name);
+ void create_child(const std::string& name, const std::string& type_name);
static Container* get_root();
};
class NetZoneContainer : public Container {
public:
- NetZoneContainer(std::string name, unsigned int level, NetZoneContainer* father);
+ NetZoneContainer(const std::string& name, unsigned int level, NetZoneContainer* father);
};
class RouterContainer : public Container {
public:
- RouterContainer(std::string name, Container* father);
+ RouterContainer(const std::string& name, Container* father);
};
class HostContainer : public Container {
int size_ = -1;
public:
- LinkEvent(Container* container, Type* type, e_event_type event_type, Container* sourceContainer, std::string value,
- std::string key, int size)
+ LinkEvent(Container* container, Type* type, e_event_type event_type, Container* sourceContainer,
+ const std::string& value, const std::string& key, int size)
: PajeEvent(container, type, SIMIX_get_clock(), event_type)
, endpoint_(sourceContainer)
- , value_(std::move(value))
- , key_(std::move(key))
+ , value_(value)
+ , key_(key)
, size_(size)
{
}
namespace simgrid {
namespace instr {
-Type::Type(std::string name, std::string alias, std::string color, Type* father)
- : id_(instr_new_paje_id()), name_(std::move(name)), color_(std::move(color)), father_(father)
+Type::Type(const std::string& name, const std::string& alias, const std::string& color, Type* father)
+ : id_(instr_new_paje_id()), name_(name), color_(color), father_(father)
{
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({std::move(alias), this});
+ father->children_.insert({alias, this});
XBT_DEBUG("new type %s, child of %s", get_cname(), father->get_cname());
}
if (trace_format == simgrid::instr::TraceFormat::Paje) {
log_definition(PAJE_DefineContainerType);
}
-EventType::EventType(std::string name, Type* father) : ValueType(std::move(name), father)
+EventType::EventType(const std::string& name, Type* father) : ValueType(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(std::move(name), father)
+StateType::StateType(const std::string& name, Type* father) : ValueType(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(const std::string& name, std::string color, Type* father)
- : Type(name, name, std::move(color), father)
+VariableType::VariableType(const std::string& name, const std::string& color, Type* father)
+ : Type(name, name, 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(std::move(name), std::move(alias), father)
+LinkType::LinkType(const std::string& name, const std::string& alias, Type* father) : ValueType(name, alias, father)
{
}
-void LinkType::start_event(Container* startContainer, std::string value, std::string key)
+void LinkType::start_event(Container* startContainer, const std::string& value, const std::string& key)
{
- start_event(startContainer, value, std::move(key), -1);
+ start_event(startContainer, value, key, -1);
}
-void LinkType::start_event(Container* startContainer, std::string value, std::string key, int size)
+void LinkType::start_event(Container* startContainer, const std::string& value, const std::string& key, int size)
{
- new LinkEvent(issuer_, this, PAJE_StartLink, startContainer, value, std::move(key), size);
+ new LinkEvent(issuer_, this, PAJE_StartLink, startContainer, value, key, size);
}
-void LinkType::end_event(Container* endContainer, std::string value, std::string key)
+void LinkType::end_event(Container* endContainer, const std::string& value, const std::string& key)
{
- new LinkEvent(issuer_, this, PAJE_EndLink, endContainer, value, std::move(key), -1);
+ new LinkEvent(issuer_, this, PAJE_EndLink, endContainer, value, key, -1);
}
void Type::log_definition(e_event_type event_type)
add_entity_value(name, "");
}
-void ValueType::add_entity_value(const std::string& name, std::string color)
+void ValueType::add_entity_value(const std::string& name, const std::string& color)
{
if (name.empty())
THROWF(tracing_error, 0, "can't get a value with no name");
auto it = values_.find(name);
if (it == values_.end()) {
- EntityValue* new_val = new EntityValue(name, std::move(color), this);
+ EntityValue* new_val = new EntityValue(name, color, this);
values_.insert({name, new_val});
XBT_DEBUG("new value %s, child of %s", name.c_str(), get_cname());
new_val->print();
return ret->second;
}
-VariableType* Type::by_name_or_create(const std::string& name, std::string color)
+VariableType* Type::by_name_or_create(const std::string& name, const std::string& color)
{
auto cont = children_.find(name);
- 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);
+ std::string mycolor = color.empty() ? "1 1 1" : color;
+ return cont == children_.end() ? new VariableType(name, mycolor, this) : static_cast<VariableType*>(cont->second);
}
LinkType* Type::by_name_or_create(const std::string& name, Type* source, Type* dest)
Container* issuer_ = nullptr;
std::stringstream stream_;
- Type(std::string name, std::string alias, std::string color, Type* father);
+ Type(const std::string& name, const std::string& alias, const std::string& color, Type* father);
virtual ~Type();
const std::string& get_name() const { return name_; }
Type* by_name(const std::string& name);
LinkType* by_name_or_create(const std::string& name, Type* source, Type* dest);
- VariableType* by_name_or_create(const std::string& name, std::string color);
+ VariableType* by_name_or_create(const std::string& name, const std::string& color);
template <class T> T* by_name_or_create(const std::string& name)
{
class VariableType : public Type {
std::vector<VariableEvent*> events_;
public:
- VariableType(const std::string& name, std::string color, Type* father);
+ VariableType(const std::string& name, const std::string& color, Type* father);
~VariableType();
void instr_event(double now, double delta, const char* resource, double value);
void set_event(double timestamp, double value);
class ValueType : public Type {
public:
std::map<std::string, EntityValue*> values_;
- ValueType(std::string name, std::string alias, Type* father) : Type(std::move(name), std::move(alias), "", father){};
+ ValueType(const std::string& name, const std::string& alias, Type* father) : Type(name, alias, "", father){};
ValueType(const std::string& name, Type* father) : Type(name, name, "", father){};
virtual ~ValueType();
- void add_entity_value(const std::string& name, std::string color);
+ void add_entity_value(const std::string& name, const std::string& color);
void add_entity_value(const std::string& name);
EntityValue* get_entity_value(const std::string& name);
};
class LinkType : public ValueType {
public:
- LinkType(std::string name, std::string alias, Type* father);
- void start_event(Container* startContainer, std::string value, std::string key);
- void start_event(Container* startContainer, std::string value, std::string key, int size);
- void end_event(Container* endContainer, std::string value, std::string key);
+ LinkType(const std::string& name, const std::string& alias, Type* father);
+ void start_event(Container* startContainer, const std::string& value, const std::string& key);
+ void start_event(Container* startContainer, const std::string& value, const std::string& key, int size);
+ void end_event(Container* endContainer, const std::string& value, const std::string& key);
};
class EventType : public ValueType {
public:
- EventType(std::string name, Type* father);
+ EventType(const std::string& name, Type* father);
};
class StateType : public ValueType {
std::vector<StateEvent*> events_;
public:
- StateType(std::string name, Type* father);
+ StateType(const std::string& name, Type* father);
~StateType();
void set_event(const std::string& value_name);
void push_event(const std::string& value_name);
namespace simgrid {
namespace instr {
-EntityValue::EntityValue(std::string name, std::string color, Type* father)
- : id_(instr_new_paje_id()), name_(std::move(name)), color_(std::move(color)), father_(father){};
+EntityValue::EntityValue(const std::string& name, const std::string& color, Type* father)
+ : id_(instr_new_paje_id()), name_(name), color_(color), father_(father){};
void EntityValue::print()
{
Type* father_;
public:
- explicit EntityValue(std::string name, std::string color, Type* father);
+ explicit EntityValue(const std::string& name, const std::string& color, Type* father);
~EntityValue() = default;
const char* get_cname() { return name_.c_str(); }
long long int get_id() { return id_; }
std::string recv_type = "";
// NoOpTI: init, finalize, test, wait, barrier
- explicit TIData(std::string name) : name_(std::move(name)){};
+ explicit TIData(const std::string& name) : name_(name){};
// CPuTI: compute, sleep (+ waitAny and waitall out of laziness)
- explicit TIData(std::string name, double amount) : name_(std::move(name)), amount_(amount){};
+ explicit TIData(const std::string& name, double amount) : name_(name), amount_(amount){};
// Pt2PtTI: send, isend, sssend, issend, recv, irecv
- explicit TIData(std::string name, int endpoint, int size, std::string datatype)
- : name_(std::move(name)), endpoint(endpoint), send_size(size), send_type(std::move(datatype)){};
+ explicit TIData(const std::string& name, int endpoint, int size, const std::string& datatype)
+ : name_(name), endpoint(endpoint), send_size(size), send_type(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_(std::move(name))
+ explicit TIData(const std::string& name, int root, double amount, int send_size, int recv_size,
+ const std::string& send_type, const std::string& recv_type)
+ : name_(name)
, amount_(amount)
, endpoint(root)
, send_size(send_size)
, recv_size(recv_size)
- , send_type(std::move(send_type))
- , recv_type(std::move(recv_type)){};
+ , send_type(send_type)
+ , recv_type(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(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_(std::move(name))
+ explicit TIData(const std::string& name, int root, int send_size, std::vector<int>* sendcounts, int recv_size,
+ std::vector<int>* recvcounts, const std::string& send_type, const 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){};
+
+ explicit TIData(const 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, const std::string& send_type,
+ const std::string& recv_type)
+ : name_(name)
, endpoint(root)
, send_size(send_size)
, sendcounts(sendcounts)
, recv_size(recv_size)
, recvcounts(recvcounts)
- , send_type(std::move(send_type))
- , recv_type(std::move(recv_type)){};
+ , send_type(send_type)
+ , recv_type(recv_type){};
virtual ~TIData() {}
class NoOpTIData : public TIData {
public:
- explicit NoOpTIData(std::string name) : TIData(std::move(name)){};
+ explicit NoOpTIData(const std::string& name) : TIData(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(std::move(name), amount){};
+ explicit CpuTIData(const std::string& name, double amount) : TIData(name, amount){};
std::string print() override
{
std::stringstream stream;
class Pt2PtTIData : public TIData {
int tag;
public:
- explicit Pt2PtTIData(std::string name, int endpoint, int size, int tag, std::string datatype)
- : TIData(std::move(name), endpoint, size, std::move(datatype)), tag(tag){};
+ explicit Pt2PtTIData(const std::string& name, int endpoint, int size, int tag, const std::string& datatype)
+ : TIData(name, endpoint, size, datatype), tag(tag){};
- explicit Pt2PtTIData(std::string name, int endpoint, int size, std::string datatype)
- : TIData(std::move(name), endpoint, size, std::move(datatype)), tag(0){};
+ explicit Pt2PtTIData(const std::string& name, int endpoint, int size, const std::string& datatype)
+ : TIData(name, endpoint, size, datatype), tag(0){};
std::string print() override
{
std::stringstream stream;
class CollTIData : public TIData {
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(std::move(name), root, amount, send_size, recv_size, std::move(send_type), std::move(recv_type)){};
+ explicit CollTIData(const std::string& name, int root, double amount, int send_size, int recv_size,
+ const std::string& send_type, const std::string& recv_type)
+ : TIData(name, root, amount, send_size, recv_size, send_type, recv_type){};
std::string print() override
{
std::stringstream stream;
class VarCollTIData : public TIData {
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(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(std::move(name), root, send_size, sendcounts, recv_size, recvcounts, std::move(send_type),
- std::move(recv_type)){};
+ explicit VarCollTIData(const std::string& name, int root, int send_size, std::vector<int>* sendcounts, int recv_size,
+ std::vector<int>* recvcounts, const std::string& send_type, const std::string& recv_type)
+ : TIData(name, root, send_size, sendcounts, recv_size, recvcounts, send_type, recv_type){};
+
+ explicit VarCollTIData(const 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, const std::string& send_type,
+ const std::string& recv_type)
+ : TIData(name, root, send_size, sendcounts, recv_size, recvcounts, send_type, recv_type){};
std::string print() override
{
XBT_PRIVATE container_t smpi_container(int rank);
XBT_PRIVATE void TRACE_smpi_setup_container(int rank, sg_host_t host);
-XBT_PRIVATE void TRACE_internal_smpi_set_category(std::string category);
+XBT_PRIVATE void TRACE_internal_smpi_set_category(const std::string& category);
XBT_PRIVATE std::string TRACE_internal_smpi_get_category();
XBT_PRIVATE void TRACE_smpi_computing_init(int rank);
XBT_PRIVATE void TRACE_smpi_computing_out(int rank);
namespace simgrid{
namespace jedule{
-Event::Event(std::string name, double start_time, double end_time, std::string type)
- : name_(std::move(name)), start_time_(start_time), end_time_(end_time), type_(std::move(type))
+Event::Event(const std::string& name, double start_time, double end_time, const std::string& type)
+ : name_(name), start_time_(start_time), end_time_(end_time), type_(type)
{
this->resource_subsets_ = new std::vector<jed_subset_t>();
}
nres=end_idx-start_idx+1;
}
-Container::Container(std::string name) : name(std::move(name))
+Container::Container(const std::string& name) : name(name)
{
container_name2container.insert({this->name, this});
}
on_resumed(this);
}
-void ActivityImpl::set_category(std::string category)
+void ActivityImpl::set_category(const std::string& category)
{
if (surf_action_)
- surf_action_->set_category(std::move(category));
+ surf_action_->set_category(category);
}
// boost::intrusive_ptr<Activity> support:
class XBT_PUBLIC ActivityImpl {
public:
ActivityImpl() = default;
- explicit ActivityImpl(std::string name) : name_(std::move(name)) {}
+ explicit ActivityImpl(const std::string& name) : name_(name) {}
virtual ~ActivityImpl() = default;
e_smx_state_t state_ = SIMIX_WAITING; /* State of the activity */
std::list<smx_simcall_t> simcalls_; /* List of simcalls waiting for this activity */
virtual void resume();
virtual void post() = 0; // What to do when a simcall terminates
virtual void finish() = 0;
- void set_category(std::string category);
+ void set_category(const std::string& category);
// boost::intrusive_ptr<ActivityImpl> support:
friend XBT_PUBLIC void intrusive_ptr_add_ref(ActivityImpl* activity);
namespace kernel {
namespace activity {
-IoImpl::IoImpl(std::string name, surf::StorageImpl* storage) : ActivityImpl(std::move(name)), storage_(storage)
+IoImpl::IoImpl(const std::string& name, surf::StorageImpl* storage) : ActivityImpl(name), storage_(storage)
{
this->state_ = SIMIX_RUNNING;
class XBT_PUBLIC IoImpl : public ActivityImpl {
public:
~IoImpl() override;
- explicit IoImpl(std::string name, surf::StorageImpl* storage);
+ explicit IoImpl(const std::string& name, surf::StorageImpl* storage);
IoImpl* start(sg_size_t size, simgrid::s4u::Io::OpType type);
void post() override;
friend s4u::MailboxPtr s4u::Mailbox::by_name(const std::string& name);
friend mc::CommunicationDeterminismChecker;
- explicit MailboxImpl(std::string name)
- : piface_(this), name_(std::move(name)), comm_queue_(MAX_MAILBOX_SIZE), done_comm_queue_(MAX_MAILBOX_SIZE)
+ explicit MailboxImpl(const std::string& name)
+ : piface_(this), name_(name), comm_queue_(MAX_MAILBOX_SIZE), done_comm_queue_(MAX_MAILBOX_SIZE)
{
}
~SleepImpl() override;
public:
- explicit SleepImpl(std::string name, s4u::Host* host) : ActivityImpl(std::move(name)), host_(host) {}
+ explicit SleepImpl(const std::string& name, s4u::Host* host) : ActivityImpl(name), host_(host) {}
void post() override;
void finish() override;
SleepImpl* start(double duration);
namespace simgrid {
namespace kernel {
namespace routing {
-ClusterZone::ClusterZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
- : NetZoneImpl(father, std::move(name), netmodel)
+ClusterZone::ClusterZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel)
+ : NetZoneImpl(father, name, netmodel)
{
}
int graph_id_ = -1; /* used for caching internal graph id's */
};
-DijkstraZone::DijkstraZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel, bool cached)
- : RoutedZone(father, std::move(name), netmodel), cached_(cached)
+DijkstraZone::DijkstraZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel, bool cached)
+ : RoutedZone(father, name, netmodel), cached_(cached)
{
}
namespace kernel {
namespace routing {
-DragonflyZone::DragonflyZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
- : ClusterZone(father, std::move(name), netmodel)
+DragonflyZone::DragonflyZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel)
+ : ClusterZone(father, name, netmodel)
{
}
}
}
-void DragonflyZone::create_link(std::string id, int numlinks, resource::LinkImpl** linkup,
+void DragonflyZone::create_link(const std::string& id, int numlinks, resource::LinkImpl** linkup,
resource::LinkImpl** linkdown)
{
*linkup = nullptr;
namespace kernel {
namespace routing {
-EmptyZone::EmptyZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
- : NetZoneImpl(father, std::move(name), netmodel)
+EmptyZone::EmptyZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel)
+ : NetZoneImpl(father, name, netmodel)
{
}
namespace kernel {
namespace routing {
-FatTreeZone::FatTreeZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
- : ClusterZone(father, std::move(name), netmodel)
+FatTreeZone::FatTreeZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel)
+ : ClusterZone(father, name, netmodel)
{
XBT_DEBUG("Creating a new fat tree.");
}
namespace kernel {
namespace routing {
-FloydZone::FloydZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
- : RoutedZone(father, std::move(name), netmodel)
+FloydZone::FloydZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel)
+ : RoutedZone(father, name, netmodel)
{
predecessor_table_ = nullptr;
cost_table_ = nullptr;
namespace simgrid {
namespace kernel {
namespace routing {
-FullZone::FullZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
- : RoutedZone(father, std::move(name), netmodel)
+FullZone::FullZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel)
+ : RoutedZone(father, name, netmodel)
{
}
simgrid::xbt::signal<void(NetPoint*)> NetPoint::on_creation;
-NetPoint::NetPoint(std::string name, NetPoint::Type componentType, NetZoneImpl* netzone_p)
- : name_(std::move(name)), component_type_(componentType), englobing_zone_(netzone_p)
+NetPoint::NetPoint(const std::string& name, NetPoint::Type componentType, NetZoneImpl* netzone_p)
+ : name_(name), component_type_(componentType), englobing_zone_(netzone_p)
{
if (netzone_p != nullptr)
id_ = netzone_p->add_component(this);
std::vector<resource::LinkImpl*> links;
};
-NetZoneImpl::NetZoneImpl(NetZoneImpl* father, std::string name, resource::NetworkModel* network_model)
- : network_model_(network_model), piface_(this), father_(father), name_(std::move(name))
+NetZoneImpl::NetZoneImpl(NetZoneImpl* father, const std::string& name, resource::NetworkModel* network_model)
+ : network_model_(network_model), piface_(this), father_(father), name_(name)
{
xbt_assert(nullptr == simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(get_name()),
"Refusing to create a second NetZone called '%s'.", get_cname());
namespace kernel {
namespace routing {
-RoutedZone::RoutedZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
- : NetZoneImpl(father, std::move(name), netmodel)
+RoutedZone::RoutedZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel)
+ : NetZoneImpl(father, name, netmodel)
{
}
namespace simgrid {
namespace kernel {
namespace routing {
-TorusZone::TorusZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
- : ClusterZone(father, std::move(name), netmodel)
+TorusZone::TorusZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel)
+ : ClusterZone(father, name, netmodel)
{
}
return &coords->coords;
}
-VivaldiZone::VivaldiZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
- : ClusterZone(father, std::move(name), netmodel)
+VivaldiZone::VivaldiZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel)
+ : ClusterZone(father, name, netmodel)
{
}
}
}
-void replay(std::string path_string)
+void replay(const std::string& path_string)
{
simgrid::mc::processes_time.resize(SIMIX_process_get_maxpid());
simgrid::mc::RecordTrace trace = simgrid::mc::parseRecordTrace(path_string.c_str());
XBT_PRIVATE void dumpRecordPath();
XBT_PRIVATE void replay(RecordTrace const& trace);
-XBT_PRIVATE void replay(std::string trace);
+XBT_PRIVATE void replay(const std::string& trace);
}
}
double rate_ = -1; /* Capping for network resource, or -1 for no capping*/
bool is_used_ = false; /* Indicates whether the task is used in SIMIX currently */
- explicit Task(std::string name, double flops_amount, double bytes_amount, void* data);
- explicit Task(std::string name, std::vector<s4u::Host*>&& hosts, std::vector<double>&& flops_amount,
+ explicit Task(const std::string& name, double flops_amount, double bytes_amount, void* data);
+ explicit Task(const std::string& name, std::vector<s4u::Host*>&& hosts, std::vector<double>&& flops_amount,
std::vector<double>&& bytes_amount, void* data);
void report_multiple_use() const;
public:
- static Task* create(std::string name, double flops_amount, double bytes_amount, void* data);
- static Task* create_parallel(std::string name, int host_nb, const msg_host_t* host_list, double* flops_amount,
+ static Task* create(const std::string& name, double flops_amount, double bytes_amount, void* data);
+ static Task* create_parallel(const std::string& name, int host_nb, const msg_host_t* host_list, double* flops_amount,
double* bytes_amount, void* data);
msg_error_t execute();
- msg_error_t send(std::string alias, double timeout);
- s4u::CommPtr send_async(std::string alias, void_f_pvoid_t cleanup, bool detached);
+ msg_error_t send(const std::string& alias, double timeout);
+ s4u::CommPtr send_async(const std::string& alias, void_f_pvoid_t cleanup, bool detached);
void cancel();
namespace simgrid {
namespace msg {
-Task::Task(std::string name, double flops_amount, double bytes_amount, void* data)
- : name_(std::move(name)), userdata_(data), flops_amount(flops_amount), bytes_amount(bytes_amount)
+Task::Task(const std::string& name, double flops_amount, double bytes_amount, void* data)
+ : name_(name), userdata_(data), flops_amount(flops_amount), bytes_amount(bytes_amount)
{
static std::atomic_ullong counter{0};
id_ = counter++;
MC_ignore_heap(&(id_), sizeof(id_));
}
-Task::Task(std::string name, std::vector<s4u::Host*>&& hosts, std::vector<double>&& flops_amount,
+Task::Task(const std::string& name, std::vector<s4u::Host*>&& hosts, std::vector<double>&& flops_amount,
std::vector<double>&& bytes_amount, void* data)
- : Task(std::move(name), 1.0, 0, data)
+ : Task(name, 1.0, 0, data)
{
parallel_ = true;
hosts_ = std::move(hosts);
bytes_parallel_amount = std::move(bytes_amount);
}
-Task* Task::create(std::string name, double flops_amount, double bytes_amount, void* data)
+Task* Task::create(const std::string& name, double flops_amount, double bytes_amount, void* data)
{
return new Task(std::move(name), flops_amount, bytes_amount, data);
}
-Task* Task::create_parallel(std::string name, int host_nb, const msg_host_t* host_list, double* flops_amount,
+Task* Task::create_parallel(const std::string& name, int host_nb, const msg_host_t* host_list, double* flops_amount,
double* bytes_amount, void* data)
{
std::vector<s4u::Host*> hosts;
return status;
}
-s4u::CommPtr Task::send_async(std::string alias, void_f_pvoid_t cleanup, bool detached)
+s4u::CommPtr Task::send_async(const std::string& alias, void_f_pvoid_t cleanup, bool detached)
{
if (TRACE_actor_is_enabled()) {
container_t process_container = simgrid::instr::Container::by_name(instr_pid(MSG_process_self()));
return comm;
}
-msg_error_t Task::send(std::string alias, double timeout)
+msg_error_t Task::send(const std::string& alias, double timeout)
{
msg_error_t ret = MSG_OK;
/* Try to send it */
simgrid::xbt::Extension<Storage, FileSystemStorageExt> FileSystemStorageExt::EXTENSION_ID;
simgrid::xbt::Extension<Host, FileDescriptorHostExt> FileDescriptorHostExt::EXTENSION_ID;
-File::File(std::string fullpath, void* userdata) : File(std::move(fullpath), Host::current(), userdata){};
+File::File(const std::string& fullpath, void* userdata) : File(fullpath, Host::current(), userdata){};
-File::File(std::string fullpath, sg_host_t host, void* userdata) : fullpath_(std::move(fullpath)), userdata_(userdata)
+File::File(const std::string& fullpath, sg_host_t host, void* userdata) : fullpath_(fullpath), userdata_(userdata)
{
// this cannot fail because we get a xbt_die if the mountpoint does not exist
Storage* st = nullptr;
[](double val){if (val != 0.1) sg_host_dvfs_plugin_init();});
static simgrid::config::Flag<std::string> cfg_governor("plugin/dvfs/governor",
- "Which Governor should be used that adapts the CPU frequency?", "performance",
+ "Which Governor should be used that adapts the CPU frequency?",
+ "performance",
- std::map<std::string, std::string>({
+ std::map<std::string, std::string>({
#if HAVE_SMPI
- {"adagio", "TODO: Doc"},
+ {"adagio", "TODO: Doc"},
#endif
- {"conservative", "TODO: Doc"},
- {"ondemand", "TODO: Doc"},
- {"performance", "TODO: Doc"},
- {"powersave", "TODO: Doc"},
- }),
-
- [](std::string val) { if (val != "performance") sg_host_dvfs_plugin_init(); });
+ {"conservative", "TODO: Doc"}, {"ondemand", "TODO: Doc"},
+ {"performance", "TODO: Doc"}, {"powersave", "TODO: Doc"},
+ }),
+
+ [](const std::string& val) {
+ if (val != "performance")
+ sg_host_dvfs_plugin_init();
+ });
static simgrid::config::Flag<int>
cfg_min_pstate("plugin/dvfs/min-pstate", {"plugin/dvfs/min_pstate"},
simgrid::xbt::signal<void(VirtualMachine&)> VirtualMachine::on_migration_start;
simgrid::xbt::signal<void(VirtualMachine&)> VirtualMachine::on_migration_end;
-VirtualMachine::VirtualMachine(std::string name, s4u::Host* physical_host, int core_amount)
- : VirtualMachine(std::move(name), physical_host, core_amount, 1024)
+VirtualMachine::VirtualMachine(const std::string& name, s4u::Host* physical_host, int core_amount)
+ : VirtualMachine(name, physical_host, core_amount, 1024)
{
}
-VirtualMachine::VirtualMachine(std::string name, s4u::Host* physical_host, int core_amount, size_t ramsize)
- : Host(std::move(name)), pimpl_vm_(new vm::VirtualMachineImpl(this, physical_host, core_amount, ramsize))
+VirtualMachine::VirtualMachine(const 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))
{
// 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", get_cname());
return self_context->get_actor()->iface();
}
-ActorPtr Actor::init(std::string name, s4u::Host* host)
+ActorPtr Actor::init(const std::string& name, s4u::Host* host)
{
smx_actor_t self = SIMIX_process_self();
simgrid::kernel::actor::ActorImpl* actor =
- simgrid::simix::simcall([self, name, host] { return self->init(std::move(name), host).get(); });
+ simgrid::simix::simcall([self, &name, host] { return self->init(name, host).get(); });
return actor->ciface();
}
return this;
}
-ActorPtr Actor::create(std::string name, s4u::Host* host, const std::function<void()>& code)
+ActorPtr Actor::create(const std::string& name, s4u::Host* host, const std::function<void()>& code)
{
- simgrid::kernel::actor::ActorImpl* actor = simcall_process_create(std::move(name), code, nullptr, host, nullptr);
+ simgrid::kernel::actor::ActorImpl* actor = simcall_process_create(name, code, nullptr, host, nullptr);
return actor->iface();
}
-ActorPtr Actor::create(std::string name, s4u::Host* host, const std::string& function, std::vector<std::string> args)
+ActorPtr Actor::create(const std::string& name, s4u::Host* host, const std::string& function,
+ std::vector<std::string> args)
{
simgrid::simix::ActorCodeFactory& factory = SIMIX_get_actor_code_factory(function);
- return create(std::move(name), host, factory(std::move(args)));
+ return create(name, host, factory(std::move(args)));
}
void intrusive_ptr_add_ref(Actor* actor)
/** Retrieve the property value (or nullptr if not set) */
const char* Actor::get_property(const std::string& key)
{
- return simgrid::simix::simcall([this, key] { return pimpl_->get_property(key); });
+ return simgrid::simix::simcall([this, &key] { return pimpl_->get_property(key); });
}
-void Actor::set_property(const std::string& key, std::string value)
+void Actor::set_property(const std::string& key, const std::string& value)
{
- simgrid::simix::simcall([this, key, value] { pimpl_->set_property(key, std::move(value)); });
+ simgrid::simix::simcall([this, &key, &value] { pimpl_->set_property(key, value); });
}
Actor* Actor::restart()
{
return Engine::instance_ != nullptr;
}
-void Engine::set_config(std::string str)
+void Engine::set_config(const std::string& str)
{
- simgrid::config::set_parse(std::move(str));
+ simgrid::config::set_parse(str);
}
} // namespace s4u
} // namespace simgrid
return this;
}
-ExecPtr Exec::set_name(std::string name)
+ExecPtr Exec::set_name(const std::string& name)
{
xbt_assert(state_ == State::INITED, "Cannot change the name of an exec after its start");
- name_ = std::move(name);
+ name_ = name;
return this;
}
return this;
}
-ExecPtr Exec::set_tracing_category(std::string category)
+ExecPtr Exec::set_tracing_category(const std::string& category)
{
xbt_assert(state_ == State::INITED, "Cannot change the tracing category of an exec after its start");
- tracing_category_ = std::move(category);
+ tracing_category_ = 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_(std::move(name))
+Host::Host(const std::string& name) : name_(name)
{
xbt_assert(Host::by_name_or_null(name_) == nullptr, "Refusing to create a second host named '%s'.", get_cname());
- Engine::get_instance()->host_register(std::string(name_), this);
+ Engine::get_instance()->host_register(name_, this);
new simgrid::surf::HostImpl(this);
}
return this->pimpl_->get_property(key);
}
-void Host::set_property(const std::string& key, std::string value)
+void Host::set_property(const std::string& key, const std::string& value)
{
- simgrid::simix::simcall([this, key, value] { this->pimpl_->set_property(key, std::move(value)); });
+ simgrid::simix::simcall([this, &key, &value] { this->pimpl_->set_property(key, 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. */
{
return this->pimpl_->get_property(key);
}
-void Link::set_property(const std::string& key, std::string value)
+void Link::set_property(const std::string& key, const std::string& value)
{
- simgrid::simix::simcall([this, key, value] { this->pimpl_->set_property(key, std::move(value)); });
+ simgrid::simix::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); });
}
} // namespace s4u
} // namespace simgrid
{
return properties_.at(key).c_str();
}
-void NetZone::set_property(const std::string& key, std::string value)
+void NetZone::set_property(const std::string& key, const std::string& value)
{
- simgrid::simix::simcall([this, key, value] { properties_[key] = std::move(value); });
+ simgrid::simix::simcall([this, &key, &value] { properties_[key] = 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_(std::move(name))
+Storage::Storage(const std::string& name, surf::StorageImpl* pimpl) : pimpl_(pimpl), name_(name)
{
simgrid::s4u::Engine::get_instance()->storage_register(name_, this);
}
return this->pimpl_->get_property(key);
}
-void Storage::set_property(const std::string& key, std::string value)
+void Storage::set_property(const std::string& key, const 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, value); });
}
IoPtr Storage::io_init(sg_size_t size, Io::OpType type)
namespace kernel {
namespace actor {
-ActorImpl::ActorImpl(simgrid::xbt::string name, s4u::Host* host) : host_(host), name_(name), piface_(this)
+ActorImpl::ActorImpl(const simgrid::xbt::string& name, s4u::Host* host) : host_(host), name_(name), piface_(this)
{
pid_ = simix_process_maxpid++;
simcall.issuer = this;
* In the future, it might be extended in order to attach other threads created by a third party library.
*/
-ActorImplPtr ActorImpl::attach(std::string name, void* data, s4u::Host* host,
+ActorImplPtr ActorImpl::attach(const std::string& name, void* data, s4u::Host* host,
std::unordered_map<std::string, std::string>* properties)
{
// This is mostly a copy/paste from create(), it'd be nice to share some code between those two functions.
dest->pimpl_->process_list_.push_back(*this);
}
-ActorImplPtr ActorImpl::init(std::string name, s4u::Host* host)
+ActorImplPtr ActorImpl::init(const std::string& name, s4u::Host* host)
{
ActorImpl* actor = new ActorImpl(simgrid::xbt::string(name), host);
actor->set_ppid(this->pid_);
return this;
}
-ActorImplPtr ActorImpl::create(std::string name, const simix::ActorCode& code, void* data, s4u::Host* host,
+ActorImplPtr ActorImpl::create(const std::string& name, const simix::ActorCode& code, void* data, s4u::Host* host,
std::unordered_map<std::string, std::string>* properties, ActorImpl* parent_actor)
{
XBT_DEBUG("Start actor %s@'%s'", name.c_str(), host->get_cname());
* @param host where the new agent is executed.
* @param properties the properties of the process
*/
-smx_actor_t simcall_process_create(std::string name, const simgrid::simix::ActorCode& code, void* data, sg_host_t host,
- std::unordered_map<std::string, std::string>* properties)
+smx_actor_t simcall_process_create(const std::string& name, const simgrid::simix::ActorCode& code, void* data,
+ sg_host_t host, std::unordered_map<std::string, std::string>* properties)
{
smx_actor_t self = SIMIX_process_self();
- return simgrid::simix::simcall([name, &code, data, host, properties, self] {
- return simgrid::kernel::actor::ActorImpl::create(std::move(name), code, data, host, properties, self).get();
+ return simgrid::simix::simcall([&name, &code, data, host, properties, self] {
+ return simgrid::kernel::actor::ActorImpl::create(name, code, data, host, properties, self).get();
});
}
public:
xbt::string name_;
- ActorImpl(xbt::string name, s4u::Host* host);
+ ActorImpl(const xbt::string& name, s4u::Host* host);
ActorImpl(const ActorImpl&) = delete;
ActorImpl& operator=(const ActorImpl&) = delete;
~ActorImpl();
s4u::ActorPtr iface() { return s4u::ActorPtr(&piface_); }
s4u::Actor* ciface() { return &piface_; }
- ActorImplPtr init(std::string name, s4u::Host* host);
+ ActorImplPtr init(const std::string& name, s4u::Host* host);
ActorImpl* start(const simix::ActorCode& code);
- static ActorImplPtr create(std::string name, const simix::ActorCode& code, void* data, s4u::Host* host,
+ static ActorImplPtr create(const std::string& name, const simix::ActorCode& code, void* data, s4u::Host* host,
std::unordered_map<std::string, std::string>* properties, ActorImpl* parent_actor);
- static ActorImplPtr attach(std::string name, void* data, s4u::Host* host,
+ static ActorImplPtr attach(const std::string& name, void* data, s4u::Host* host,
std::unordered_map<std::string, std::string>* properties);
static void detach();
void cleanup();
bool daemon_ = false;
ProcessArg() = default;
- explicit ProcessArg(std::string name, const std::function<void()>& code, void* data, s4u::Host* host,
+ explicit ProcessArg(const std::string& name, const std::function<void()>& code, void* data, s4u::Host* host,
double kill_time, std::shared_ptr<std::unordered_map<std::string, std::string>> properties,
bool auto_restart)
: name(name)
{"win_flush_local_all", "1 0 0.3"}
};
-static const char* instr_find_color(std::string state)
+static const char* instr_find_color(const char* c_state)
{
+ std::string state(c_state);
boost::algorithm::to_lower(state);
if (state.substr(0, 5) == "pmpi_")
state = state.substr(5, std::string::npos); // Remove pmpi_ to allow for exact matches
static std::unordered_map<smx_actor_t, std::string> process_category;
-void TRACE_internal_smpi_set_category(std::string category)
+void TRACE_internal_smpi_set_category(const std::string& category)
{
if (not TRACE_smpi_is_enabled())
return;
TRACE_category(category.c_str());
if (not category.empty())
- process_category[SIMIX_process_self()] = std::move(category);
+ process_category[SIMIX_process_self()] = category;
}
std::string TRACE_internal_smpi_get_category()
class Instance {
public:
- Instance(std::string name, int max_no_processes, MPI_Comm comm, simgrid::s4u::Barrier* finalization_barrier)
- : name(std::move(name))
+ Instance(const std::string& name, int max_no_processes, MPI_Comm comm, simgrid::s4u::Barrier* finalization_barrier)
+ : name(name)
, size(max_no_processes)
, present_processes(0)
, comm_world(comm)
}
/** @brief Change the value of a given key in the property set */
-void PropertyHolder::set_property(const std::string& key, std::string value)
+void PropertyHolder::set_property(const std::string& key, const std::string& value)
{
if (not properties_)
properties_ = new std::unordered_map<std::string, std::string>;
- (*properties_)[key] = std::move(value);
+ (*properties_)[key] = value;
}
/** @brief Return the whole set of properties. Don't mess with it, dude! */
~PropertyHolder();
const char* get_property(const std::string& key);
- void set_property(const std::string& id, std::string value);
+ void set_property(const std::string& id, const std::string& value);
/* FIXME: This should not be exposed, as users may do bad things with the map they got (it's not a copy).
* But some user API expose this call so removing it is not so easy.
************/
StorageImpl::StorageImpl(kernel::resource::Model* model, const std::string& name, kernel::lmm::System* maxminSystem,
- double bread, double bwrite, std::string type_id, std::string content_name, sg_size_t size,
- std::string attach)
+ double bread, double bwrite, const std::string& type_id, const std::string& content_name,
+ sg_size_t size, const std::string& attach)
: Resource(model, name, maxminSystem->constraint_new(this, std::max(bread, bwrite)))
, piface_(name, this)
- , typeId_(std::move(type_id))
- , content_name(std::move(content_name))
+ , typeId_(type_id)
+ , content_name(content_name)
, size_(size)
- , attach_(std::move(attach))
+ , attach_(attach)
{
StorageImpl::turn_on();
XBT_DEBUG("Create resource with Bread '%f' Bwrite '%f' and Size '%llu'", bread, bwrite, size);
StorageModel& operator=(const StorageModel&) = delete;
~StorageModel();
- virtual StorageImpl* createStorage(std::string id, std::string type_id, std::string content_name,
- std::string attach) = 0;
+ virtual StorageImpl* createStorage(const std::string& id, const std::string& type_id, const std::string& content_name,
+ const std::string& attach) = 0;
};
/************
public:
/** @brief Storage constructor */
StorageImpl(kernel::resource::Model* model, const std::string& name, kernel::lmm::System* maxmin_system, double bread,
- double bwrite, std::string type_id, std::string content_name, sg_size_t size, std::string attach);
+ double bwrite, const std::string& type_id, const std::string& content_name, sg_size_t size,
+ const std::string& attach);
StorageImpl(const StorageImpl&) = delete;
StorageImpl& operator=(const StorageImpl&) = delete;
std::unordered_map<std::string, std::string>* properties;
std::unordered_map<std::string, std::string>* model_properties;
sg_size_t size;
- StorageType(std::string id, std::string model, std::string content,
+ StorageType(const std::string& id, const std::string& model, const 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(std::move(id))
- , model(std::move(model))
- , content(std::move(content))
- , properties(properties)
- , model_properties(model_properties)
- , size(size)
+ : id(id), model(model), content(content), properties(properties), model_properties(model_properties), size(size)
{
}
};
}
/** @brief Add a "router" to the network element list */
-simgrid::kernel::routing::NetPoint* sg_platf_new_router(std::string name, const char* coords)
+simgrid::kernel::routing::NetPoint* sg_platf_new_router(const std::string& name, const char* coords)
{
if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::base;
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(
- std::move(name), simgrid::kernel::routing::NetPoint::Type::Router, current_routing);
+ 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", netpoint->get_cname(), netpoint->id());
if (coords && strcmp(coords, ""))
all_existing_models.push_back(this);
}
-StorageImpl* StorageN11Model::createStorage(std::string id, std::string type_id, std::string content_name,
- std::string attach)
+StorageImpl* StorageN11Model::createStorage(const std::string& id, const std::string& type_id,
+ const std::string& content_name, const std::string& attach)
{
StorageType* storage_type = storage_types.at(type_id);
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 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));
+ return new StorageN11(this, id, get_maxmin_system(), Bread, Bwrite, type_id, content_name, storage_type->size,
+ attach);
}
double StorageN11Model::next_occuring_event(double now)
* Resource *
************/
-StorageN11::StorageN11(StorageModel* model, std::string name, kernel::lmm::System* maxminSystem, double bread,
- double bwrite, std::string type_id, std::string content_name, sg_size_t size, std::string attach)
+StorageN11::StorageN11(StorageModel* model, const std::string& name, kernel::lmm::System* maxminSystem, double bread,
+ double bwrite, const std::string& type_id, const std::string& content_name, sg_size_t size,
+ const std::string& attach)
: StorageImpl(model, name, maxminSystem, bread, bwrite, type_id, content_name, size, attach)
{
XBT_DEBUG("Create resource with Bread '%f' Bwrite '%f' and Size '%llu'", bread, bwrite, size);
class StorageN11Model : public StorageModel {
public:
StorageN11Model();
- StorageImpl* createStorage(std::string id, std::string type_id, std::string content_name,
- std::string attach) override;
+ StorageImpl* createStorage(const std::string& id, const std::string& type_id, const std::string& content_name,
+ const std::string& attach) override;
double next_occuring_event(double now) override;
void update_actions_state(double now, double delta) override;
};
class StorageN11 : public StorageImpl {
public:
- StorageN11(StorageModel* model, std::string name, kernel::lmm::System* maxminSystem, double bread, double bwrite,
- std::string type_id, std::string content_name, sg_size_t size, std::string attach);
+ StorageN11(StorageModel* model, const std::string& name, kernel::lmm::System* maxminSystem, double bread,
+ double bwrite, const std::string& type_id, const std::string& content_name, sg_size_t size,
+ const std::string& attach);
virtual ~StorageN11() = default;
StorageAction* io_start(sg_size_t size, s4u::Io::OpType type);
StorageAction* read(sg_size_t size);
XBT_PUBLIC void sg_platf_new_peer(simgrid::kernel::routing::PeerCreationArgs* peer); // Add a peer to the current Zone
XBT_PUBLIC void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* clust); // Add a cluster to the current Zone
XBT_PUBLIC void sg_platf_new_cabinet(simgrid::kernel::routing::CabinetCreationArgs* cabinet); // Add a cabinet to the current Zone
-XBT_PUBLIC simgrid::kernel::routing::NetPoint* // Add a router to the current Zone
- sg_platf_new_router(std::string, const char* coords);
+XBT_PUBLIC simgrid::kernel::routing::NetPoint* // Add a router to the current Zone
+ sg_platf_new_router(const std::string&, const char* coords);
XBT_PUBLIC void sg_platf_new_route(simgrid::kernel::routing::RouteCreationArgs* route); // Add a route
XBT_PUBLIC void sg_platf_new_bypassRoute(simgrid::kernel::routing::RouteCreationArgs* bypassroute); // Add a bypassRoute
/* Callback */
xbt_cfg_cb_t old_callback = nullptr;
- ConfigurationElement(std::string key, std::string desc) : key(std::move(key)), desc(std::move(desc)) {}
- ConfigurationElement(std::string key, std::string desc, xbt_cfg_cb_t cb)
- : key(std::move(key)), desc(std::move(desc)), old_callback(cb)
+ ConfigurationElement(const std::string& key, const std::string& desc) : key(key), desc(desc) {}
+ ConfigurationElement(const std::string& key, const std::string& desc, xbt_cfg_cb_t cb)
+ : key(key), desc(desc), old_callback(cb)
{
}
std::function<void(T&)> callback;
public:
- TypedConfigurationElement(std::string key, std::string desc, T value = T())
- : ConfigurationElement(std::move(key), std::move(desc)), content(std::move(value))
+ TypedConfigurationElement(const std::string& key, const std::string& desc, T value = T())
+ : ConfigurationElement(key, desc), content(std::move(value))
{}
- TypedConfigurationElement(std::string key, std::string desc, T value, xbt_cfg_cb_t cb)
- : ConfigurationElement(std::move(key), std::move(desc), cb), content(std::move(value))
+ TypedConfigurationElement(const std::string& key, const std::string& desc, T value, xbt_cfg_cb_t cb)
+ : ConfigurationElement(key, desc, cb), content(std::move(value))
{}
- TypedConfigurationElement(std::string key, std::string desc, T value, std::function<void(T&)> callback)
- : ConfigurationElement(std::move(key), std::move(desc)), content(std::move(value)), callback(std::move(callback))
+ TypedConfigurationElement(const std::string& key, const std::string& desc, T value, std::function<void(T&)> callback)
+ : ConfigurationElement(key, desc), content(std::move(value)), callback(std::move(callback))
{}
~TypedConfigurationElement() = default;
(*simgrid_config)[name].set_string_value(value.c_str());
}
-void set_parse(std::string options)
+void set_parse(const std::string& opt)
{
+ std::string options(opt);
XBT_DEBUG("List to parse and set:'%s'", options.c_str());
while (not options.empty()) {
XBT_DEBUG("Still to parse and set: '%s'", options.c_str());
// ***** declare_flag *****
template <class T>
-XBT_PUBLIC void declare_flag(const std::string& name, std::string description, T value,
+XBT_PUBLIC void declare_flag(const std::string& name, const std::string& description, T value,
std::function<void(const T&)> callback)
{
if (simgrid_config == nullptr)
simgrid_config = new simgrid::config::Config();
- simgrid_config->register_option<T>(name, std::move(description), std::move(value), std::move(callback));
+ simgrid_config->register_option<T>(name, description, std::move(value), std::move(callback));
}
-template XBT_PUBLIC void declare_flag(const std::string& name, std::string description, int value,
+template XBT_PUBLIC void declare_flag(const std::string& name, const std::string& description, int value,
std::function<void(int const&)> callback);
-template XBT_PUBLIC void declare_flag(const std::string& name, std::string description, double value,
+template XBT_PUBLIC void declare_flag(const std::string& name, const std::string& description, double value,
std::function<void(double const&)> callback);
-template XBT_PUBLIC void declare_flag(const std::string& name, std::string description, bool value,
+template XBT_PUBLIC void declare_flag(const std::string& name, const std::string& description, bool value,
std::function<void(bool const&)> callback);
-template XBT_PUBLIC void declare_flag(const std::string& name, std::string description, std::string value,
+template XBT_PUBLIC void declare_flag(const std::string& name, const std::string& description, std::string value,
std::function<void(std::string const&)> callback);
void finalize()
return 0;
}
-static void run_test_process(std::string name, simgrid::s4u::Host *location, int size)
+static void run_test_process(const std::string& name, simgrid::s4u::Host* location, int size)
{
std::vector<std::string> arg = {std::to_string(size)};
simgrid::s4u::Actor::create(std::move(name), location, computation_fun, arg);