]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/commitdiff
Overload << for bicycle car
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Thu, 25 Jul 2019 15:13:43 +0000 (17:13 +0200)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Thu, 25 Jul 2019 15:13:43 +0000 (17:13 +0200)
api/bcar.h

index bddb18945e410ea199314925653d273c1dbc2557..82c2672aea3a4cd87536854c3ca974425bb8b46c 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef BCAR_H
 #define BCAR_H
 
+#include <ostream>
+
 /*! \brief Bicycle car basic class.
 
 This class contains some geometrical computations of bicycle car.
@@ -142,6 +144,17 @@ class BicycleCar {
                 void st(double st) { this->st_ = st; }
 
                 BicycleCar();
+                friend std::ostream &operator<<(
+                        std::ostream &out,
+                        const BicycleCar &bc
+                )
+                {
+                        out << "[" << bc.x();
+                        out << "," << bc.y();
+                        out << "," << bc.h();
+                        out << "]";
+                        return out;
+                }
 };
 
 #endif /* BCAR_H */