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    }
180
181    #[repr(i32)]
182    enum TrafficControlDeviceType {
183        kNone = 0,
184        kOther,
185        kStop,
186        kYield,
187        kSpeedLimit,
188        kNoEntry,
189        kOneWay,
190        kPedestrianCrossing,
191        kNoLeftTurn,
192        kNoRightTurn,
193        kNoUTurn,
194        kSchoolZone,
195        kConstruction,
196        kRailroadCrossing,
197        kNoOvertaking,
198        kAllWay,
199        kNoUTurnLeft,
200        kNoUTurnRight,
201        kStopLine,
202        kCrosswalk,
203        kDangerSpot,
204        kZebraCrossing,
205        kFlight,
206        kCattle,
207        kHorseRiders,
208        kAmphibians,
209        kFallingRocks,
210        kSnowOrIce,
211        kLooseGravel,
212        kWaterside,
213        kClearance,
214        kMovableBridge,
215        kRightBeforeLeftNextIntersection,
216        kTurnLeft,
217        kTurnRight,
218        kDoubleTurnLeft,
219        kDoubleTurnRight,
220        kHillDownwards,
221        kHillUpwards,
222        kUnevenRoad,
223        kRoadSlipperyWetOrDirty,
224        kSideWinds,
225        kRoadNarrowing,
226        kRoadNarrowingRight,
227        kRoadNarrowingLeft,
228        kRoadWorks,
229        kTrafficQueues,
230        kTwoWayTraffic,
231        kAttentionTrafficLight,
232        kPedestrians,
233        kChildrenCrossing,
234        kCycleRoute,
235        kDeerCrossing,
236        kUngatedLevelCrossing,
237        kLevelCrossingMarker,
238        kRailwayTrafficPriority,
239        kGiveWay,
240        kPriorityToOppositeDirection,
241        kPriorityToOppositeDirectionUpsideDown,
242        kPrescribedLeftTurn,
243        kPrescribedRightTurn,
244        kPrescribedStraight,
245        kPrescribedRightWay,
246        kPrescribedLeftWay,
247        kPrescribedRightTurnAndStraight,
248        kPrescribedLeftTurnAndStraight,
249        kPrescribedLeftTurnAndRightTurn,
250        kPrescribedLeftTurnRightTurnAndStraight,
251        kRoundabout,
252        kOnewayLeft,
253        kOnewayRight,
254        kPassLeft,
255        kPassRight,
256        kSideLaneOpenForTraffic,
257        kSideLaneClosedForTraffic,
258        kSideLaneClosingForTraffic,
259        kBusStop,
260        kTaxiStand,
261        kBicyclesOnly,
262        kHorseRidersOnly,
263        kPedestriansOnly,
264        kBicyclesPedestriansSharedOnly,
265        kBicyclesPedestriansSeparatedLeftOnly,
266        kBicyclesPedestriansSeparatedRightOnly,
267        kPedestrianZoneBegin,
268        kPedestrianZoneEnd,
269        kBicycleRoadBegin,
270        kBicycleRoadEnd,
271        kBusLane,
272        kBusLaneBegin,
273        kBusLaneEnd,
274        kAllProhibited,
275        kMotorizedMultitrackProhibited,
276        kTrucksProhibited,
277        kBicyclesProhibited,
278        kMotorcyclesProhibited,
279        kMopedsProhibited,
280        kHorseRidersProhibited,
281        kHorseCarriagesProhibited,
282        kCattleProhibited,
283        kBusesProhibited,
284        kCarsProhibited,
285        kCarsTrailersProhibited,
286        kTrucksTrailersProhibited,
287        kTractorsProhibited,
288        kPedestriansProhibited,
289        kMotorVehiclesProhibited,
290        kHazardousGoodsVehiclesProhibited,
291        kOverWeightVehiclesProhibited,
292        kVehiclesAxleOverWeightProhibited,
293        kVehiclesExcessWidthProhibited,
294        kVehiclesExcessHeightProhibited,
295        kVehiclesExcessLengthProhibited,
296        kDoNotEnter,
297        kSnowChainsRequired,
298        kWaterPollutantVehiclesProhibited,
299        kEnvironmentalZoneBegin,
300        kEnvironmentalZoneEnd,
301        kPrescribedUTurnLeft,
302        kPrescribedUTurnRight,
303        kMinimumDistanceForTrucks,
304        kSpeedLimitBegin,
305        kSpeedLimitZoneBegin,
306        kSpeedLimitZoneEnd,
307        kMinimumSpeedBegin,
308        kOvertakingBanBegin,
309        kOvertakingBanForTrucksBegin,
310        kSpeedLimitEnd,
311        kMinimumSpeedEnd,
312        kOvertakingBanEnd,
313        kOvertakingBanForTrucksEnd,
314        kAllRestrictionsEnd,
315        kNoStopping,
316        kNoParking,
317        kNoParkingZoneBegin,
318        kNoParkingZoneEnd,
319        kRightOfWayNextIntersection,
320        kRightOfWayBegin,
321        kRightOfWayEnd,
322        kPriorityOverOppositeDirection,
323        kPriorityOverOppositeDirectionUpsideDown,
324        kTownBegin,
325        kTownEnd,
326        kCarParking,
327        kCarParkingZoneBegin,
328        kCarParkingZoneEnd,
329        kSidewalkHalfParkingLeft,
330        kSidewalkHalfParkingRight,
331        kSidewalkParkingLeft,
332        kSidewalkParkingRight,
333        kSidewalkPerpendicularHalfParkingLeft,
334        kSidewalkPerpendicularHalfParkingRight,
335        kSidewalkPerpendicularParkingLeft,
336        kSidewalkPerpendicularParkingRight,
337        kLivingStreetBegin,
338        kLivingStreetEnd,
339        kTunnel,
340        kEmergencyStoppingLeft,
341        kEmergencyStoppingRight,
342        kHighwayBegin,
343        kHighwayEnd,
344        kExpresswayBegin,
345        kExpresswayEnd,
346        kNamedHighwayExit,
347        kNamedExpresswayExit,
348        kNamedRoadExit,
349        kHighwayExit,
350        kExpresswayExit,
351        kOnewayStreet,
352        kCrossingGuards,
353        kDeadend,
354        kDeadendExcludingDesignatedActors,
355        kFirstAidStation,
356        kPoliceStation,
357        kTelephone,
358        kFillingStation,
359        kHotel,
360        kInn,
361        kKiosk,
362        kToilet,
363        kChapel,
364        kTouristInfo,
365        kRepairService,
366        kPedestrianUnderpass,
367        kPedestrianBridge,
368        kCamperPlace,
369        kAdvisorySpeedLimitBegin,
370        kAdvisorySpeedLimitEnd,
371        kPlaceName,
372        kTouristAttraction,
373        kTouristRoute,
374        kTouristArea,
375        kShoulderNotPassableMotorVehicles,
376        kShoulderUnsafeTrucksTractors,
377        kTollBegin,
378        kTollEnd,
379        kTollRoad,
380        kCustoms,
381        kInternationalBorderInfo,
382        kStreetlightRedBand,
383        kFederalHighwayRouteNumber,
384        kHighwayRouteNumber,
385        kHighwayInterchangeNumber,
386        kEuropeanRouteNumber,
387        kFederalHighwayDirectionLeft,
388        kFederalHighwayDirectionRight,
389        kPrimaryRoadDirectionLeft,
390        kPrimaryRoadDirectionRight,
391        kSecondaryRoadDirectionLeft,
392        kSecondaryRoadDirectionRight,
393        kDirectionDesignatedActorsLeft,
394        kDirectionDesignatedActorsRight,
395        kRoutingDesignatedActors,
396        kDirectionToHighwayLeft,
397        kDirectionToHighwayRight,
398        kDirectionToLocalDestinationLeft,
399        kDirectionToLocalDestinationRight,
400        kConsolidatedDirections,
401        kStreetName,
402        kDirectionPreannouncement,
403        kDirectionPreannouncementLaneConfig,
404        kDirectionPreannouncementHighwayEntries,
405        kHighwayAnnouncement,
406        kOtherRoadAnnouncement,
407        kHighwayAnnouncementTruckStop,
408        kHighwayPreannouncementDirections,
409        kPoleExit,
410        kHighwayDistanceBoard,
411        kDetourLeft,
412        kDetourRight,
413        kNumberedDetour,
414        kDetourBegin,
415        kDetourEnd,
416        kDetourRoutingBoard,
417        kOptionalDetour,
418        kOptionalDetourRouting,
419        kRouteRecommendation,
420        kRouteRecommendationEnd,
421        kAnnounceLaneTransitionLeft,
422        kAnnounceLaneTransitionRight,
423        kAnnounceRightLaneEnd,
424        kAnnounceLeftLaneEnd,
425        kAnnounceRightLaneBegin,
426        kAnnounceLeftLaneBegin,
427        kAnnounceLaneConsolidation,
428        kDetourCityBlock,
429        kGate,
430        kPoleWarning,
431        kTrafficCone,
432        kMobileLaneClosure,
433        kReflectorPost,
434        kDirectionalBoardWarning,
435        kGuidingPlate,
436        kGuidingPlateWedges,
437        kParkingHazard,
438        kTrafficLightGreenArrow,
439        kText,
440        kSpace,
441        kTime,
442        kArrow,
443        kConstrainedTo,
444        kExcept,
445        kValidForDistance,
446        kPriorityRoadBottomLeftFourWay,
447        kPriorityRoadTopLeftFourWay,
448        kPriorityRoadBottomLeftThreeWayStraight,
449        kPriorityRoadBottomLeftThreeWaySideways,
450        kPriorityRoadTopLeftThreeWayStraight,
451        kPriorityRoadBottomRightFourWay,
452        kPriorityRoadTopRightFourWay,
453        kPriorityRoadBottomRightThreeWayStraight,
454        kPriorityRoadBottomRightThreeWaySideway,
455        kPriorityRoadTopRightThreeWayStraight,
456        kValidInDistance,
457        kStopIn,
458        kLeftArrow,
459        kLeftBendArrow,
460        kRightArrow,
461        kRightBendArrow,
462        kAccident,
463        kSnow,
464        kFog,
465        kRollingHighwayInformation,
466        kServices,
467        kTimeRange,
468        kParkingDiscTimeRestriction,
469        kWeight,
470        kWet,
471        kParkingConstraint,
472        kNoWaitingSideStripes,
473        kRain,
474        kSnowRain,
475        kNight,
476        kStop4Way,
477        kTruck,
478        kTractorsMayBePassed,
479        kHazardous,
480        kTrailer,
481        kZone,
482        kMotorcycle,
483        kMotorcycleAllowed,
484        kCar,
485        kEmergencyLane,
486        kUnknown,
487    }
488
489    #[repr(i32)]
490    enum TrafficSignValueUnit {
491        kMetersPerSecond = 0,
492        kKilometersPerHour,
493        kMilesPerHour,
494        kMeters,
495        kKilometers,
496        kFeet,
497        kMiles,
498        kPercent,
499        kKilograms,
500        kMetricTons,
501    }
502
503    unsafe extern "C++" {
504        include!("api/rules/rules.h");
505        include!("api/rules/aliases.h");
506        include!("cxx_utils/error_handling.h");
507
508        // Forward declarations
509        #[namespace = "maliput::api"]
510        type InertialPosition = crate::api::ffi::InertialPosition;
511        #[namespace = "maliput::api"]
512        type Rotation = crate::api::ffi::Rotation;
513        #[namespace = "maliput::api"]
514        type LaneSRange = crate::api::ffi::LaneSRange;
515        #[namespace = "maliput::api"]
516        type LaneSRoute = crate::api::ffi::LaneSRoute;
517        #[namespace = "maliput::api"]
518        type RoadPosition = crate::api::ffi::RoadPosition;
519        #[namespace = "maliput::math"]
520        type Vector3 = crate::math::ffi::Vector3;
521        #[namespace = "maliput::math"]
522        type RollPitchYaw = crate::math::ffi::RollPitchYaw;
523        #[namespace = "maliput::math"]
524        type BoundingBox = crate::math::ffi::BoundingBox;
525
526        // TrafficLightBook bindings definitions.
527        type TrafficLightBook;
528        fn TrafficLightBook_TrafficLights(book: &TrafficLightBook) -> UniquePtr<CxxVector<ConstTrafficLightPtr>>;
529        fn TrafficLightBook_GetTrafficLight(book: &TrafficLightBook, id: &String) -> *const TrafficLight;
530        fn TrafficLightBook_FindByLane(
531            book: &TrafficLightBook,
532            lane_id: &String,
533        ) -> UniquePtr<CxxVector<ConstTrafficLightPtr>>;
534
535        // TrafficLight bindings definitions.
536        type TrafficLight;
537        fn TrafficLight_id(traffic_light: &TrafficLight) -> String;
538        fn TrafficLight_position_road_network(traffic_light: &TrafficLight) -> UniquePtr<InertialPosition>;
539        fn TrafficLight_orientation_road_network(traffic_light: &TrafficLight) -> UniquePtr<Rotation>;
540        fn TrafficLight_bulb_groups(traffic_light: &TrafficLight) -> UniquePtr<CxxVector<ConstBulbGroupPtr>>;
541        fn TrafficLight_GetBulbGroup(traffic_light: &TrafficLight, id: &String) -> *const BulbGroup;
542        fn TrafficLight_related_lanes(traffic_light: &TrafficLight) -> Vec<String>;
543
544        // TrafficSignBook bindings definitions.
545        type TrafficSignBook;
546        type TrafficSignValueUnit;
547        fn TrafficSignBook_TrafficSigns(book: &TrafficSignBook) -> UniquePtr<CxxVector<ConstTrafficSignPtr>>;
548        fn TrafficSignBook_GetTrafficSign(book: &TrafficSignBook, id: &String) -> *const TrafficSign;
549        fn TrafficSignBook_FindByLane(
550            book: &TrafficSignBook,
551            lane_id: &String,
552        ) -> UniquePtr<CxxVector<ConstTrafficSignPtr>>;
553        fn TrafficSignBook_FindByType(
554            book: &TrafficSignBook,
555            sign_type: TrafficControlDeviceType,
556        ) -> UniquePtr<CxxVector<ConstTrafficSignPtr>>;
557
558        // TrafficSign bindings definitions.
559        type TrafficSign;
560        fn TrafficSign_id(sign: &TrafficSign) -> String;
561        // This method could be bound as `fn type(self: &TrafficSign) -> TrafficSignType` but it causes a conflict with the `type` keyword in Rust.
562        fn TrafficSign_type(sign: &TrafficSign) -> TrafficControlDeviceType;
563        fn TrafficSign_position_road_network(sign: &TrafficSign) -> UniquePtr<InertialPosition>;
564        fn TrafficSign_orientation_road_network(sign: &TrafficSign) -> UniquePtr<Rotation>;
565        fn TrafficSign_message(sign: &TrafficSign) -> UniquePtr<StringWrapper>;
566        fn is_dynamic(self: &TrafficSign) -> bool;
567        fn is_movable(self: &TrafficSign) -> bool;
568        fn TrafficSign_related_lanes(sign: &TrafficSign) -> Vec<String>;
569        fn TrafficSign_dependent_signs(sign: &TrafficSign) -> Vec<String>;
570        fn TrafficSign_bounding_box(sign: &TrafficSign) -> UniquePtr<BoundingBox>;
571        fn TrafficSign_value(sign: &TrafficSign) -> TrafficSignValueData;
572        fn TrafficSign_properties(sign: &TrafficSign) -> Vec<StringPair>;
573
574        type BulbColor;
575        type BulbState;
576        type BulbType;
577        // Bulb bindings definitions.
578        type Bulb;
579        fn Bulb_id(bulb: &Bulb) -> String;
580        fn Bulb_unique_id(bulb: &Bulb) -> UniquePtr<UniqueBulbId>;
581        fn Bulb_position_bulb_group(bulb: &Bulb) -> UniquePtr<InertialPosition>;
582        fn Bulb_orientation_bulb_group(bulb: &Bulb) -> UniquePtr<Rotation>;
583        fn color(self: &Bulb) -> &BulbColor;
584        // We can't automatically use the name `type` as it is a reserved keyword in Rust.
585        fn Bulb_type(bulb: &Bulb) -> &BulbType;
586        fn Bulb_arrow_orientation_rad(bulb: &Bulb) -> UniquePtr<FloatWrapper>;
587        fn Bulb_states(bulb: &Bulb) -> UniquePtr<CxxVector<BulbState>>;
588        fn GetDefaultState(self: &Bulb) -> BulbState;
589        fn IsValidState(self: &Bulb, state: &BulbState) -> bool;
590        fn Bulb_bounding_box_min(bulb: &Bulb) -> UniquePtr<Vector3>;
591        fn Bulb_bounding_box_max(bulb: &Bulb) -> UniquePtr<Vector3>;
592        fn Bulb_bulb_group(bulb: &Bulb) -> *const BulbGroup;
593
594        // BulbGroup bindings definitions.
595        type BulbGroup;
596        fn BulbGroup_id(bulb_group: &BulbGroup) -> String;
597        fn BulbGroup_unique_id(bulb: &BulbGroup) -> UniquePtr<UniqueBulbGroupId>;
598        fn BulbGroup_position_traffic_light(bulb_group: &BulbGroup) -> UniquePtr<InertialPosition>;
599        fn BulbGroup_orientation_traffic_light(bulb_group: &BulbGroup) -> UniquePtr<Rotation>;
600        fn BulbGroup_bulbs(bulb_group: &BulbGroup) -> UniquePtr<CxxVector<ConstBulbPtr>>;
601        fn BulbGroup_GetBulb(bulb_group: &BulbGroup, id: &String) -> *const Bulb;
602        fn BulbGroup_traffic_light(bulb_group: &BulbGroup) -> *const TrafficLight;
603
604        // UniqueBulbId bindings definitions.
605        type UniqueBulbId;
606        fn string(self: &UniqueBulbId) -> &CxxString;
607        fn UniqueBulbId_traffic_light_id(id: &UniqueBulbId) -> String;
608        fn UniqueBulbId_bulb_group_id(id: &UniqueBulbId) -> String;
609        fn UniqueBulbId_bulb_id(id: &UniqueBulbId) -> String;
610        fn UniqueBulbId_create_unique_ptr(id: &UniqueBulbId) -> UniquePtr<UniqueBulbId>;
611
612        // UniqueBulbGroupId bindings definitions.
613        type UniqueBulbGroupId;
614        fn string(self: &UniqueBulbGroupId) -> &CxxString;
615        fn UniqueBulbGroupId_traffic_light_id(id: &UniqueBulbGroupId) -> String;
616        fn UniqueBulbGroupId_bulb_group_id(id: &UniqueBulbGroupId) -> String;
617
618        // QueryResults bindings definitions.
619        type QueryResults;
620        fn QueryResults_discrete_value_rules(query_results: &QueryResults) -> Vec<String>;
621        fn QueryResults_range_value_rules(query_results: &QueryResults) -> Vec<String>;
622
623        // RoadRulebook bindings definitions.
624        type RoadRulebook;
625        fn RoadRulebook_GetDiscreteValueRule(book: &RoadRulebook, rule_id: &String) -> UniquePtr<DiscreteValueRule>;
626        fn RoadRulebook_GetRangeValueRule(book: &RoadRulebook, rule_id: &String) -> UniquePtr<RangeValueRule>;
627        fn RoadRulebook_Rules(book: &RoadRulebook) -> UniquePtr<QueryResults>;
628        #[allow(clippy::needless_lifetimes)]
629        fn RoadRulebook_FindRules(
630            book: &RoadRulebook,
631            ranges: &Vec<ConstLaneSRangeRef>,
632            tolerance: f64,
633        ) -> Result<UniquePtr<QueryResults>>;
634
635        // DiscreteValueRule::DiscreteValue bindings definitions.
636        type DiscreteValueRuleDiscreteValue;
637        fn DiscreteValueRuleDiscreteValue_value(value: &DiscreteValueRuleDiscreteValue) -> String;
638        fn DiscreteValueRuleDiscreteValue_severity(value: &DiscreteValueRuleDiscreteValue) -> i32;
639        fn DiscreteValueRuleDiscreteValue_related_rules(
640            value: &DiscreteValueRuleDiscreteValue,
641        ) -> UniquePtr<CxxVector<RelatedRule>>;
642        fn DiscreteValueRuleDiscreteValue_related_unique_ids(
643            value: &DiscreteValueRuleDiscreteValue,
644        ) -> UniquePtr<CxxVector<RelatedUniqueId>>;
645
646        // DiscreteValueRule bindings definitions.
647        type DiscreteValueRule;
648        fn states(self: &DiscreteValueRule) -> &CxxVector<DiscreteValueRuleDiscreteValue>;
649        fn DiscreteValueRule_id(rule: &DiscreteValueRule) -> String;
650        fn DiscreteValueRule_type_id(rule: &DiscreteValueRule) -> String;
651        fn DiscreteValueRule_zone(rule: &DiscreteValueRule) -> UniquePtr<LaneSRoute>;
652
653        // RangeValueRule::Range bindings definitions.
654        type RangeValueRuleRange;
655        fn RangeValueRuleRange_description(range: &RangeValueRuleRange) -> String;
656        fn RangeValueRuleRange_min(range: &RangeValueRuleRange) -> f64;
657        fn RangeValueRuleRange_max(range: &RangeValueRuleRange) -> f64;
658        fn RangeValueRuleRange_severity(range: &RangeValueRuleRange) -> i32;
659        fn RangeValueRuleRange_related_rules(range: &RangeValueRuleRange) -> UniquePtr<CxxVector<RelatedRule>>;
660        fn RangeValueRuleRange_related_unique_ids(range: &RangeValueRuleRange)
661            -> UniquePtr<CxxVector<RelatedUniqueId>>;
662        // RangeValueRule::Range bindings definitions.
663        type RangeValueRule;
664        fn RangeValueRule_id(rule: &RangeValueRule) -> String;
665        fn RangeValueRule_type_id(rule: &RangeValueRule) -> String;
666        fn RangeValueRule_zone(rule: &RangeValueRule) -> UniquePtr<LaneSRoute>;
667        fn states(self: &RangeValueRule) -> &CxxVector<RangeValueRuleRange>;
668
669        // Phase bindings definitions.
670        type Phase;
671        fn Phase_id(phase: &Phase) -> String;
672        fn Phase_discrete_value_rule_states(phase: &Phase) -> UniquePtr<CxxVector<DiscreteValueRuleState>>;
673        fn Phase_unique_bulb_ids(phase: &Phase) -> UniquePtr<CxxVector<UniqueBulbId>>;
674        fn Phase_bulb_state(phase: &Phase, bulb_id: &UniqueBulbId) -> UniquePtr<BulbState>;
675        // Helper method to implement [Phase_unique_bulb_ids] API method.
676        fn ptr_from_unique_bulb_id(id: &UniqueBulbId) -> UniquePtr<UniqueBulbId>;
677
678        // PhaseRing bindings definitions.
679        type PhaseRing;
680        fn PhaseRing_id(phase_ring: &PhaseRing) -> String;
681        fn PhaseRing_GetPhase(phase_ring: &PhaseRing, id: &String) -> UniquePtr<Phase>;
682        fn PhaseRing_phases_ids(phase_ring: &PhaseRing) -> Vec<String>;
683        fn PhaseRing_GetNextPhases(phase_ring: &PhaseRing, id: &String) -> Result<UniquePtr<CxxVector<NextPhase>>>;
684
685        // StateProviderResult<Phase::Id> bindings definitions.
686        type PhaseStateProviderQuery;
687        fn PhaseStateProvider_state(phase_state_provider: &PhaseStateProviderQuery) -> String;
688        fn PhaseStateProvider_next(phase_state_provider: &PhaseStateProviderQuery) -> UniquePtr<NextPhase>;
689
690        // PhaseProvider bindings definitions.
691        type PhaseProvider;
692        fn PhaseProvider_GetPhase(
693            phase_provider: &PhaseProvider,
694            phase_ring_id: &String,
695        ) -> UniquePtr<PhaseStateProviderQuery>;
696
697        // PhaseRingBook bindings definitions.
698        type PhaseRingBook;
699        fn PhaseRingBook_GetPhaseRingsId(book: &PhaseRingBook) -> Vec<String>;
700        fn PhaseRingBook_GetPhaseRing(book: &PhaseRingBook, id: &String) -> UniquePtr<PhaseRing>;
701        fn PhaseRingBook_FindPhaseRing(book: &PhaseRingBook, rule_id: &String) -> UniquePtr<PhaseRing>;
702
703        // RuleRegistry bindings definitions.
704        type RuleRegistry;
705        fn RuleRegistry_DiscreteValueRuleTypes(registry: &RuleRegistry) -> UniquePtr<CxxVector<DiscreteValueRuleType>>;
706        fn RuleRegistry_RangeValueRuleTypes(registry: &RuleRegistry) -> UniquePtr<CxxVector<RangeValueRuleType>>;
707
708        // DiscreteValueRuleStateProviderQuery bindings definitions.
709        type DiscreteValueRuleStateProviderQuery;
710        fn DiscreteValueRuleStateProviderQuery_state(
711            state_provider_query: &DiscreteValueRuleStateProviderQuery,
712        ) -> UniquePtr<DiscreteValueRuleDiscreteValue>;
713        fn DiscreteValueRuleStateProviderQuery_next(
714            state_provider_query: &DiscreteValueRuleStateProviderQuery,
715        ) -> UniquePtr<DiscreteValueNextState>;
716
717        // DiscreteValueRuleStateProvider bindings definitions.
718        type DiscreteValueRuleStateProvider;
719        fn DiscreteValueRuleStateProvider_GetStateById(
720            state_provider: &DiscreteValueRuleStateProvider,
721            id: &String,
722        ) -> UniquePtr<DiscreteValueRuleStateProviderQuery>;
723        fn DiscreteValueRuleStateProvider_GetStateByType(
724            state_provider: &DiscreteValueRuleStateProvider,
725            road_position: &RoadPosition,
726            rule_type: &String,
727            tolerance: f64,
728        ) -> UniquePtr<DiscreteValueRuleStateProviderQuery>;
729
730        // RangeValueRuleStateProviderQuery bindings definitions.
731        type RangeValueRuleStateProviderQuery;
732        fn RangeValueRuleStateProviderQuery_state(
733            state_provider_query: &RangeValueRuleStateProviderQuery,
734        ) -> UniquePtr<RangeValueRuleRange>;
735        fn RangeValueRuleStateProviderQuery_next(
736            state_provider_query: &RangeValueRuleStateProviderQuery,
737        ) -> UniquePtr<RangeValueNextState>;
738
739        // RangeValueRuleStateProvider bindings definitions.
740        type RangeValueRuleStateProvider;
741        fn RangeValueRuleStateProvider_GetStateById(
742            state_provider: &RangeValueRuleStateProvider,
743            id: &String,
744        ) -> UniquePtr<RangeValueRuleStateProviderQuery>;
745        fn RangeValueRuleStateProvider_GetStateByType(
746            state_provider: &RangeValueRuleStateProvider,
747            road_position: &RoadPosition,
748            rule_type: &String,
749            tolerance: f64,
750        ) -> UniquePtr<RangeValueRuleStateProviderQuery>;
751    }
752}