/** @brief the NetZone in which this NetPoint is included */
NetZoneImpl* get_englobing_zone() { return englobing_zone_; }
- bool is_netzone() { return component_type_ == Type::NetZone; }
- bool is_host() { return component_type_ == Type::Host; }
- bool is_router() { return component_type_ == Type::Router; }
+ bool is_netzone() const { return component_type_ == Type::NetZone; }
+ bool is_host() const { return component_type_ == Type::Host; }
+ bool is_router() const { return component_type_ == Type::Router; }
static simgrid::xbt::signal<void(NetPoint*)> on_creation;
/** Retrieves the name of that actor as a C string */
const char* get_cname() const;
/** Retrieves the host on which that actor is running */
- Host* get_host();
+ Host* get_host() const;
/** Retrieves the actor ID of that actor */
aid_t get_pid() const;
/** Retrieves the actor ID of that actor's creator */
* It will be set to true if the actor was killed or failed because of an exception,
* while it will remain to false if the actor terminated gracefully.
*/
- void on_exit(const std::function<void(bool /*failed*/)>& fun);
+ void on_exit(const std::function<void(bool /*failed*/)>& fun) const;
/** Sets the time at which that actor should be killed */
void set_kill_time(double time);
static void kill_all();
/** Returns the internal implementation of this actor */
- kernel::actor::ActorImpl* get_impl();
+ kernel::actor::ActorImpl* get_impl() const { return pimpl_; }
/** Retrieve the property value (or nullptr if not set) */
std::unordered_map<std::string, std::string>*
const char* get_cname() const;
/** @brief Get the bandwidth in bytes per second of current Link */
- double get_bandwidth();
+ double get_bandwidth() const;
/** @brief Get the latency in seconds of current Link */
- double get_latency();
+ double get_latency() const;
/** @brief Describes how the link is shared between flows */
SharingPolicy get_sharing_policy();
DESTROYED
};
- vm::VirtualMachineImpl* get_impl() { return pimpl_vm_; }
+ vm::VirtualMachineImpl* get_impl() const { return pimpl_vm_; }
void start();
void suspend();
void resume();
public:
explicit constexpr Extension() : id_(INVALID_ID) {}
std::size_t id() const { return id_; }
- bool valid() { return id_ != INVALID_ID; }
+ bool valid() const { return id_ != INVALID_ID; }
};
/** An Extendable is an object that you can extend with external elements.
}
// Type-unsafe versions of the facet access methods:
- void* extension(std::size_t rank)
+ void* extension(std::size_t rank) const
{
if (rank >= extensions_.size())
return nullptr;
}
// 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> U* extension(Extension<T, U> rank) const { return static_cast<U*>(extension(rank.id())); }
template<class U>
void extension_set(Extension<T,U> rank, U* value, bool use_dtor = true)
{
}
// 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> U* extension() const { return extension<U>(U::EXTENSION_ID); }
template<class U> void extension_set(U* p) { extension_set<U>(U::EXTENSION_ID, p); }
};
trivaNodeTypes.insert(type_->get_name());
}
-HostContainer::HostContainer(simgrid::s4u::Host& host, NetZoneContainer* father)
+HostContainer::HostContainer(simgrid::s4u::Host const& host, NetZoneContainer* father)
: Container::Container(host.get_name(), "HOST", father)
{
xbt_assert(father, "Only the Root container has no father");
class HostContainer : public Container {
public:
- HostContainer(simgrid::s4u::Host& host, NetZoneContainer* father);
+ HostContainer(simgrid::s4u::Host const& host, NetZoneContainer* father);
};
}
}
surf_action_->cancel();
}
-double ExecImpl::get_remaining()
+double ExecImpl::get_remaining() const
{
return surf_action_ ? surf_action_->get_remains() : 0;
}
void cancel();
void post() override;
void finish() override;
- double get_remaining();
+ double get_remaining() const;
double get_seq_remaining_ratio();
double get_par_remaining_ratio();
void set_bound(double bound); // deprecated. To be removed in v3.25
on_exit([fun, data](bool exit) { fun(exit, data); });
}
-void Actor::on_exit(const std::function<void(bool /*failed*/)>& fun)
+void Actor::on_exit(const std::function<void(bool /*failed*/)>& fun) const
{
simix::simcall(
[this, fun] { SIMIX_process_on_exit(pimpl_, [fun](int a, void* /*data*/) { fun(a != 0); }, nullptr); });
s4u::Actor::on_migration_end(this);
}
-s4u::Host* Actor::get_host()
+s4u::Host* Actor::get_host() const
{
return this->pimpl_->get_host();
}
});
}
-kernel::actor::ActorImpl* Actor::get_impl()
-{
- return pimpl_;
-}
-
// ***** Static functions *****
ActorPtr Actor::by_pid(aid_t pid)
return this->pimpl_->is_used();
}
-double Link::get_latency()
+double Link::get_latency() const
{
return this->pimpl_->get_latency();
}
-double Link::get_bandwidth()
+double Link::get_bandwidth() const
{
return this->pimpl_->get_bandwidth();
}
}
/** @brief returns a list of all CPUs that this action is using */
-std::list<Cpu*> CpuAction::cpus() {
+std::list<Cpu*> CpuAction::cpus() const
+{
std::list<Cpu*> retlist;
int llen = get_variable()->get_number_of_constraint();
void set_state(simgrid::kernel::resource::Action::State state) override;
void update_remains_lazy(double now) override;
- std::list<Cpu*> cpus();
+ std::list<Cpu*> cpus() const;
void suspend() override;
void resume() override;
}
/** @brief returns a list of all Links that this action is using */
-std::list<LinkImpl*> NetworkAction::links()
+std::list<LinkImpl*> NetworkAction::links() const
{
std::list<LinkImpl*> retlist;
int llen = get_variable()->get_number_of_constraint();
NetworkAction(Model* model, double cost, bool failed, lmm::Variable* var) : Action(model, cost, failed, var){};
void set_state(Action::State state) override;
- virtual std::list<LinkImpl*> links();
+ virtual std::list<LinkImpl*> links() const;
double latency_ = {};
double lat_current_ = {};
THROW_UNIMPLEMENTED;
}
-std::list<LinkImpl*> NetworkNS3Action::links()
+std::list<LinkImpl*> NetworkNS3Action::links() const
{
THROW_UNIMPLEMENTED;
}
void suspend() override;
void resume() override;
- std::list<LinkImpl*> links() override;
+ std::list<LinkImpl*> links() const override;
void update_remains_lazy(double now) override;
// private: