#include <vector>
#include <xbt/base.h>
-#include <xbt/Facetable.hpp>
#include <xbt/string.hpp>
+#include <xbt/Extendable.hpp>
namespace simgrid {
-XBT_PUBLIC_CLASS Host : public simgrid::xbt::Facetable<Host> {
+XBT_PUBLIC_CLASS Host : public simgrid::xbt::Extendable<Host> {
private:
simgrid::xbt::string id_;
public:
SG_BEGIN_DECL()
XBT_PUBLIC(size_t) sg_host_count();
-XBT_PUBLIC(size_t) sg_host_add_level(void(*deleter)(void*));
+XBT_PUBLIC(size_t) sg_host_extension_create(void(*deleter)(void*));
+XBT_PUBLIC(void*) sg_host_extension_get(sg_host_t host, size_t rank);
XBT_PUBLIC(sg_host_t) sg_host_by_name(const char *name);
XBT_PUBLIC(sg_host_t) sg_host_by_name_or_create(const char *name);
-XBT_PUBLIC(void*) sg_host_get_facet(sg_host_t host, size_t facet);
XBT_PUBLIC(const char*) sg_host_get_name(sg_host_t host);
XBT_PUBLIC(xbt_dynar_t) sg_hosts_as_dynar(void);
--- /dev/null
+/* Copyright (c) 2015. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef SIMGRID_XBT_LIB_HPP
+#define SIMGRID_XBT_LIB_HPP
+
+#include <cstddef>
+#include <limits>
+#include <vector>
+
+namespace simgrid {
+namespace xbt {
+
+template<class T, class U> class Extension;
+template<class T> class Extendable;
+
+template<class T, class U>
+class Extension {
+ static const std::size_t INVALID_ID = std::numeric_limits<std::size_t>::max();
+ std::size_t id_;
+ friend class Extendable<T>;
+ constexpr Extension(std::size_t id) : id_(id) {}
+public:
+ constexpr Extension() : id_(INVALID_ID) {}
+ std::size_t id() const { return id_; }
+ bool valid() { return id_ != INVALID_ID; }
+};
+
+/** An Extendable is an object that you can extend with external elements.
+ *
+ * An Extension is one dimension of such extension. They are similar to the concept of mixins, that is, a set of behavior that is injected into a class without derivation.
+ *
+ * Imagine that you want to write a plugin dealing with the energy in SimGrid.
+ * You will have to store some information about each and every host.
+ *
+ * You could modify the Host class directly (but your code will soon become messy).
+ * You could create a class EnergyHost deriving Host, but it is not easily combinable
+ * with a notion of Host extended with another concept (such as mobility).
+ * You could completely externalize these data with an associative map Host->EnergyHost.
+ * It would work, provided that you implement this classical feature correctly (and it would induce a little performance penalty).
+ * Instead, you should add a new facet to the Host class, that happens to be Facetable.
+ *
+ */
+template<class T>
+class Extendable {
+private:
+ static std::vector<void(*)(void*)> deleters_;
+protected:
+ std::vector<void*> extensions_;
+public:
+ static size_t extension_create(void (*deleter)(void*))
+ {
+ std::size_t res = deleters_.size();
+ deleters_.push_back(deleter);
+ return res;
+ }
+ template<class U>
+ static Extension<T,U> extension_create(void (*deleter)(void*))
+ {
+ return Extension<T,U>(extension_create(deleter));
+ }
+ template<class U> static
+ Extension<T,U> extension_create()
+ {
+ return extension_create([](void* p){ delete static_cast<U*>(p); });
+ }
+ Extendable() : extensions_(deleters_.size(), nullptr) {}
+ ~Extendable()
+ {
+ /* Call destructors in reverse order of their registrations
+ *
+ * The rationale for this, is that if an extension B as been added after
+ * an extension A, the subsystem of B might depend on the subsystem on A and
+ * an extension of B might need to have the extension of A around when executing
+ * its cleanup function/destructor. */
+ for (std::size_t i = extensions_.size(); i > 0; --i)
+ if (extensions_[i - 1] != nullptr)
+ deleters_[i - 1](extensions_[i - 1]);
+ }
+
+ // Type-unsafe versions of the facet access methods:
+ void* extension(std::size_t rank)
+ {
+ if (rank >= extensions_.size())
+ return nullptr;
+ else
+ return extensions_.at(rank);
+ }
+ void extension_set(std::size_t rank, void* value, bool use_dtor = true)
+ {
+ if (rank >= extensions_.size())
+ extensions_.resize(rank + 1, nullptr);
+ void* old_value = this->extension(rank);
+ extensions_.at(rank) = value;
+ if (use_dtor && old_value != nullptr && deleters_[rank])
+ deleters_[rank](old_value);
+ }
+
+ // Type safe versions of the facet access methods:
+ template<class U>
+ U* extension(Extension<T,U> rank)
+ {
+ return static_cast<U*>(extension(rank.id()));
+ }
+ template<class U>
+ void extension_set(Extension<T,U> rank, U* value, bool use_dtor = true)
+ {
+ extension_set(rank.id(), value, use_dtor);
+ }
+
+ // Convenience extension access when the type has a associated EXTENSION ID:
+ template<class U> U* extension() { return extension<U>(U::EXTENSION_ID); }
+ template<class U> void extension_set(U* p) { extension_set<U>(U::EXTENSION_ID, p); }
+};
+
+template<class T>
+std::vector<void(*)(void*)> Extendable<T>::deleters_ = {};
+
+}
+}
+
+#endif
+++ /dev/null
-/* Copyright (c) 2015. The SimGrid Team.
- * All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#ifndef SIMGRID_XBT_LIB_HPP
-#define SIMGRID_XBT_LIB_HPP
-
-#include <cstddef>
-#include <limits>
-#include <vector>
-
-namespace simgrid {
-namespace xbt {
-
-template<class T, class U> class FacetLevel;
-template<class T> class Facetable;
-
-template<class T, class U>
-class FacetLevel {
- static const std::size_t INVALID_ID = std::numeric_limits<std::size_t>::max();
- std::size_t id_;
- friend class Facetable<T>;
- constexpr FacetLevel(std::size_t id) : id_(id) {}
-public:
- constexpr FacetLevel() : id_(INVALID_ID) {}
- std::size_t id() const { return id_; }
- bool valid() { return id_ != INVALID_ID; }
-};
-
-/** A Facetable is an object that you can extend with external facets.
- *
- * Facets are similar to the concept of mixins, that is, a set of behavior that is injected into a class without derivation.
- *
- * Imagine that you want to write a plugin dealing with the energy in SimGrid.
- * You will have to store some information about each and every host.
- *
- * You could modify the Host class directly (but your code will soon become messy).
- * You could create a class EnergyHost deriving Host, but it is not easily combinable
- * with a notion of Host extended with another concept (such as mobility).
- * You could completely externalize these data with an associative map Host->EnergyHost.
- * It would work, provided that you implement this classical feature correctly (and it would induce a little performance penalty).
- * Instead, you should add a new facet to the Host class, that happens to be Facetable.
- *
- */
-template<class T>
-class Facetable {
-private:
- static std::vector<void(*)(void*)> deleters_;
-protected:
- std::vector<void*> facets_;
-public:
- static size_t add_level(void (*deleter)(void*))
- {
- std::size_t res = deleters_.size();
- deleters_.push_back(deleter);
- return res;
- }
- template<class U>
- static FacetLevel<T,U> add_level(void (*deleter)(void*))
- {
- return FacetLevel<T,U>(add_level(deleter));
- }
- template<class U> static
- FacetLevel<T,U> add_level()
- {
- return add_level([](void* p){ delete static_cast<U*>(p); });
- }
- Facetable() : facets_(deleters_.size(), nullptr) {}
- ~Facetable()
- {
- /* Call destructors in reverse order of their registrations
- *
- * The rationale for this, is that if a level B as been added after a
- * facet A, the subsystem of B might depend on the subsystem on A and a
- * facet of B might need to have the facet of A around when executing
- * its cleanup function/destructor. */
- for (std::size_t i = facets_.size(); i > 0; --i)
- if (facets_[i - 1] != nullptr)
- deleters_[i - 1](facets_[i - 1]);
- }
-
- // Type-unsafe versions of the facet access methods:
- void* facet(std::size_t level)
- {
- if (level >= facets_.size())
- return nullptr;
- else
- return facets_.at(level);
- }
- void set_facet(std::size_t level, void* value, bool use_dtor = true)
- {
- if (level >= facets_.size())
- facets_.resize(level + 1, nullptr);
- void* old_value = this->facet(level);
- facets_.at(level) = value;
- if (use_dtor && old_value != nullptr && deleters_[level])
- deleters_[level](old_value);
- }
-
- // Type safe versions of the facet access methods:
- template<class U>
- U* facet(FacetLevel<T,U> level)
- {
- return static_cast<U*>(facet(level.id()));
- }
- template<class U>
- void set_facet(FacetLevel<T,U> level, U* value, bool use_dtor = true)
- {
- set_facet(level.id(), value, use_dtor);
- }
-
- // Convnience facet access when the type has a associated LEVEL:
- template<class U> U* facet() { return facet<U>(U::LEVEL); }
- template<class U> void set_facet(U* p) { set_facet<U>(U::LEVEL, p); }
-};
-
-template<class T>
-std::vector<void(*)(void*)> Facetable<T>::deleters_ = {};
-
-}
-}
-
-#endif
MSG_init(&argc, argv);
- JAVA_HOST_LEVEL = simgrid::Host::add_level(__JAVA_host_priv_free);
+ JAVA_HOST_LEVEL = simgrid::Host::extension_create(__JAVA_host_priv_free);
JAVA_STORAGE_LEVEL = xbt_lib_add_level(storage_lib, __JAVA_storage_priv_free);
for (index = 0; index < argc; index++)
xbt_dynar_t hosts = MSG_hosts_as_dynar();
for (unsigned long index = 0; index < xbt_dynar_length(hosts) - 1; index++) {
msg_host_t msg_host = xbt_dynar_get_as(hosts,index,msg_host_t);
- jobject jhost = (jobject) msg_host->facet(JAVA_HOST_LEVEL);
+ jobject jhost = (jobject) msg_host->extension(JAVA_HOST_LEVEL);
if (jhost)
jhost_unref(env, jhost);
host = xbt_dynar_get_as(table,index,msg_host_t);
- jhost = (jobject) host->facet(JAVA_HOST_LEVEL);
+ jhost = (jobject) host->extension(JAVA_HOST_LEVEL);
if (!jhost) {
jname = env->NewStringUTF(MSG_host_get_name(host));
}
env->ReleaseStringUTFChars(jname, name);
- if (!host->facet(JAVA_HOST_LEVEL)) { /* native host not associated yet with java host */
+ if (!host->extension(JAVA_HOST_LEVEL)) { /* native host not associated yet with java host */
/* Instantiate a new java host */
jhost = jhost_new_instance(env);
/* the native host data field is set with the global reference to the
* java host returned by this function
*/
- host->set_facet(JAVA_HOST_LEVEL, (void *)jhost);
+ host->extension_set(JAVA_HOST_LEVEL, (void *)jhost);
}
/* return the global reference to the java host instance */
- return (jobject) host->facet(JAVA_HOST_LEVEL);
+ return (jobject) host->extension(JAVA_HOST_LEVEL);
}
JNIEXPORT jobject JNICALL
msg_host_t host = MSG_host_self();
- if (!host->facet(JAVA_HOST_LEVEL)) {
+ if (!host->extension(JAVA_HOST_LEVEL)) {
/* the native host not yet associated with the java host instance */
/* instanciate a new java host instance */
env->SetObjectField(jhost, jhost_field_Host_name, jname);
/* Bind & store it */
jhost_bind(jhost, host, env);
- host->set_facet(JAVA_HOST_LEVEL, (void *) jhost);
+ host->extension_set(JAVA_HOST_LEVEL, (void *) jhost);
} else {
- jhost = (jobject) host->facet(JAVA_HOST_LEVEL);
+ jhost = (jobject) host->extension(JAVA_HOST_LEVEL);
}
return jhost;
for (index = 0; index < count; index++) {
host = xbt_dynar_get_as(table,index,msg_host_t);
- jhost = (jobject) host->facet(JAVA_HOST_LEVEL);
+ jhost = (jobject) host->extension(JAVA_HOST_LEVEL);
if (!jhost) {
jname = env->NewStringUTF(MSG_host_get_name(host));
if (host == NULL) {
return NULL;
}
- if (!host->facet(JAVA_HOST_LEVEL)) {
+ if (!host->extension(JAVA_HOST_LEVEL)) {
jxbt_throw_jni(env, "MSG_task_get_source() failed");
return NULL;
}
- return (jobject) host->facet(JAVA_HOST_LEVEL);
+ return (jobject) host->extension(JAVA_HOST_LEVEL);
}
JNIEXPORT jdouble JNICALL
msg_vm_t vm = jvm_get_native(env,jvm);
msg_host_t host = MSG_vm_get_pm(vm);
- if (!host->facet(JAVA_HOST_LEVEL)) {
+ if (!host->extension(JAVA_HOST_LEVEL)) {
/* the native host not yet associated with the java host instance */
/* instanciate a new java host instance */
jname);
/* Bind & store it */
jhost_bind(jhost, host, env);
- host->set_facet(JAVA_HOST_LEVEL, (void *) jhost);
+ host->extension_set(JAVA_HOST_LEVEL, (void *) jhost);
} else {
- jhost = (jobject) host->facet(JAVA_HOST_LEVEL);
+ jhost = (jobject) host->extension(JAVA_HOST_LEVEL);
}
return jhost;
static inline surf_host_t surf_host_resource_priv(sg_host_t host)
{
- return (surf_host_t) sg_host_get_facet(host, SURF_HOST_LEVEL);
+ return (surf_host_t) sg_host_extension_get(host, SURF_HOST_LEVEL);
}
static inline void *surf_storage_resource_priv(const void *storage){
return (void*)xbt_lib_get_level((xbt_dictelm_t)storage, SURF_STORAGE_LEVEL);
return xbt_dict_length(host_list);
}
-void* sg_host_get_facet(sg_host_t host, size_t facet)
+const char *sg_host_get_name(sg_host_t host)
{
- return host->facet(facet);
+ return host->id().c_str();
}
-const char *sg_host_get_name(sg_host_t host)
+void* sg_host_extension_get(sg_host_t host, size_t ext)
{
- return host->id().c_str();
+ return host->extension(ext);
}
-size_t sg_host_add_level(void(*deleter)(void*))
+size_t sg_host_extension_create(void(*deleter)(void*))
{
- return simgrid::Host::add_level(deleter);
+ return simgrid::Host::extension_create(deleter);
}
sg_host_t sg_host_by_name(const char *name)
void sg_host_init()
{
- MSG_HOST_LEVEL = simgrid::Host::add_level([](void *p) {
+ MSG_HOST_LEVEL = simgrid::Host::extension_create([](void *p) {
__MSG_host_priv_free((msg_host_priv_t) p);
});
- SD_HOST_LEVEL = simgrid::Host::add_level(__SD_workstation_destroy);
- SIMIX_HOST_LEVEL = simgrid::Host::add_level(SIMIX_host_destroy);
+ SD_HOST_LEVEL = simgrid::Host::extension_create(__SD_workstation_destroy);
+ SIMIX_HOST_LEVEL = simgrid::Host::extension_create(SIMIX_host_destroy);
simgrid::surf::Cpu::init();
- ROUTING_HOST_LEVEL = simgrid::Host::add_level(routing_asr_host_free);
- USER_HOST_LEVEL = simgrid::Host::add_level(NULL);
+ ROUTING_HOST_LEVEL = simgrid::Host::extension_create(routing_asr_host_free);
+ USER_HOST_LEVEL = simgrid::Host::extension_create(NULL);
}
// ========== User data Layer ==========
void *sg_host_user(sg_host_t host) {
- return host->facet(USER_HOST_LEVEL);
+ return host->extension(USER_HOST_LEVEL);
}
void sg_host_user_set(sg_host_t host, void* userdata) {
- host->set_facet(USER_HOST_LEVEL,userdata);
+ host->extension_set(USER_HOST_LEVEL,userdata);
}
void sg_host_user_destroy(sg_host_t host) {
- host->set_facet(USER_HOST_LEVEL, nullptr);
+ host->extension_set(USER_HOST_LEVEL, nullptr);
}
// ========== MSG Layer ==============
msg_host_priv_t sg_host_msg(sg_host_t host) {
- return (msg_host_priv_t) host->facet(MSG_HOST_LEVEL);
+ return (msg_host_priv_t) host->extension(MSG_HOST_LEVEL);
}
void sg_host_msg_set(sg_host_t host, msg_host_priv_t smx_host) {
- host->set_facet(MSG_HOST_LEVEL, smx_host);
+ host->extension_set(MSG_HOST_LEVEL, smx_host);
}
void sg_host_msg_destroy(sg_host_t host) {
- host->set_facet(MSG_HOST_LEVEL, nullptr);
+ host->extension_set(MSG_HOST_LEVEL, nullptr);
}
// ========== SimDag Layer ==============
SD_workstation_priv_t sg_host_sd(sg_host_t host) {
- return (SD_workstation_priv_t) host->facet(SD_HOST_LEVEL);
+ return (SD_workstation_priv_t) host->extension(SD_HOST_LEVEL);
}
void sg_host_sd_set(sg_host_t host, SD_workstation_priv_t smx_host) {
- host->set_facet(SD_HOST_LEVEL, smx_host);
+ host->extension_set(SD_HOST_LEVEL, smx_host);
}
void sg_host_sd_destroy(sg_host_t host) {
- host->set_facet(SD_HOST_LEVEL, nullptr);
+ host->extension_set(SD_HOST_LEVEL, nullptr);
}
// ========== Simix layer =============
smx_host_priv_t sg_host_simix(sg_host_t host){
- return (smx_host_priv_t) host->facet(SIMIX_HOST_LEVEL);
+ return (smx_host_priv_t) host->extension(SIMIX_HOST_LEVEL);
}
void sg_host_simix_set(sg_host_t host, smx_host_priv_t smx_host) {
- host->set_facet(SIMIX_HOST_LEVEL, smx_host);
+ host->extension_set(SIMIX_HOST_LEVEL, smx_host);
}
void sg_host_simix_destroy(sg_host_t host) {
- host->set_facet(SIMIX_HOST_LEVEL, nullptr);
+ host->extension_set(SIMIX_HOST_LEVEL, nullptr);
}
// ========== SURF CPU ============
surf_cpu_t sg_host_surfcpu(sg_host_t host) {
- return host->facet<simgrid::surf::Cpu>();
+ return host->extension<simgrid::surf::Cpu>();
}
void sg_host_surfcpu_set(sg_host_t host, surf_cpu_t cpu) {
- host->set_facet(simgrid::surf::Cpu::LEVEL, cpu);
+ host->extension_set(simgrid::surf::Cpu::EXTENSION_ID, cpu); // FIXME: use the typesafe version
}
void sg_host_surfcpu_destroy(sg_host_t host) {
- host->set_facet<simgrid::surf::Cpu>(nullptr);
+ host->extension_set<simgrid::surf::Cpu>(nullptr);
}
// ========== RoutingEdge ============
surf_RoutingEdge *sg_host_edge(sg_host_t host) {
- return (surf_RoutingEdge*) host->facet(ROUTING_HOST_LEVEL);
+ return (surf_RoutingEdge*) host->extension(ROUTING_HOST_LEVEL);
}
void sg_host_edge_set(sg_host_t host, surf_RoutingEdge *edge) {
- host->set_facet(ROUTING_HOST_LEVEL, edge);
+ host->extension_set(ROUTING_HOST_LEVEL, edge);
}
void sg_host_edge_destroy(sg_host_t host, int do_callback) {
- host->set_facet(ROUTING_HOST_LEVEL, nullptr, do_callback);
+ host->extension_set(ROUTING_HOST_LEVEL, nullptr, do_callback);
}
// =========== user-level functions ===============
int val = xbt_cfg_get_boolean(_sg_cfg_set, name);
if (val) {
if (!already_set) {
- COORD_HOST_LEVEL = sg_host_add_level(xbt_dynar_free_voidp);
+ COORD_HOST_LEVEL = sg_host_extension_create(xbt_dynar_free_voidp);
COORD_ASR_LEVEL = xbt_lib_add_level(as_router_lib,xbt_dynar_free_voidp);
}
already_set = 1;
namespace simgrid {
namespace surf {
-simgrid::xbt::FacetLevel<simgrid::Host, Cpu> Cpu::LEVEL;
+simgrid::xbt::Extension<simgrid::Host, Cpu> Cpu::EXTENSION_ID;
void Cpu::init()
{
- if (!LEVEL.valid())
- LEVEL = simgrid::Host::add_level<simgrid::surf::Cpu>();
+ if (!EXTENSION_ID.valid())
+ EXTENSION_ID = simgrid::Host::extension_create<simgrid::surf::Cpu>();
}
/*************
void Cpu::plug(simgrid::Host* host)
{
if (this->m_host != nullptr)
- xbt_die("Aleady plugged into host %s", host->id().c_str());
- host->set_facet(this);
+ xbt_die("Already plugged into host %s", host->id().c_str());
+ host->extension_set(this);
this->m_host = host;
simgrid::surf::cpuCreatedCallbacks(this);
simgrid::surf::cpuStateChangedCallbacks(this,
*/
XBT_PUBLIC_CLASS Cpu : public simgrid::surf::Resource {
public:
- static simgrid::xbt::FacetLevel<simgrid::Host, Cpu> LEVEL;
+ static simgrid::xbt::Extension<simgrid::Host, Cpu> EXTENSION_ID;
static void init();
Cpu();
namespace simgrid {
namespace surf {
-simgrid::xbt::FacetLevel<simgrid::Host, Host> Host::LEVEL;
+simgrid::xbt::Extension<simgrid::Host, Host> Host::EXTENSION_ID;
simgrid::surf::signal<void(simgrid::surf::Host*)> hostCreatedCallbacks;
simgrid::surf::signal<void(simgrid::surf::Host*)> hostDestructedCallbacks;
void Host::init()
{
- if (!LEVEL.valid()) {
- LEVEL = simgrid::Host::add_level<simgrid::surf::Host>();
- SURF_HOST_LEVEL = LEVEL.id();
+ if (!EXTENSION_ID.valid()) {
+ EXTENSION_ID = simgrid::Host::extension_create<simgrid::surf::Host>();
+ SURF_HOST_LEVEL = EXTENSION_ID.id(); // FIXME: KILLME
}
}
{
if (p_host != nullptr)
xbt_die("Already attached to host %s", host->id().c_str());
- host->set_facet(this);
+ host->extension_set(this);
p_host = host;
hostCreatedCallbacks(this);
}
*/
class Host : public simgrid::surf::Resource, public simgrid::surf::PropertyHolder {
public:
- static simgrid::xbt::FacetLevel<simgrid::Host, Host> LEVEL;
+ static simgrid::xbt::Extension<simgrid::Host, Host> EXTENSION_ID;
static void init();
/**
* @brief Host constructor
if (host == nullptr)
return nullptr;
else
- return (ns3_nodes_t) sg_host_get_facet(host, NS3_HOST_LEVEL);
+ return (ns3_nodes_t) sg_host_get_extension(host, NS3_HOST_LEVEL);
}
SG_END_DECL()
surf_host_model_t surf_host_get_model(sg_host_t host)
{
simgrid::surf::Host* surf_host =
- (simgrid::surf::Host*) host->facet<simgrid::surf::Host>();
+ (simgrid::surf::Host*) host->extension<simgrid::surf::Host>();
return (surf_host_model_t) surf_host->getModel();
}
*/
sg_host_surfcpu_destroy(resource);
sg_host_edge_destroy(resource,1);
- resource->set_facet<simgrid::surf::Host>(nullptr);
+ resource->extension_set<simgrid::surf::Host>(nullptr);
/* TODO: comment out when VM storage is implemented. */
- // host->set_facet(SURF_STORAGE_LEVEL, nullptr);
+ // host->extension_set(SURF_STORAGE_LEVEL, nullptr);
}
void surf_vm_suspend(sg_host_t vm){
}
xbt_dynar_shrink(ctn, 0);
xbt_dynar_free(&ctn_str);
- h->set_facet(COORD_HOST_LEVEL, (void *) ctn);
+ h->extension_set(COORD_HOST_LEVEL, (void *) ctn);
XBT_DEBUG("Having set host coordinates for '%s'",host->id);
}
*lat += static_cast<Link*>(info.link_up)->getLatency();
}
}
- src_ctn = (xbt_dynar_t) simgrid::Host::by_name_or_create(tmp_src_name)->facet(COORD_HOST_LEVEL);
+ src_ctn = (xbt_dynar_t) simgrid::Host::by_name_or_create(tmp_src_name)->extension(COORD_HOST_LEVEL);
if (src_ctn == nullptr)
- src_ctn = (xbt_dynar_t) simgrid::Host::by_name_or_create(src->getName())->facet(COORD_HOST_LEVEL);
+ src_ctn = (xbt_dynar_t) simgrid::Host::by_name_or_create(src->getName())->extension(COORD_HOST_LEVEL);
}
else if(src->getRcType() == SURF_NETWORK_ELEMENT_ROUTER || src->getRcType() == SURF_NETWORK_ELEMENT_AS){
tmp_src_name = ROUTER_PEER(src->getName());
}
}
dst_ctn = (xbt_dynar_t) simgrid::Host::by_name_or_create(tmp_dst_name)
- ->facet(COORD_HOST_LEVEL);
+ ->extension(COORD_HOST_LEVEL);
if (dst_ctn == nullptr)
dst_ctn = (xbt_dynar_t) simgrid::Host::by_name_or_create(dst->getName())
- ->facet(COORD_HOST_LEVEL);
+ ->extension(COORD_HOST_LEVEL);
}
else if(dst->getRcType() == SURF_NETWORK_ELEMENT_ROUTER || dst->getRcType() == SURF_NETWORK_ELEMENT_AS){
tmp_dst_name = ROUTER_PEER(dst->getName());
: Host(model, name, props, NULL, netElm, cpu)
{
VMModel::ws_vms.push_back(*this);
- simgrid::Host::by_name_or_create(name)->set_facet<simgrid::surf::Host>(this);
+ simgrid::Host::by_name_or_create(name)->extension_set<simgrid::surf::Host>(this);
}
/*
include/xbt/hash.h
include/xbt/heap.h
include/xbt/lib.h
- include/xbt/Facetable.hpp
+ include/xbt/Extendable.hpp
include/xbt/log.h
include/xbt/mallocator.h
include/xbt/matrix.h