Hi Jacob, hi community,

I want to pass Information from the follower to the leader:

void
MSDevice_Car2Car_Energy_Sharing::myMethod() {
         MSVehicle* holder =
libsumo::Helper::getVehicle(this->getHolder().getID());
         std::pair<const MSVehicle* const, double>result = holder->getLeader();
         const MSVehicle* leader = result.first;
         if (leader->hasDevice("MSDevice_Car2Car_Energy_Sharing") &&
!this->isPDLeader) {
                 leader->setDeviceParameter("MSDevice_Car2Car_Energy_Sharing", 
"pdLeader",
"true"); //relevant part
         }
}

This does not compile, it would compile however if I would do:
                 holder->setDeviceParameter("MSDevice_Car2Car_Energy_Sharing", 
"pdLeader",
"true");

The problem is obviously the "const" keyword, so it's not intended that we
change values with getLeader().
Is there another way I can pass Information to the leader?





--
Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/
_______________________________________________
sumo-user mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user

Reply via email to