/* this host also tests the properties of the AS*/
simgrid::s4u::NetZone* root = simgrid::s4u::Engine::get_instance()->get_netzone_root();
XBT_INFO("== Print the properties of the zone");
- XBT_INFO(" Zone property: filename -> %s", root->getProperty("filename"));
- XBT_INFO(" Zone property: date -> %s", root->getProperty("date"));
- XBT_INFO(" Zone property: author -> %s", root->getProperty("author"));
+ XBT_INFO(" Zone property: filename -> %s", root->get_property("filename"));
+ XBT_INFO(" Zone property: date -> %s", root->get_property("date"));
+ XBT_INFO(" Zone property: author -> %s", root->get_property("author"));
/* Get the property list of current bob process */
std::map<std::string, std::string>* props = simgrid::s4u::Actor::self()->get_properties();
void getHosts(std::vector<s4u::Host*> * whereto); // retrieve my content as a vector of hosts
int getHostCount();
+private:
+ std::unordered_map<std::string, std::string> properties_;
+
+public:
/** Get the properties assigned to a host */
std::unordered_map<std::string, std::string>* getProperties();
/** Retrieve the property value (or nullptr if not set) */
- const char* getProperty(const char* key);
- void setProperty(const char* key, const char* value);
+ const char* get_property(const char* key);
+ void set_property(const char* key, const char* value);
/* Add content to the netzone, at parsing time. It should be sealed afterward. */
virtual int addComponent(kernel::routing::NetPoint * elm); /* A host, a router or a netzone, whatever */
{
add_bypass_route(src, dst, gw_src, gw_dst, link_list, symmetrical);
}
-
-protected:
- unsigned int getTableSize() { return vertices_.size(); }
- std::vector<kernel::routing::NetPoint*> getVertices() { return vertices_; }
+ XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::get_property()") const char* getProperty(const char* key)
+ {
+ return get_property(key);
+ }
+ XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::set_property()") void setProperty(const char* key, const char* value)
+ {
+ set_property(key, value);
+ }
private:
// our content, as known to our graph routing algorithm (maps vertexId -> vertex)
std::vector<kernel::routing::NetPoint*> vertices_;
- std::unordered_map<std::string, std::string> properties_;
+protected:
+ unsigned int get_table_size() { return vertices_.size(); }
+ std::vector<kernel::routing::NetPoint*> getVertices() { return vertices_; }
+
+private:
NetZone* father_ = nullptr;
std::string name_;
{
if (link_table_ == nullptr) // Dealing with a parse error in the file?
return;
- unsigned int table_size = getTableSize();
+ unsigned int table_size = get_table_size();
/* Delete link_table */
for (unsigned int i = 0; i < table_size; i++)
for (unsigned int j = 0; j < table_size; j++)
void FloydZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
{
- unsigned int table_size = getTableSize();
+ unsigned int table_size = get_table_size();
getRouteCheckParams(src, dst);
std::vector<resource::LinkImpl*>& link_list, bool symmetrical)
{
/* set the size of table routing */
- unsigned int table_size = getTableSize();
+ unsigned int table_size = get_table_size();
addRouteCheckParams(src, dst, gw_src, gw_dst, link_list, symmetrical);
void FloydZone::seal()
{
/* set the size of table routing */
- unsigned int table_size = getTableSize();
+ unsigned int table_size = get_table_size();
if (not link_table_) {
/* Create Cost, Predecessor and Link tables */
void FullZone::seal()
{
- unsigned int table_size = getTableSize();
+ unsigned int table_size = get_table_size();
/* Create table if needed */
if (not routing_table_)
FullZone::~FullZone()
{
if (routing_table_) {
- unsigned int table_size = getTableSize();
+ unsigned int table_size = get_table_size();
/* Delete routing table */
for (unsigned int i = 0; i < table_size; i++)
for (unsigned int j = 0; j < table_size; j++)
{
XBT_DEBUG("full getLocalRoute from %s[%u] to %s[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id());
- unsigned int table_size = getTableSize();
+ unsigned int table_size = get_table_size();
RouteCreationArgs* e_route = TO_ROUTE_FULL(src->id(), dst->id());
if (e_route != nullptr) {
{
addRouteCheckParams(src, dst, gw_src, gw_dst, link_list, symmetrical);
- unsigned int table_size = getTableSize();
+ unsigned int table_size = get_table_size();
if (not routing_table_)
routing_table_ = new RouteCreationArgs*[table_size * table_size]();
}
/** Retrieve the property value (or nullptr if not set) */
-const char* NetZone::getProperty(const char* key)
+const char* NetZone::get_property(const char* key)
{
return properties_.at(key).c_str();
}
-void NetZone::setProperty(const char* key, const char* value)
+void NetZone::set_property(const char* key, const char* value)
{
simgrid::simix::simcall([this, key, value] { properties_[key] = value; });
}
const char* sg_zone_get_property_value(sg_netzone_t netzone, const char* name)
{
- return netzone->getProperty(name);
+ return netzone->get_property(name);
}
void sg_zone_set_property_value(sg_netzone_t netzone, const char* name, char* value)
{
- netzone->setProperty(name, value);
+ netzone->set_property(name, value);
}
void sg_zone_get_hosts(sg_netzone_t netzone, xbt_dynar_t whereto)
XBT_DEBUG("Set zone property %s -> %s", A_surfxml_prop_id, A_surfxml_prop_value);
simgrid::s4u::NetZone* netzone = simgrid::s4u::Engine::get_instance()->netzone_by_name_or_null(A_surfxml_zone_id);
- netzone->setProperty(A_surfxml_prop_id, A_surfxml_prop_value);
+ netzone->set_property(A_surfxml_prop_id, A_surfxml_prop_value);
} else {
if (not current_property_set)
current_property_set = new std::map<std::string, std::string>; // Maybe, it should raise an error