Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Constify pointer and reference parameters in src/bindings/.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 27 Dec 2019 21:52:03 +0000 (22:52 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 27 Dec 2019 21:57:16 +0000 (22:57 +0100)
src/bindings/java/jmsg_process.cpp
src/bindings/java/jmsg_process.h
src/bindings/python/simgrid_python.cpp

index d5fc013..cfb82d6 100644 (file)
@@ -22,7 +22,7 @@ jfieldID jprocess_field_Process_name;
 jfieldID jprocess_field_Process_pid;
 jfieldID jprocess_field_Process_ppid;
 
-jobject jprocess_from_native(msg_process_t process)
+jobject jprocess_from_native(const simgrid::s4u::Actor* process)
 {
   const simgrid::kernel::context::JavaContext* context =
       static_cast<simgrid::kernel::context::JavaContext*>(process->get_impl()->context_.get());
index 06b38dc..174cb08 100644 (file)
@@ -36,7 +36,7 @@ void jprocess_unref(jobject jprocess, JNIEnv* env);
 void jprocess_bind(jobject jprocess, msg_process_t process, JNIEnv* env);
 
 /** Extract the java instance from the native one */
-jobject jprocess_from_native(msg_process_t process);
+jobject jprocess_from_native(const simgrid::s4u::Actor* process);
 
 /** Extract the native instance from the java one */
 msg_process_t jprocess_to_native(jobject jprocess, JNIEnv* env);
index 533d61f..1f3acfd 100644 (file)
@@ -161,7 +161,7 @@ PYBIND11_MODULE(simgrid, m)
       .def_property("pstate", &Host::get_pstate, &Host::set_pstate, "The current pstate")
 
       .def("current", &Host::current, "Retrieves the host on which the running actor is located, see :cpp:func:`simgrid::s4u::Host::current()`")
-      .def_property_readonly("name", [](Host* self) -> const std::string {
+      .def_property_readonly("name", [](const Host* self) -> const std::string {
           return std::string(self->get_name().c_str()); // Convert from xbt::string because of MC
         }, "The name of this host")
       .def_property_readonly("load", &Host::get_load,
@@ -171,11 +171,11 @@ PYBIND11_MODULE(simgrid, m)
 
   /* Class Mailbox */
   py::class_<simgrid::s4u::Mailbox, std::unique_ptr<Mailbox, py::nodelete>>(m, "Mailbox", "Mailbox, see :ref:`class s4u::Mailbox <API_s4u_Mailbox>`")
-      .def("__str__", [](Mailbox* self) -> const std::string {
+      .def("__str__", [](const Mailbox* self) -> const std::string {
          return std::string("Mailbox(") + self->get_cname() + ")";
       }, "Textual representation of the Mailbox`")
       .def("by_name", &Mailbox::by_name, "Retrieve a Mailbox from its name, see :cpp:func:`simgrid::s4u::Mailbox::by_name()`")
-      .def_property_readonly("name", [](Mailbox* self) -> const std::string {
+      .def_property_readonly("name", [](const Mailbox* self) -> const std::string {
          return std::string(self->get_name().c_str()); // Convert from xbt::string because of MC
       }, "The name of that mailbox, see :cpp:func:`simgrid::s4u::Mailbox::get_name()`")
       .def("put", [](Mailbox* self, py::object data, int size) {