Skip to main content

maliput_sys/api/rules/
mod.rs

1// BSD 3-Clause License
2//
3// Copyright (c) 2024, Woven by Toyota.
4// All rights reserved.
5//
6// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions are met:
8//
9// * Redistributions of source code must retain the above copyright notice, this
10//   list of conditions and the following disclaimer.
11//
12// * Redistributions in binary form must reproduce the above copyright notice,
13//   this list of conditions and the following disclaimer in the documentation
14//   and/or other materials provided with the distribution.
15//
16// * Neither the name of the copyright holder nor the names of its
17//   contributors may be used to endorse or promote products derived from
18//   this software without specific prior written permission.
19//
20// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31#[cxx::bridge(namespace = "maliput::api::rules")]
32#[allow(clippy::needless_lifetimes)] // Clippy bug: https://github.com/rust-lang/rust-clippy/issues/5787
33pub mod ffi {
34    /// Shared struct for `TrafficLight` pointers.
35    /// This is needed because `*const` can't be used directly in the CxxVector collection.
36    struct ConstTrafficLightPtr {
37        pub traffic_light: *const TrafficLight,
38    }
39    /// Shared struct for `BulbGroup` pointers.
40    /// This is needed because `*const` can't be used directly in the CxxVector collection.
41    struct ConstBulbGroupPtr {
42        pub bulb_group: *const BulbGroup,
43    }
44    /// Shared struct for `Bulb` pointers.
45    /// This is needed because `*const` can't be used directly in the CxxVector collection.
46    struct ConstBulbPtr {
47        pub bulb: *const Bulb,
48    }
49    /// Shared struct for `TrafficSign` pointers.
50    /// This is needed because `*const` can't be used directly in the CxxVector collection.
51    struct ConstTrafficSignPtr {
52        pub traffic_sign: *const TrafficSign,
53    }
54    /// Shared struct for `BulbState` references.
55    /// This is needed because `&f` can't be used directly in the CxxVector collection.
56    struct ConstBulbStateRef<'a> {
57        pub bulb_state: &'a BulbState,
58    }
59    /// Shared struct for floats types.
60    /// This is needed because `f64` can't be used directly in the UniquePtr type.
61    struct FloatWrapper {
62        pub value: f64,
63    }
64    /// Shared struct for optional string types.
65    /// This is needed because `String` can't be used directly in the UniquePtr type.
66    /// A null `UniquePtr<StringWrapper>` represents `std::nullopt`.
67    struct StringWrapper {
68        pub value: String,
69    }
70    /// Shared struct for an optional `TrafficSignValue`.
71    /// `value` and `unit` are meaningful only when `has_value` is true.
72    struct TrafficSignValueData {
73        pub has_value: bool,
74        pub value: f64,
75        pub unit: TrafficSignValueUnit,
76    }
77    /// Shared struct for pairs in a properties map.
78    /// This is needed because maps can't be bound directly.
79    struct StringPair {
80        pub key: String,
81        pub value: String,
82    }
83    /// Shared struct for pairs in a RelatedRules collection.
84    ///  - key: Group name of the rules.
85    ///  - value: Rule ids.
86    /// This is needed because maps can't be bound directly.
87    struct RelatedRule {
88        pub group_name: String,
89        pub rule_ids: Vec<String>,
90    }
91    /// Shared struct for pairs in a RelatedRules collection.
92    ///  - key: Group name.
93    ///  - value: Unique Ids.
94    /// This is needed because maps can't be bound directly.
95    struct RelatedUniqueId {
96        pub group_name: String,
97        pub unique_ids: Vec<String>,
98    }
99    /// Shared struct for pairs in a DiscreteValueRules collection.
100    ///  - key: Rule type ids.
101    ///  - value: Discrete Values.
102    /// This is needed because maps can't be bound directly.
103    struct DiscreteValueRuleType {
104        pub type_id: String,
105        pub values: UniquePtr<CxxVector<DiscreteValueRuleDiscreteValue>>,
106    }
107    /// Shared struct for pairs in a DiscreteValues collection.
108    ///  - key: Rule ids.
109    ///  - value: Discrete Value State.
110    /// This is needed because maps can't be bound directly.
111    struct DiscreteValueRuleState {
112        pub rule_id: String,
113        pub state: UniquePtr<DiscreteValueRuleDiscreteValue>,
114    }
115    /// Shared struct for pairs in a RangeValueRules collection.
116    ///  - key: Rule type ids.
117    ///  - value: Range Values.
118    /// This is needed because maps can't be bound directly.
119    struct RangeValueRuleType {
120        pub type_id: String,
121        pub values: UniquePtr<CxxVector<RangeValueRuleRange>>,
122    }
123
124    /// Shared struct for `LaneSRange` constant reference.
125    /// Interestingly this was done at maliput::api module but
126    /// couldn't reference to that so it was necessary to
127    /// redefine it here.
128    struct ConstLaneSRangeRef<'a> {
129        pub lane_s_range: &'a LaneSRange,
130    }
131
132    /// Shared struct for a `NextPhase` in a `PhaseRing`.
133    ///  - phase_id: ID of the `NextPhase`.
134    ///  - duration_until: Optional field to suggest a default duration of the current `Phase`
135    ///    until the `NextPhase`.
136    /// Redefinition is necessary since std::optional<T> isn't supported.
137    struct NextPhase {
138        pub phase_id: String,
139        pub duration_until: UniquePtr<FloatWrapper>,
140    }
141
142    struct DiscreteValueNextState {
143        pub state: UniquePtr<DiscreteValueRuleDiscreteValue>,
144        pub duration_until: UniquePtr<FloatWrapper>,
145    }
146
147    struct RangeValueNextState {
148        pub state: UniquePtr<RangeValueRuleRange>,
149        pub duration_until: UniquePtr<FloatWrapper>,
150    }
151
152    #[repr(i32)]
153    enum BulbColor {
154        kRed = 0,
155        kYellow,
156        kGreen,
157    }
158
159    #[repr(i32)]
160    enum BulbType {
161        kRound = 0,
162        kArrow,
163        kArrowLeft,
164        kArrowRight,
165        kArrowUp,
166        kArrowUpperLeft,
167        kArrowUpperRight,
168        kUTurnLeft,
169        kUTurnRight,
170        kWalk,
171        kDontWalk,
172    }
173
174    #[repr(i32)]
175    enum BulbState {
176        kOff = 0,
177        kOn,
178        kBlinking,
179        kCounting,
180    }
181
182    #[repr(i32)]
183    enum TrafficControlDeviceType {
184        kNone = 0,
185        kOther,
186        kStop,
187        kYield,
188        kSpeedLimit,
189        kNoEntry,
190        kOneWay,
191        kPedestrianCrossing,
192        kNoLeftTurn,
193        kNoRightTurn,
194        kNoUTurn,
195        kSchoolZone,
196        kConstruction,
197        kRailroadCrossing,
198        kNoOvertaking,
199        kAllWay,
200        kNoUTurnLeft,
201        kNoUTurnRight,
202        kStopLine,
203        kCrosswalk,
204        kDangerSpot,
205        kZebraCrossing,
206        kFlight,
207        kCattle,
208        kHorseRiders,
209        kAmphibians,
210        kFallingRocks,
211        kSnowOrIce,
212        kLooseGravel,
213        kWaterside,
214        kClearance,
215        kMovableBridge,
216        kRightBeforeLeftNextIntersection,
217        kTurnLeft,
218        kTurnRight,
219        kDoubleTurnLeft,
220        kDoubleTurnRight,
221        kHillDownwards,
222        kHillUpwards,
223        kUnevenRoad,
224        kRoadSlipperyWetOrDirty,
225        kSideWinds,
226        kRoadNarrowing,
227        kRoadNarrowingRight,
228        kRoadNarrowingLeft,
229        kRoadWorks,
230        kTrafficQueues,
231        kTwoWayTraffic,
232        kAttentionTrafficLight,
233        kPedestrians,
234        kChildrenCrossing,
235        kCycleRoute,
236        kDeerCrossing,
237        kUngatedLevelCrossing,
238        kLevelCrossingMarker,
239        kRailwayTrafficPriority,
240        kGiveWay,
241        kPriorityToOppositeDirection,
242        kPriorityToOppositeDirectionUpsideDown,
243        kPrescribedLeftTurn,
244        kPrescribedRightTurn,
245        kPrescribedStraight,
246        kPrescribedRightWay,
247        kPrescribedLeftWay,
248        kPrescribedRightTurnAndStraight,
249        kPrescribedLeftTurnAndStraight,
250        kPrescribedLeftTurnAndRightTurn,
251        kPrescribedLeftTurnRightTurnAndStraight,
252        kRoundabout,
253        kOnewayLeft,
254        kOnewayRight,
255        kPassLeft,
256        kPassRight,
257        kSideLaneOpenForTraffic,
258        kSideLaneClosedForTraffic,
259        kSideLaneClosingForTraffic,
260        kBusStop,
261        kTaxiStand,
262        kBicyclesOnly,
263        kHorseRidersOnly,
264        kPedestriansOnly,
265        kBicyclesPedestriansSharedOnly,
266        kBicyclesPedestriansSeparatedLeftOnly,
267        kBicyclesPedestriansSeparatedRightOnly,
268        kPedestrianZoneBegin,
269        kPedestrianZoneEnd,
270        kBicycleRoadBegin,
271        kBicycleRoadEnd,
272        kBusLane,
273        kBusLaneBegin,
274        kBusLaneEnd,
275        kAllProhibited,
276        kMotorizedMultitrackProhibited,
277        kTrucksProhibited,
278        kBicyclesProhibited,
279        kMotorcyclesProhibited,
280        kMopedsProhibited,
281        kHorseRidersProhibited,
282        kHorseCarriagesProhibited,
283        kCattleProhibited,
284        kBusesProhibited,
285        kCarsProhibited,
286        kCarsTrailersProhibited,
287        kTrucksTrailersProhibited,
288        kTractorsProhibited,
289        kPedestriansProhibited,
290        kMotorVehiclesProhibited,
291        kHazardousGoodsVehiclesProhibited,
292        kOverWeightVehiclesProhibited,
293        kVehiclesAxleOverWeightProhibited,
294        kVehiclesExcessWidthProhibited,
295        kVehiclesExcessHeightProhibited,
296        kVehiclesExcessLengthProhibited,
297        kDoNotEnter,
298        kSnowChainsRequired,
299        kWaterPollutantVehiclesProhibited,
300        kEnvironmentalZoneBegin,
301        kEnvironmentalZoneEnd,
302        kPrescribedUTurnLeft,
303        kPrescribedUTurnRight,
304        kMinimumDistanceForTrucks,
305        kSpeedLimitBegin,
306        kSpeedLimitZoneBegin,
307        kSpeedLimitZoneEnd,
308        kMinimumSpeedBegin,
309        kOvertakingBanBegin,
310        kOvertakingBanForTrucksBegin,
311        kSpeedLimitEnd,
312        kMinimumSpeedEnd,
313        kOvertakingBanEnd,
314        kOvertakingBanForTrucksEnd,
315        kAllRestrictionsEnd,
316        kNoStopping,
317        kNoParking,
318        kNoParkingZoneBegin,
319        kNoParkingZoneEnd,
320        kRightOfWayNextIntersection,
321        kRightOfWayBegin,
322        kRightOfWayEnd,
323        kPriorityOverOppositeDirection,
324        kPriorityOverOppositeDirectionUpsideDown,
325        kTownBegin,
326        kTownEnd,
327        kCarParking,
328        kCarParkingZoneBegin,
329        kCarParkingZoneEnd,
330        kSidewalkHalfParkingLeft,
331        kSidewalkHalfParkingRight,
332        kSidewalkParkingLeft,
333        kSidewalkParkingRight,
334        kSidewalkPerpendicularHalfParkingLeft,
335        kSidewalkPerpendicularHalfParkingRight,
336        kSidewalkPerpendicularParkingLeft,
337        kSidewalkPerpendicularParkingRight,
338        kLivingStreetBegin,
339        kLivingStreetEnd,
340        kTunnel,
341        kEmergencyStoppingLeft,
342        kEmergencyStoppingRight,
343        kHighwayBegin,
344        kHighwayEnd,
345        kExpresswayBegin,
346        kExpresswayEnd,
347        kNamedHighwayExit,
348        kNamedExpresswayExit,
349        kNamedRoadExit,
350        kHighwayExit,
351        kExpresswayExit,
352        kOnewayStreet,
353        kCrossingGuards,
354        kDeadend,
355        kDeadendExcludingDesignatedActors,
356        kFirstAidStation,
357        kPoliceStation,
358        kTelephone,
359        kFillingStation,
360        kHotel,
361        kInn,
362        kKiosk,
363        kToilet,
364        kChapel,
365        kTouristInfo,
366        kRepairService,
367        kPedestrianUnderpass,
368        kPedestrianBridge,
369        kCamperPlace,
370        kAdvisorySpeedLimitBegin,
371        kAdvisorySpeedLimitEnd,
372        kPlaceName,
373        kTouristAttraction,
374        kTouristRoute,
375        kTouristArea,
376        kShoulderNotPassableMotorVehicles,
377        kShoulderUnsafeTrucksTractors,
378        kTollBegin,
379        kTollEnd,
380        kTollRoad,
381        kCustoms,
382        kInternationalBorderInfo,
383        kStreetlightRedBand,
384        kFederalHighwayRouteNumber,
385        kHighwayRouteNumber,
386        kHighwayInterchangeNumber,
387        kEuropeanRouteNumber,
388        kFederalHighwayDirectionLeft,
389        kFederalHighwayDirectionRight,
390        kPrimaryRoadDirectionLeft,
391        kPrimaryRoadDirectionRight,
392        kSecondaryRoadDirectionLeft,
393        kSecondaryRoadDirectionRight,
394        kDirectionDesignatedActorsLeft,
395        kDirectionDesignatedActorsRight,
396        kRoutingDesignatedActors,
397        kDirectionToHighwayLeft,
398        kDirectionToHighwayRight,
399        kDirectionToLocalDestinationLeft,
400        kDirectionToLocalDestinationRight,
401        kConsolidatedDirections,
402        kStreetName,
403        kDirectionPreannouncement,
404        kDirectionPreannouncementLaneConfig,
405        kDirectionPreannouncementHighwayEntries,
406        kHighwayAnnouncement,
407        kOtherRoadAnnouncement,
408        kHighwayAnnouncementTruckStop,
409        kHighwayPreannouncementDirections,
410        kPoleExit,
411        kHighwayDistanceBoard,
412        kDetourLeft,
413        kDetourRight,
414        kNumberedDetour,
415        kDetourBegin,
416        kDetourEnd,
417        kDetourRoutingBoard,
418        kOptionalDetour,
419        kOptionalDetourRouting,
420        kRouteRecommendation,
421        kRouteRecommendationEnd,
422        kAnnounceLaneTransitionLeft,
423        kAnnounceLaneTransitionRight,
424        kAnnounceRightLaneEnd,
425        kAnnounceLeftLaneEnd,
426        kAnnounceRightLaneBegin,
427        kAnnounceLeftLaneBegin,
428        kAnnounceLaneConsolidation,
429        kDetourCityBlock,
430        kGate,
431        kPoleWarning,
432        kTrafficCone,
433        kMobileLaneClosure,
434        kReflectorPost,
435        kDirectionalBoardWarning,
436        kGuidingPlate,
437        kGuidingPlateWedges,
438        kParkingHazard,
439        kTrafficLightGreenArrow,
440        kText,
441        kSpace,
442        kTime,
443        kArrow,
444        kConstrainedTo,
445        kExcept,
446        kValidForDistance,
447        kPriorityRoadBottomLeftFourWay,
448        kPriorityRoadTopLeftFourWay,
449        kPriorityRoadBottomLeftThreeWayStraight,
450        kPriorityRoadBottomLeftThreeWaySideways,
451        kPriorityRoadTopLeftThreeWayStraight,
452        kPriorityRoadBottomRightFourWay,
453        kPriorityRoadTopRightFourWay,
454        kPriorityRoadBottomRightThreeWayStraight,
455        kPriorityRoadBottomRightThreeWaySideway,
456        kPriorityRoadTopRightThreeWayStraight,
457        kValidInDistance,
458        kStopIn,
459        kLeftArrow,
460        kLeftBendArrow,
461        kRightArrow,
462        kRightBendArrow,
463        kAccident,
464        kSnow,
465        kFog,
466        kRollingHighwayInformation,
467        kServices,
468        kTimeRange,
469        kParkingDiscTimeRestriction,
470        kWeight,
471        kWet,
472        kParkingConstraint,
473        kNoWaitingSideStripes,
474        kRain,
475        kSnowRain,
476        kNight,
477        kStop4Way,
478        kTruck,
479        kTractorsMayBePassed,
480        kHazardous,
481        kTrailer,
482        kZone,
483        kMotorcycle,
484        kMotorcycleAllowed,
485        kCar,
486        kEmergencyLane,
487        kUnknown,
488    }
489
490    #[repr(i32)]
491    enum TrafficSignValueUnit {
492        kMetersPerSecond = 0,
493        kKilometersPerHour,
494        kMilesPerHour,
495        kMeters,
496        kKilometers,
497        kFeet,
498        kMiles,
499        kPercent,
500        kKilograms,
501        kMetricTons,
502    }
503
504    unsafe extern "C++" {
505        include!("api/rules/rules.h");
506        include!("api/rules/aliases.h");
507        include!("cxx_utils/error_handling.h");
508
509        // Forward declarations
510        #[namespace = "maliput::api"]
511        type InertialPosition = crate::api::ffi::InertialPosition;
512        #[namespace = "maliput::api"]
513        type Rotation = crate::api::ffi::Rotation;
514        #[namespace = "maliput::api"]
515        type LaneSRange = crate::api::ffi::LaneSRange;
516        #[namespace = "maliput::api"]
517        type LaneSRoute = crate::api::ffi::LaneSRoute;
518        #[namespace = "maliput::api"]
519        type RoadPosition = crate::api::ffi::RoadPosition;
520        #[namespace = "maliput::math"]
521        type Vector3 = crate::math::ffi::Vector3;
522        #[namespace = "maliput::math"]
523        type RollPitchYaw = crate::math::ffi::RollPitchYaw;
524        #[namespace = "maliput::math"]
525        type BoundingBox = crate::math::ffi::BoundingBox;
526
527        // TrafficLightBook bindings definitions.
528        type TrafficLightBook;
529        fn TrafficLightBook_TrafficLights(book: &TrafficLightBook) -> UniquePtr<CxxVector<ConstTrafficLightPtr>>;
530        fn TrafficLightBook_GetTrafficLight(book: &TrafficLightBook, id: &String) -> *const TrafficLight;
531        fn TrafficLightBook_FindByLane(
532            book: &TrafficLightBook,
533            lane_id: &String,
534        ) -> UniquePtr<CxxVector<ConstTrafficLightPtr>>;
535
536        // TrafficLight bindings definitions.
537        type TrafficLight;
538        fn TrafficLight_id(traffic_light: &TrafficLight) -> String;
539        fn TrafficLight_position_road_network(traffic_light: &TrafficLight) -> UniquePtr<InertialPosition>;
540        fn TrafficLight_orientation_road_network(traffic_light: &TrafficLight) -> UniquePtr<Rotation>;
541        fn TrafficLight_bulb_groups(traffic_light: &TrafficLight) -> UniquePtr<CxxVector<ConstBulbGroupPtr>>;
542        fn TrafficLight_GetBulbGroup(traffic_light: &TrafficLight, id: &String) -> *const BulbGroup;
543        fn TrafficLight_related_lanes(traffic_light: &TrafficLight) -> Vec<String>;
544
545        // TrafficSignBook bindings definitions.
546        type TrafficSignBook;
547        type TrafficSignValueUnit;
548        fn TrafficSignBook_TrafficSigns(book: &TrafficSignBook) -> UniquePtr<CxxVector<ConstTrafficSignPtr>>;
549        fn TrafficSignBook_GetTrafficSign(book: &TrafficSignBook, id: &String) -> *const TrafficSign;
550        fn TrafficSignBook_FindByLane(
551            book: &TrafficSignBook,
552            lane_id: &String,
553        ) -> UniquePtr<CxxVector<ConstTrafficSignPtr>>;
554        fn TrafficSignBook_FindByType(
555            book: &TrafficSignBook,
556            sign_type: TrafficControlDeviceType,
557        ) -> UniquePtr<CxxVector<ConstTrafficSignPtr>>;
558
559        // TrafficSign bindings definitions.
560        type TrafficSign;
561        fn TrafficSign_id(sign: &TrafficSign) -> String;
562        // This method could be bound as `fn type(self: &TrafficSign) -> TrafficSignType` but it causes a conflict with the `type` keyword in Rust.
563        fn TrafficSign_type(sign: &TrafficSign) -> TrafficControlDeviceType;
564        fn TrafficSign_position_road_network(sign: &TrafficSign) -> UniquePtr<InertialPosition>;
565        fn TrafficSign_orientation_road_network(sign: &TrafficSign) -> UniquePtr<Rotation>;
566        fn TrafficSign_message(sign: &TrafficSign) -> UniquePtr<StringWrapper>;
567        fn is_dynamic(self: &TrafficSign) -> bool;
568        fn is_movable(self: &TrafficSign) -> bool;
569        fn TrafficSign_related_lanes(sign: &TrafficSign) -> Vec<String>;
570        fn TrafficSign_dependent_signs(sign: &TrafficSign) -> Vec<String>;
571        fn TrafficSign_bounding_box(sign: &TrafficSign) -> UniquePtr<BoundingBox>;
572        fn TrafficSign_value(sign: &TrafficSign) -> TrafficSignValueData;
573        fn TrafficSign_properties(sign: &TrafficSign) -> Vec<StringPair>;
574
575        type BulbColor;
576        type BulbState;
577        type BulbType;
578        // Bulb bindings definitions.
579        type Bulb;
580        fn Bulb_id(bulb: &Bulb) -> String;
581        fn Bulb_unique_id(bulb: &Bulb) -> UniquePtr<UniqueBulbId>;
582        fn Bulb_position_bulb_group(bulb: &Bulb) -> UniquePtr<InertialPosition>;
583        fn Bulb_orientation_bulb_group(bulb: &Bulb) -> UniquePtr<Rotation>;
584        fn color(self: &Bulb) -> &BulbColor;
585        // We can't automatically use the name `type` as it is a reserved keyword in Rust.
586        fn Bulb_type(bulb: &Bulb) -> &BulbType;
587        fn Bulb_arrow_orientation_rad(bulb: &Bulb) -> UniquePtr<FloatWrapper>;
588        fn Bulb_states(bulb: &Bulb) -> UniquePtr<CxxVector<BulbState>>;
589        fn GetDefaultState(self: &Bulb) -> BulbState;
590        fn GetInitialState(self: &Bulb) -> BulbState;
591        fn IsValidState(self: &Bulb, state: &BulbState) -> bool;
592        fn Bulb_bounding_box_min(bulb: &Bulb) -> UniquePtr<Vector3>;
593        fn Bulb_bounding_box_max(bulb: &Bulb) -> UniquePtr<Vector3>;
594        fn Bulb_bulb_group(bulb: &Bulb) -> *const BulbGroup;
595
596        // BulbGroup bindings definitions.
597        type BulbGroup;
598        fn BulbGroup_id(bulb_group: &BulbGroup) -> String;
599        fn BulbGroup_unique_id(bulb: &BulbGroup) -> UniquePtr<UniqueBulbGroupId>;
600        fn BulbGroup_position_traffic_light(bulb_group: &BulbGroup) -> UniquePtr<InertialPosition>;
601        fn BulbGroup_orientation_traffic_light(bulb_group: &BulbGroup) -> UniquePtr<Rotation>;
602        fn BulbGroup_bulbs(bulb_group: &BulbGroup) -> UniquePtr<CxxVector<ConstBulbPtr>>;
603        fn BulbGroup_GetBulb(bulb_group: &BulbGroup, id: &String) -> *const Bulb;
604        fn BulbGroup_traffic_light(bulb_group: &BulbGroup) -> *const TrafficLight;
605
606        // UniqueBulbId bindings definitions.
607        type UniqueBulbId;
608        fn string(self: &UniqueBulbId) -> &CxxString;
609        fn UniqueBulbId_traffic_light_id(id: &UniqueBulbId) -> String;
610        fn UniqueBulbId_bulb_group_id(id: &UniqueBulbId) -> String;
611        fn UniqueBulbId_bulb_id(id: &UniqueBulbId) -> String;
612        fn UniqueBulbId_create_unique_ptr(id: &UniqueBulbId) -> UniquePtr<UniqueBulbId>;
613
614        // UniqueBulbGroupId bindings definitions.
615        type UniqueBulbGroupId;
616        fn string(self: &UniqueBulbGroupId) -> &CxxString;
617        fn UniqueBulbGroupId_traffic_light_id(id: &UniqueBulbGroupId) -> String;
618        fn UniqueBulbGroupId_bulb_group_id(id: &UniqueBulbGroupId) -> String;
619
620        // QueryResults bindings definitions.
621        type QueryResults;
622        fn QueryResults_discrete_value_rules(query_results: &QueryResults) -> Vec<String>;
623        fn QueryResults_range_value_rules(query_results: &QueryResults) -> Vec<String>;
624
625        // RoadRulebook bindings definitions.
626        type RoadRulebook;
627        fn RoadRulebook_GetDiscreteValueRule(book: &RoadRulebook, rule_id: &String) -> UniquePtr<DiscreteValueRule>;
628        fn RoadRulebook_GetRangeValueRule(book: &RoadRulebook, rule_id: &String) -> UniquePtr<RangeValueRule>;
629        fn RoadRulebook_Rules(book: &RoadRulebook) -> UniquePtr<QueryResults>;
630        #[allow(clippy::needless_lifetimes)]
631        fn RoadRulebook_FindRules(
632            book: &RoadRulebook,
633            ranges: &Vec<ConstLaneSRangeRef>,
634            tolerance: f64,
635        ) -> Result<UniquePtr<QueryResults>>;
636
637        // DiscreteValueRule::DiscreteValue bindings definitions.
638        type DiscreteValueRuleDiscreteValue;
639        fn DiscreteValueRuleDiscreteValue_value(value: &DiscreteValueRuleDiscreteValue) -> String;
640        fn DiscreteValueRuleDiscreteValue_severity(value: &DiscreteValueRuleDiscreteValue) -> i32;
641        fn DiscreteValueRuleDiscreteValue_related_rules(
642            value: &DiscreteValueRuleDiscreteValue,
643        ) -> UniquePtr<CxxVector<RelatedRule>>;
644        fn DiscreteValueRuleDiscreteValue_related_unique_ids(
645            value: &DiscreteValueRuleDiscreteValue,
646        ) -> UniquePtr<CxxVector<RelatedUniqueId>>;
647
648        // DiscreteValueRule bindings definitions.
649        type DiscreteValueRule;
650        fn states(self: &DiscreteValueRule) -> &CxxVector<DiscreteValueRuleDiscreteValue>;
651        fn DiscreteValueRule_id(rule: &DiscreteValueRule) -> String;
652        fn DiscreteValueRule_type_id(rule: &DiscreteValueRule) -> String;
653        fn DiscreteValueRule_zone(rule: &DiscreteValueRule) -> UniquePtr<LaneSRoute>;
654
655        // RangeValueRule::Range bindings definitions.
656        type RangeValueRuleRange;
657        fn RangeValueRuleRange_description(range: &RangeValueRuleRange) -> String;
658        fn RangeValueRuleRange_min(range: &RangeValueRuleRange) -> f64;
659        fn RangeValueRuleRange_max(range: &RangeValueRuleRange) -> f64;
660        fn RangeValueRuleRange_severity(range: &RangeValueRuleRange) -> i32;
661        fn RangeValueRuleRange_related_rules(range: &RangeValueRuleRange) -> UniquePtr<CxxVector<RelatedRule>>;
662        fn RangeValueRuleRange_related_unique_ids(range: &RangeValueRuleRange)
663            -> UniquePtr<CxxVector<RelatedUniqueId>>;
664        // RangeValueRule::Range bindings definitions.
665        type RangeValueRule;
666        fn RangeValueRule_id(rule: &RangeValueRule) -> String;
667        fn RangeValueRule_type_id(rule: &RangeValueRule) -> String;
668        fn RangeValueRule_zone(rule: &RangeValueRule) -> UniquePtr<LaneSRoute>;
669        fn states(self: &RangeValueRule) -> &CxxVector<RangeValueRuleRange>;
670
671        // Phase bindings definitions.
672        type Phase;
673        fn Phase_id(phase: &Phase) -> String;
674        fn Phase_discrete_value_rule_states(phase: &Phase) -> UniquePtr<CxxVector<DiscreteValueRuleState>>;
675        fn Phase_unique_bulb_ids(phase: &Phase) -> UniquePtr<CxxVector<UniqueBulbId>>;
676        fn Phase_bulb_state(phase: &Phase, bulb_id: &UniqueBulbId) -> UniquePtr<BulbState>;
677        // Helper method to implement [Phase_unique_bulb_ids] API method.
678        fn ptr_from_unique_bulb_id(id: &UniqueBulbId) -> UniquePtr<UniqueBulbId>;
679
680        // PhaseRing bindings definitions.
681        type PhaseRing;
682        fn PhaseRing_id(phase_ring: &PhaseRing) -> String;
683        fn PhaseRing_GetPhase(phase_ring: &PhaseRing, id: &String) -> UniquePtr<Phase>;
684        fn PhaseRing_phases_ids(phase_ring: &PhaseRing) -> Vec<String>;
685        fn PhaseRing_GetNextPhases(phase_ring: &PhaseRing, id: &String) -> Result<UniquePtr<CxxVector<NextPhase>>>;
686
687        // StateProviderResult<Phase::Id> bindings definitions.
688        type PhaseStateProviderQuery;
689        fn PhaseStateProvider_state(phase_state_provider: &PhaseStateProviderQuery) -> String;
690        fn PhaseStateProvider_next(phase_state_provider: &PhaseStateProviderQuery) -> UniquePtr<NextPhase>;
691
692        // PhaseProvider bindings definitions.
693        type PhaseProvider;
694        fn PhaseProvider_GetPhase(
695            phase_provider: &PhaseProvider,
696            phase_ring_id: &String,
697        ) -> UniquePtr<PhaseStateProviderQuery>;
698
699        // PhaseRingBook bindings definitions.
700        type PhaseRingBook;
701        fn PhaseRingBook_GetPhaseRingsId(book: &PhaseRingBook) -> Vec<String>;
702        fn PhaseRingBook_GetPhaseRing(book: &PhaseRingBook, id: &String) -> UniquePtr<PhaseRing>;
703        fn PhaseRingBook_FindPhaseRing(book: &PhaseRingBook, rule_id: &String) -> UniquePtr<PhaseRing>;
704
705        // RuleRegistry bindings definitions.
706        type RuleRegistry;
707        fn RuleRegistry_DiscreteValueRuleTypes(registry: &RuleRegistry) -> UniquePtr<CxxVector<DiscreteValueRuleType>>;
708        fn RuleRegistry_RangeValueRuleTypes(registry: &RuleRegistry) -> UniquePtr<CxxVector<RangeValueRuleType>>;
709
710        // DiscreteValueRuleStateProviderQuery bindings definitions.
711        type DiscreteValueRuleStateProviderQuery;
712        fn DiscreteValueRuleStateProviderQuery_state(
713            state_provider_query: &DiscreteValueRuleStateProviderQuery,
714        ) -> UniquePtr<DiscreteValueRuleDiscreteValue>;
715        fn DiscreteValueRuleStateProviderQuery_next(
716            state_provider_query: &DiscreteValueRuleStateProviderQuery,
717        ) -> UniquePtr<DiscreteValueNextState>;
718
719        // DiscreteValueRuleStateProvider bindings definitions.
720        type DiscreteValueRuleStateProvider;
721        fn DiscreteValueRuleStateProvider_GetStateById(
722            state_provider: &DiscreteValueRuleStateProvider,
723            id: &String,
724        ) -> UniquePtr<DiscreteValueRuleStateProviderQuery>;
725        fn DiscreteValueRuleStateProvider_GetStateByType(
726            state_provider: &DiscreteValueRuleStateProvider,
727            road_position: &RoadPosition,
728            rule_type: &String,
729            tolerance: f64,
730        ) -> UniquePtr<DiscreteValueRuleStateProviderQuery>;
731
732        // RangeValueRuleStateProviderQuery bindings definitions.
733        type RangeValueRuleStateProviderQuery;
734        fn RangeValueRuleStateProviderQuery_state(
735            state_provider_query: &RangeValueRuleStateProviderQuery,
736        ) -> UniquePtr<RangeValueRuleRange>;
737        fn RangeValueRuleStateProviderQuery_next(
738            state_provider_query: &RangeValueRuleStateProviderQuery,
739        ) -> UniquePtr<RangeValueNextState>;
740
741        // RangeValueRuleStateProvider bindings definitions.
742        type RangeValueRuleStateProvider;
743        fn RangeValueRuleStateProvider_GetStateById(
744            state_provider: &RangeValueRuleStateProvider,
745            id: &String,
746        ) -> UniquePtr<RangeValueRuleStateProviderQuery>;
747        fn RangeValueRuleStateProvider_GetStateByType(
748            state_provider: &RangeValueRuleStateProvider,
749            road_position: &RoadPosition,
750            rule_type: &String,
751            tolerance: f64,
752        ) -> UniquePtr<RangeValueRuleStateProviderQuery>;
753    }
754}