/************
* Resource *
************/
-NetworkCm02Link::NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_dict_t props,
- double bandwidth, double latency, e_surf_link_sharing_policy_t policy,
- lmm_system_t system)
-: Link(model, name, props, lmm_constraint_new(system, this, sg_bandwidth_factor * bandwidth))
+NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const char* name, xbt_dict_t props, double bandwidth,
+ double latency, e_surf_link_sharing_policy_t policy, lmm_system_t system)
+ : Link(model, name, lmm_constraint_new(system, this, sg_bandwidth_factor * bandwidth), props)
{
bandwidth_.scale = 1.0;
bandwidth_.peak = bandwidth;
* Resource *
************/
- Link::Link(simgrid::surf::NetworkModel *model, const char *name, xbt_dict_t props)
- : Resource(model, name),
- PropertyHolder(props)
- {
- links->insert({name, this});
-
- latency_.scale = 1;
- bandwidth_.scale = 1;
- XBT_DEBUG("Create link '%s'",name);
- }
-
- Link::Link(simgrid::surf::NetworkModel *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint)
- : Resource(model, name, constraint),
- PropertyHolder(props)
+ Link::Link(simgrid::surf::NetworkModel* model, const char* name, lmm_constraint_t constraint, xbt_dict_t props)
+ : Resource(model, name, constraint), PropertyHolder(props)
{
if (strcmp(name,"__loopback__"))
xbt_assert(!Link::byName(name), "Link '%s' declared several times in the platform.", name);
public simgrid::surf::PropertyHolder {
public:
- /** @brief Constructor of non-LMM links */
- Link(simgrid::surf::NetworkModel *model, const char *name, xbt_dict_t props);
/** @brief Constructor of LMM links */
- Link(simgrid::surf::NetworkModel *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint);
+ Link(simgrid::surf::NetworkModel* model, const char* name, lmm_constraint_t constraint, xbt_dict_t props);
- /* Link destruction logic */
- /**************************/
+ /* Link destruction logic */
+ /**************************/
protected:
~Link() override;
public:
* Resource *
************/
-LinkNS3::LinkNS3(NetworkNS3Model *model, const char *name, xbt_dict_t props, double bandwidth, double latency)
- : Link(model, name, props)
+LinkNS3::LinkNS3(NetworkNS3Model* model, const char* name, xbt_dict_t props, double bandwidth, double latency)
+ : Link(model, name, nullptr, props)
{
bandwidth_.peak = bandwidth;
latency_.peak = latency;
* Resource *
************/
-CpuL07::CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core)
- : Cpu(model, host, speedPerPstate, core)
+CpuL07::CpuL07(CpuL07Model* model, simgrid::s4u::Host* host, std::vector<double>* speedPerPstate, int core)
+ : Cpu(model, host, lmm_constraint_new(model->getMaxminSystem(), this, speedPerPstate->front()), speedPerPstate,
+ core)
{
- constraint_ = lmm_constraint_new(model->getMaxminSystem(), this, speedPerPstate->front());
}
CpuL07::~CpuL07()=default;
-LinkL07::LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props, double bandwidth, double latency,
- e_surf_link_sharing_policy_t policy)
- : Link(model, name, props, lmm_constraint_new(model->getMaxminSystem(), this, bandwidth))
+LinkL07::LinkL07(NetworkL07Model* model, const char* name, xbt_dict_t props, double bandwidth, double latency,
+ e_surf_link_sharing_policy_t policy)
+ : Link(model, name, lmm_constraint_new(model->getMaxminSystem(), this, bandwidth), props)
{
bandwidth_.peak = bandwidth;
latency_.peak = latency;
* Resource *
************/
-Storage::Storage(Model *model, const char *name, xbt_dict_t props,
- const char* type_id, const char *content_name, const char *content_type,
- sg_size_t size)
- : Resource(model, name)
- , PropertyHolder(props)
- , contentType_(xbt_strdup(content_type))
- , size_(size), usedSize_(0)
- , typeId_(xbt_strdup(type_id))
- , writeActions_(std::vector<StorageAction*>())
-{
- content_ = parseContent(content_name);
- turnOn();
-}
-
Storage::Storage(Model *model, const char *name, xbt_dict_t props,
lmm_system_t maxminSystem, double bread, double bwrite,
double bconnection, const char* type_id, const char *content_name,
class Storage : public simgrid::surf::Resource,
public simgrid::surf::PropertyHolder {
public:
- /**
- * @brief Storage constructor
- *
- * @param model StorageModel associated to this Storage
- * @param name The name of the Storage
- * @param props Dictionary of properties associated to this Storage
- * @param type_id [description]
- * @param content_name [description]
- * @param content_type [description]
- * @param size [description]
- */
- Storage(Model *model, const char *name, xbt_dict_t props,
- const char* type_id, const char *content_name, const char *content_type,
- sg_size_t size);
/**
* @brief Storage constructor
namespace simgrid {
namespace surf {
-Resource::Resource(Model *model, const char *name)
- : name_(xbt_strdup(name))
- , model_(model)
-{}
-
Resource::Resource(Model *model, const char *name, lmm_constraint_t constraint)
: name_(xbt_strdup(name))
, model_(model)
{}
Resource::~Resource() {
- xbt_free((void*)name_);
+ free(name_);
}
bool Resource::isOn() const {
*/
XBT_PUBLIC_CLASS Resource {
public:
- /**
- * @brief Constructor of non-LMM Resources
- *
- * @param model Model associated to this Resource
- * @param name The name of the Resource
- */
- Resource(Model *model, const char *name);
-
/**
* @brief Constructor of LMM Resources
*
virtual void turnOff();
private:
- const char *name_;
+ char* name_;
Model *model_;
bool isOn_ = true;
/** @brief Get the lmm constraint associated to this Resource if it is part of a LMM component (or null if none) */
lmm_constraint_t getConstraint() const;
protected:
- lmm_constraint_t constraint_ = nullptr;
+ const lmm_constraint_t constraint_ = nullptr;
};
}
class DummyTestResource
: public simgrid::surf::Resource {
public:
- explicit DummyTestResource(const char *name) : Resource(nullptr,name) {}
+ explicit DummyTestResource(const char* name) : Resource(nullptr, name, nullptr) {}
bool isUsed() override {return false;}
void apply_event(tmgr_trace_iterator_t it, double value) override {}
};