+ change namespace
+ move files
+ use it for netzones too
13 files changed:
include include/smpi/smpi_main.h
include include/xbt.h
include include/xbt/Extendable.hpp
include include/smpi/smpi_main.h
include include/xbt.h
include include/xbt/Extendable.hpp
+include include/xbt/PropertyHolder.hpp
include include/xbt/asserts.h
include include/xbt/automaton.h
include include/xbt/automaton.hpp
include include/xbt/asserts.h
include include/xbt/automaton.h
include include/xbt/automaton.hpp
include src/smpi/smpitools.sh
include src/surf/HostImpl.cpp
include src/surf/HostImpl.hpp
include src/smpi/smpitools.sh
include src/surf/HostImpl.cpp
include src/surf/HostImpl.hpp
-include src/surf/PropertyHolder.cpp
-include src/surf/PropertyHolder.hpp
include src/surf/StorageImpl.cpp
include src/surf/StorageImpl.hpp
include src/surf/cpu_cas01.cpp
include src/surf/StorageImpl.cpp
include src/surf/StorageImpl.hpp
include src/surf/cpu_cas01.cpp
include src/surf/xml/surfxml_parseplatf.cpp
include src/surf/xml/surfxml_sax_cb.cpp
include src/xbt/OsSemaphore.hpp
include src/surf/xml/surfxml_parseplatf.cpp
include src/surf/xml/surfxml_sax_cb.cpp
include src/xbt/OsSemaphore.hpp
+include src/xbt/PropertyHolder.cpp
include src/xbt/automaton/automaton.c
include src/xbt/automaton/automaton_lexer.yy.c
include src/xbt/automaton/automatonparse_promela.c
include src/xbt/automaton/automaton.c
include src/xbt/automaton/automaton_lexer.yy.c
include src/xbt/automaton/automatonparse_promela.c
#include <simgrid/forward.h>
#include <simgrid/s4u/NetZone.hpp>
#include <simgrid/forward.h>
#include <simgrid/s4u/NetZone.hpp>
+#include <xbt/PropertyHolder.hpp>
#include <xbt/graph.h>
#include <map>
#include <xbt/graph.h>
#include <map>
* called Autonomous Systems in this article).
*
*/
* called Autonomous Systems in this article).
*
*/
-class XBT_PUBLIC NetZoneImpl {
- friend simgrid::kernel::EngineImpl; // it destroys netRoot_
+class XBT_PUBLIC NetZoneImpl : public xbt::PropertyHolder {
+ friend EngineImpl; // it destroys netRoot_
protected:
explicit NetZoneImpl(NetZoneImpl* father, const std::string& name, resource::NetworkModel* network_model);
protected:
explicit NetZoneImpl(NetZoneImpl* father, const std::string& name, resource::NetworkModel* network_model);
s4u::NetZone* get_iface() { return &piface_; }
/** @brief Make a host within that NetZone */
s4u::NetZone* get_iface() { return &piface_; }
/** @brief Make a host within that NetZone */
- simgrid::s4u::Host* create_host(const std::string& name, const std::vector<double>& speed_per_pstate, int core_count,
- const std::map<std::string, std::string>* props);
+ s4u::Host* create_host(const std::string& name, const std::vector<double>& speed_per_pstate, int core_count,
+ const std::map<std::string, std::string>* props);
/** @brief Creates a new route in this NetZone */
virtual void add_bypass_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
std::vector<resource::LinkImpl*>& link_list, bool symmetrical);
/** @brief Creates a new route in this NetZone */
virtual void add_bypass_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
std::vector<resource::LinkImpl*>& link_list, bool symmetrical);
private:
kernel::routing::NetZoneImpl* const pimpl_;
private:
kernel::routing::NetZoneImpl* const pimpl_;
- std::unordered_map<std::string, std::string> properties_;
public:
/** Get the properties assigned to a netzone */
const std::unordered_map<std::string, std::string>* get_properties() const;
public:
/** Get the properties assigned to a netzone */
const std::unordered_map<std::string, std::string>* get_properties() const;
-
- std::vector<NetZone*> get_children();
-
/** Retrieve the property value (or nullptr if not set) */
const char* get_property(const std::string& key) const;
void set_property(const std::string& key, const std::string& value);
/** Retrieve the property value (or nullptr if not set) */
const char* get_property(const std::string& key) const;
void set_property(const std::string& key, const std::string& value);
+ std::vector<NetZone*> get_children();
+
/* 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 */
void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
/* 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 */
void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
/* 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. */
/* 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 SRC_SURF_PROPERTYHOLDER_HPP_
-#define SRC_SURF_PROPERTYHOLDER_HPP_
+#ifndef XBT_PROPERTYHOLDER_HPP
+#define XBT_PROPERTYHOLDER_HPP
#include <memory>
#include <string>
#include <unordered_map>
namespace simgrid {
#include <memory>
#include <string>
#include <unordered_map>
namespace simgrid {
/** @brief a PropertyHolder can be given a set of textual properties
*
/** @brief a PropertyHolder can be given a set of textual properties
*
class PropertyHolder { // DO NOT DERIVE THIS CLASS, or the diamond inheritance mayhem will get you
public:
class PropertyHolder { // DO NOT DERIVE THIS CLASS, or the diamond inheritance mayhem will get you
public:
- PropertyHolder() = default;
+ PropertyHolder() = default;
PropertyHolder(const PropertyHolder&) = delete;
PropertyHolder& operator=(const PropertyHolder&) = delete;
PropertyHolder(const PropertyHolder&) = delete;
PropertyHolder& operator=(const PropertyHolder&) = delete;
std::unique_ptr<std::unordered_map<std::string, std::string>> properties_ = nullptr;
};
std::unique_ptr<std::unordered_map<std::string, std::string>> properties_ = nullptr;
};
-} /* namespace surf */
-} /* namespace simgrid */
+} // namespace xbt
+} // namespace simgrid
-#endif /* SRC_SURF_PROPERTYHOLDER_HPP_ */
#include "simgrid/s4u/Actor.hpp"
#include "src/simix/popping_private.hpp"
#include "simgrid/s4u/Actor.hpp"
#include "src/simix/popping_private.hpp"
-#include "src/surf/PropertyHolder.hpp"
+#include "xbt/PropertyHolder.hpp"
#include <boost/intrusive/list.hpp>
#include <functional>
#include <list>
#include <boost/intrusive/list.hpp>
#include <functional>
#include <list>
namespace kernel {
namespace actor {
namespace kernel {
namespace actor {
-class XBT_PUBLIC ActorImpl : public surf::PropertyHolder {
+class XBT_PUBLIC ActorImpl : public xbt::PropertyHolder {
s4u::Host* host_ = nullptr; /* the host on which the actor is running */
// XBT_DEPRECATED_v329
void* userdata_ = nullptr; /* kept for compatibility, it should be replaced with moddata */
s4u::Host* host_ = nullptr; /* the host on which the actor is running */
// XBT_DEPRECATED_v329
void* userdata_ = nullptr; /* kept for compatibility, it should be replaced with moddata */
#include "simgrid/kernel/resource/Resource.hpp"
#include "simgrid/s4u/Disk.hpp"
#include "simgrid/s4u/Io.hpp"
#include "simgrid/kernel/resource/Resource.hpp"
#include "simgrid/s4u/Disk.hpp"
#include "simgrid/s4u/Io.hpp"
-#include "src/surf/PropertyHolder.hpp"
#include "src/surf/surf_interface.hpp"
#include "src/surf/surf_interface.hpp"
+#include <xbt/PropertyHolder.hpp>
/************
* Resource *
************/
/************
* Resource *
************/
-class DiskImpl : public Resource, public surf::PropertyHolder {
+class DiskImpl : public Resource, public xbt::PropertyHolder {
bool currently_destroying_ = false;
s4u::Host* host_ = nullptr;
s4u::Disk piface_;
bool currently_destroying_ = false;
s4u::Host* host_ = nullptr;
s4u::Disk piface_;
const std::unordered_map<std::string, std::string>* NetZone::get_properties() const
{
const std::unordered_map<std::string, std::string>* NetZone::get_properties() const
{
+ return pimpl_->get_properties();
}
/** Retrieve the property value (or nullptr if not set) */
const char* NetZone::get_property(const std::string& key) const
{
}
/** Retrieve the property value (or nullptr if not set) */
const char* NetZone::get_property(const std::string& key) const
{
- auto prop = properties_.find(key);
- return prop == properties_.end() ? nullptr : prop->second.c_str();
+ return pimpl_->get_property(key);
}
void NetZone::set_property(const std::string& key, const std::string& value)
{
}
void NetZone::set_property(const std::string& key, const std::string& value)
{
- kernel::actor::simcall([this, &key, &value] { properties_[key] = value; });
+ kernel::actor::simcall([this, &key, &value] { pimpl_->set_property(key, value); });
}
/** @brief Returns the list of direct children (no grand-children) */
}
/** @brief Returns the list of direct children (no grand-children) */
#include "src/kernel/actor/ActorImpl.hpp"
#include "src/kernel/resource/DiskImpl.hpp"
#include "src/kernel/actor/ActorImpl.hpp"
#include "src/kernel/resource/DiskImpl.hpp"
-#include "src/surf/PropertyHolder.hpp"
#include "src/surf/StorageImpl.hpp"
#include "src/surf/cpu_interface.hpp"
#include "src/surf/network_interface.hpp"
#include "src/surf/StorageImpl.hpp"
#include "src/surf/cpu_interface.hpp"
#include "src/surf/network_interface.hpp"
+#include <xbt/PropertyHolder.hpp>
* @brief SURF Host interface class
* @details An host represents a machine with a aggregation of a Cpu, a RoutingEdge and a Storage
*/
* @brief SURF Host interface class
* @details An host represents a machine with a aggregation of a Cpu, a RoutingEdge and a Storage
*/
-class XBT_PRIVATE HostImpl : public simgrid::surf::PropertyHolder {
+class XBT_PRIVATE HostImpl : public xbt::PropertyHolder {
std::vector<kernel::actor::ProcessArg*> actors_at_boot_;
s4u::Host* piface_ = nullptr; // FIXME: why don't we store a s4u::Host here as we do everywhere else?
std::vector<kernel::actor::ProcessArg*> actors_at_boot_;
s4u::Host* piface_ = nullptr; // FIXME: why don't we store a s4u::Host here as we do everywhere else?
#include "simgrid/kernel/resource/Resource.hpp"
#include "simgrid/s4u/Io.hpp"
#include "simgrid/s4u/Storage.hpp"
#include "simgrid/kernel/resource/Resource.hpp"
#include "simgrid/s4u/Io.hpp"
#include "simgrid/s4u/Storage.hpp"
-#include "src/surf/PropertyHolder.hpp"
#include "surf_interface.hpp"
#include "surf_interface.hpp"
+#include "xbt/PropertyHolder.hpp"
* @brief SURF storage interface class
* @details A Storage represent a storage unit (e.g.: hard drive, usb key)
*/
* @brief SURF storage interface class
* @details A Storage represent a storage unit (e.g.: hard drive, usb key)
*/
-class StorageImpl : public Resource, public surf::PropertyHolder {
+class StorageImpl : public Resource, public xbt::PropertyHolder {
s4u::Storage piface_;
public:
s4u::Storage piface_;
public:
#include "simgrid/kernel/resource/Resource.hpp"
#include "simgrid/s4u/Link.hpp"
#include "src/kernel/lmm/maxmin.hpp"
#include "simgrid/kernel/resource/Resource.hpp"
#include "simgrid/s4u/Link.hpp"
#include "src/kernel/lmm/maxmin.hpp"
-#include "src/surf/PropertyHolder.hpp"
+#include <xbt/PropertyHolder.hpp>
#include <list>
#include <unordered_map>
#include <list>
#include <unordered_map>
* @brief SURF network link interface class
* @details A Link represents the link between two [hosts](@ref simgrid::surf::HostImpl)
*/
* @brief SURF network link interface class
* @details A Link represents the link between two [hosts](@ref simgrid::surf::HostImpl)
*/
-class LinkImpl : public Resource, public surf::PropertyHolder {
+class LinkImpl : public Resource, public xbt::PropertyHolder {
bool currently_destroying_ = false;
s4u::Link piface_;
bool currently_destroying_ = false;
s4u::Link piface_;
{
xbt_assert(current_routing, "Cannot set properties of the current Zone: none under construction");
{
xbt_assert(current_routing, "Cannot set properties of the current Zone: none under construction");
- for (auto kv = props->begin(); kv != props->end(); ++kv)
- current_routing->get_iface()->set_property(kv->first, kv->second);
+ if (props)
+ current_routing->set_properties(*props);
/* 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. */
/* 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. */
-#include "PropertyHolder.hpp"
+#include <xbt/PropertyHolder.hpp>
#include <map>
namespace simgrid {
#include <map>
namespace simgrid {
/** @brief Return the property associated to the provided key (or nullptr if not existing) */
const char* PropertyHolder::get_property(const std::string& key) const
/** @brief Return the property associated to the provided key (or nullptr if not existing) */
const char* PropertyHolder::get_property(const std::string& key) const
template void PropertyHolder::set_properties(const std::map<std::string, std::string>& properties);
template void PropertyHolder::set_properties(const std::unordered_map<std::string, std::string>& properties);
template void PropertyHolder::set_properties(const std::map<std::string, std::string>& properties);
template void PropertyHolder::set_properties(const std::unordered_map<std::string, std::string>& properties);
-} /* namespace surf */
-} /* namespace simgrid */
+} // namespace xbt
+} // namespace simgrid
src/surf/storage_n11.hpp
src/surf/surf_interface.hpp
src/surf/surf_private.hpp
src/surf/storage_n11.hpp
src/surf/surf_interface.hpp
src/surf/surf_private.hpp
- src/surf/PropertyHolder.hpp
src/surf/host_clm03.hpp
src/surf/HostImpl.hpp
src/surf/ptask_L07.hpp
src/surf/host_clm03.hpp
src/surf/HostImpl.hpp
src/surf/ptask_L07.hpp
src/xbt/memory_map.cpp
src/xbt/memory_map.hpp
src/xbt/OsSemaphore.hpp
src/xbt/memory_map.cpp
src/xbt/memory_map.hpp
src/xbt/OsSemaphore.hpp
+ src/xbt/PropertyHolder.cpp
src/xbt/parmap.cpp
src/xbt/random.cpp
src/xbt/snprintf.c
src/xbt/parmap.cpp
src/xbt/random.cpp
src/xbt/snprintf.c
src/surf/network_constant.cpp
src/surf/network_interface.cpp
src/surf/network_wifi.cpp
src/surf/network_constant.cpp
src/surf/network_interface.cpp
src/surf/network_wifi.cpp
- src/surf/PropertyHolder.cpp
src/surf/sg_platf.cpp
src/surf/StorageImpl.cpp
src/surf/storage_n11.cpp
src/surf/sg_platf.cpp
src/surf/StorageImpl.cpp
src/surf/storage_n11.cpp
include/xbt/mallocator.h
include/xbt/misc.h
include/xbt/module.h
include/xbt/mallocator.h
include/xbt/misc.h
include/xbt/module.h
+ include/xbt/PropertyHolder.hpp
include/xbt/parmap.h
include/xbt/range.hpp
include/xbt/random.hpp
include/xbt/parmap.h
include/xbt/range.hpp
include/xbt/random.hpp