How to share ISAAC_PARAM between codelets?

I set a param in one codelet using
ISAAC_PARAM(bool, switchParam, 1); in .hpp
set_switchParam(OnOff); in .cpp
but how can I access it from an other codelet ?
I tried get_switchParam() in .cpp and nothing in .hpp but of course it don’t know the function…
I tried get_switchParam() in .cpp and ISAAC_PARAM(bool, switchParam, 1); in .hpp but of course it’s local declaration…
I found this post but it’s not clear enough, it say to use something like :
navigation_mode_->get_desired_behavior(waypoint.empty() ? “stop” : “navigate”);
but the line is no longer available in apps/carter/carter_delivery/CarterDelivery.hpp so I have issues understanding it.
Please help me share my ISAAC_PARAM between my codelets !

Update :
I tried with :

in my Switch .cpp :

  SwitchTCP *tcp;
  bool switchbool = tcp->SwitchTCP::get_switchParam();

in my hpp :

namespace isaac {
class Switch : public alice::Codelet {
  void start() override;
  void tick() override;
  ISAAC_PROTO_RX(ColorCameraProto, input_image);
  ISAAC_PROTO_TX(ColorCameraProto, output_image);

class SwitchTCP : public alice::Codelet {
  void start() override;
  void tick() override;
  ISAAC_PROTO_RX(PingProto, switch_bool);
  ISAAC_PARAM(bool, switchParam, 1);
}  // namespace isaac


and get the following error :
error: 'tcp' is used uninitialized in this function [-Werror=uninitialized]

I don’t want to brake my computer ignoring warning, any idea to fix that ?

Thanks !
kind regards,

Hello planktos,

did you find a solution? I am also looking for a way to read an ISAAC_PARAM that I set in another codelet.

I didn’t, I used 'extern ’ variable specified in a header to share data between parts of my code.

You would probably want to broadcast that parameter value out to listeners of that component to avoid unnecessary coupling. Perhaps include it in the outgoing messages as context data.

Still, if you do need to obtain a pointer to another codelet in the same node, you can use directory services available to use within a component and then query the parameter:

node()->app()->findComponentByName<{component class name}>({string for component name});

I solved my problem by setting and getting variables given in the this post as planktos also linked.
It was unclear to me how to read the content of the variable but I realized I just needed to get the pointer of it.