Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] Pass Information from follower to the leader(C++)

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/


Back to the top