diff --git a/include/adc_geometries.h b/include/adc_geometries.h index f417953cd7a5b953f007d52ecf0f1e5287160115..da81a0ea4a1d05734e1e428baea2addb8ca46fa2 100644 --- a/include/adc_geometries.h +++ b/include/adc_geometries.h @@ -52,6 +52,14 @@ class CAdcGeometry */ CAdcGeometry(); + /** + * \brief Copy constructor. + * + * \param geometry The objecto to copy. + * + */ + CAdcGeometry(const CAdcGeometry &geometry); + /** * \brief Class constructor. * @@ -74,6 +82,12 @@ class CAdcGeometry */ virtual ~CAdcGeometry(); + /** + * \brief assign operator = overload + * + */ + void operator = (const CAdcGeometry &geometry); + /** * \brief Function to transform from track coordenatos to world coordenates. * @@ -162,6 +176,14 @@ class CAdcGeoLine: public CAdcGeometry */ CAdcGeoLine(); + /** + * \brief Copy constructor. + * + * \param line The objecto to copy. + * + */ + CAdcGeoLine(const CAdcGeoLine &line); + /** * \brief Class constructor with the common geometry parameters. * @@ -183,6 +205,12 @@ class CAdcGeoLine: public CAdcGeometry * */ ~CAdcGeoLine(); + + /** + * \brief assign operator = overload + * + */ + void operator = (const CAdcGeoLine &line); }; @@ -236,6 +264,14 @@ class CAdcGeoSpiral: public CAdcGeometry */ CAdcGeoSpiral(); + /** + * \brief Copy constructor. + * + * \param spiral The objecto to copy. + * + */ + CAdcGeoSpiral(const CAdcGeoSpiral &spiral); + /** * \brief Class constructor with the common geometry parameters. * @@ -278,6 +314,12 @@ class CAdcGeoSpiral: public CAdcGeometry */ ~CAdcGeoSpiral(); + /** + * \brief assign operator = overload + * + */ + void operator = (const CAdcGeoSpiral &spiral); + /** * \brief Fu nction to seet the specific geometry parameters. * @@ -337,6 +379,14 @@ class CAdcGeoArc: public CAdcGeometry */ CAdcGeoArc(); + /** + * \brief Copy constructor. + * + * \param arc The objecto to copy. + * + */ + CAdcGeoArc(const CAdcGeoArc &arc); + /** * \brief Class constructor with the common geometry parameters. * @@ -376,6 +426,12 @@ class CAdcGeoArc: public CAdcGeometry */ ~CAdcGeoArc(); + /** + * \brief assign operator = overload + * + */ + void operator = (const CAdcGeoArc &arc); + /** * \brief Fu nction to seet the specific geometry parameters. * @@ -449,6 +505,13 @@ class CAdcGeoPoly3: public CAdcGeometry */ CAdcGeoPoly3(); + /** + * \brief Copy constructor. + * + * \param poly3 The objecto to copy. + * + */ + CAdcGeoPoly3(const CAdcGeoPoly3 &poly3); /** * \brief Class constructor with the common geometry parameters. * @@ -488,6 +551,12 @@ class CAdcGeoPoly3: public CAdcGeometry */ ~CAdcGeoPoly3(); + /** + * \brief assign operator = overload + * + */ + void operator = (const CAdcGeoPoly3 &poly3); + /** * \brief Fu nction to seet the specific geometry parameters. * @@ -547,6 +616,14 @@ class CAdcGeoParamPoly3: public CAdcGeometry */ CAdcGeoParamPoly3(); + /** + * \brief Copy constructor. + * + * \param parampoly3 The objecto to copy. + * + */ + CAdcGeoParamPoly3(const CAdcGeoParamPoly3 ¶mpoly3); + /** * \brief Class constructor with the common geometry parameters. * @@ -591,6 +668,12 @@ class CAdcGeoParamPoly3: public CAdcGeometry */ ~CAdcGeoParamPoly3(); + /** + * \brief assign operator = overload + * + */ + void operator = (const CAdcGeoParamPoly3 ¶mpoly3); + /** * \brief Fu nction to seet the specific geometry parameters. * diff --git a/include/adc_road.h b/include/adc_road.h index 2cb53c684fc23bb05e789632cd153532924ca534..15d3be031fee6615f1b80d56e72a4db075e742e5 100644 --- a/include/adc_road.h +++ b/include/adc_road.h @@ -31,6 +31,12 @@ class CAdcRoad */ CAdcRoad(); + /** + * \brief Copy constructor. + * + */ + CAdcRoad(const CAdcRoad &road); + /** * \brief Default constructor. * @@ -49,6 +55,12 @@ class CAdcRoad */ ~CAdcRoad(); + /** + * \brief assign operator = overload + * + */ + void operator = (const CAdcRoad &road); + /** * \brief Function to clear geometries. * diff --git a/include/adc_signals.h b/include/adc_signals.h index ad7161ae35efde05128d4088e603fe4d67f1d085..12147c4ede0c220014c583118cddd5f6f9966701 100644 --- a/include/adc_signals.h +++ b/include/adc_signals.h @@ -87,6 +87,14 @@ class CAdcSignals */ CAdcSignals(); + /** + * \brief Default constructor. + * + * It calls CAdcSignals::set_urdf_map function. + * + */ + CAdcSignals(const CAdcSignals &signal); + /** * \brief Class constructor. * @@ -119,6 +127,12 @@ class CAdcSignals */ ~CAdcSignals(); + /** + * \brief assign operator = overload + * + */ + void operator = (const CAdcSignals &signal); + /** * \brief Function to get signal's id. * diff --git a/src/adc_geometries.cpp b/src/adc_geometries.cpp index f4256cef8c5367058c3949a37cc5b3602334bf2e..c6e5219c9c4b187a99c880d7ee1a33ab37af4aee 100644 --- a/src/adc_geometries.cpp +++ b/src/adc_geometries.cpp @@ -12,14 +12,15 @@ CAdcGeometry::CAdcGeometry() this->heading = 0.0; } -CAdcGeometry::~CAdcGeometry() +CAdcGeometry::CAdcGeometry(const CAdcGeometry &geometry) { - this->min_s = 0.0; - this->max_s = 0.0; - this->x = 0.0; - this->y = 0.0; - this->heading = 0.0; + this->min_s = geometry.min_s; + this->max_s = geometry.max_s; + this->x = geometry.x; + this->y = geometry.y; + this->heading = geometry.heading; } + CAdcGeometry::CAdcGeometry(double min_s, double max_s, double x, double y, double heading) { this->min_s = min_s; @@ -29,6 +30,24 @@ CAdcGeometry::CAdcGeometry(double min_s, double max_s, double x, double y, doubl this->heading = heading; } +CAdcGeometry::~CAdcGeometry() +{ + this->min_s = 0.0; + this->max_s = 0.0; + this->x = 0.0; + this->y = 0.0; + this->heading = 0.0; +} + +void CAdcGeometry::operator = (const CAdcGeometry &geometry) +{ + this->min_s = geometry.min_s; + this->max_s = geometry.max_s; + this->x = geometry.x; + this->y = geometry.y; + this->heading = geometry.heading; +} + bool CAdcGeometry::get_world_pose(double s, double t, double heading, double &x, double &y, double &yaw) { double local_u, local_v, local_yaw; @@ -63,7 +82,8 @@ CAdcGeoLine::CAdcGeoLine() } -CAdcGeoLine::~CAdcGeoLine() +CAdcGeoLine::CAdcGeoLine(const CAdcGeoLine &line): +CAdcGeometry(line) { } @@ -74,6 +94,16 @@ CAdcGeometry(min_s, max_s, x, y, heading) } +CAdcGeoLine::~CAdcGeoLine() +{ + +} + +void CAdcGeoLine::operator = (const CAdcGeoLine &line) +{ + CAdcGeometry::operator = (line); +} + bool CAdcGeoLine::get_local_pose(double s, double t, double heading, double &u, double &v, double &yaw) { u = s - this->min_s; @@ -95,10 +125,11 @@ CAdcGeoSpiral::CAdcGeoSpiral() this->curv_end = 0.0; } -CAdcGeoSpiral::~CAdcGeoSpiral() +CAdcGeoSpiral::CAdcGeoSpiral(const CAdcGeoSpiral &spiral): +CAdcGeometry(spiral) { - this->curv_start = 0.0; - this->curv_end = 0.0; + this->curv_start = spiral.curv_start; + this->curv_end = spiral.curv_end; } CAdcGeoSpiral::CAdcGeoSpiral(double min_s, double max_s, double x, double y, double heading): @@ -114,6 +145,19 @@ CAdcGeometry(min_s, max_s, x, y, heading) this->curv_end = curv_end; } +CAdcGeoSpiral::~CAdcGeoSpiral() +{ + this->curv_start = 0.0; + this->curv_end = 0.0; +} + +void CAdcGeoSpiral::operator = (const CAdcGeoSpiral &spiral) +{ + CAdcGeometry::operator = (spiral); + this->curv_start = spiral.curv_start; + this->curv_end = spiral.curv_end; +} + void CAdcGeoSpiral::set_params(double curv_start, double curv_end) { this->curv_start = curv_start; @@ -141,9 +185,10 @@ CAdcGeoArc::CAdcGeoArc() this->curvature = 0.0; } -CAdcGeoArc::~CAdcGeoArc() +CAdcGeoArc::CAdcGeoArc(const CAdcGeoArc &arc): +CAdcGeometry(arc) { - this->curvature = 0.0; + this->curvature = arc.curvature; } CAdcGeoArc::CAdcGeoArc(double min_s, double max_s, double x, double y, double heading): @@ -158,6 +203,17 @@ CAdcGeometry(min_s, max_s, x, y, heading) this->curvature = curvature; } +CAdcGeoArc::~CAdcGeoArc() +{ + this->curvature = 0.0; +} + +void CAdcGeoArc::operator = (const CAdcGeoArc &arc) +{ + CAdcGeometry::operator = (arc); + this->curvature = arc.curvature; +} + void CAdcGeoArc::set_params(double curvature) { this->curvature = curvature; @@ -189,12 +245,13 @@ CAdcGeoPoly3::CAdcGeoPoly3() this->param.d = 0.0; } -CAdcGeoPoly3::~CAdcGeoPoly3() +CAdcGeoPoly3::CAdcGeoPoly3(const CAdcGeoPoly3 &poly3): +CAdcGeometry(poly3) { - this->param.a = 0.0; - this->param.b = 0.0; - this->param.c = 0.0; - this->param.d = 0.0; + this->param.a = poly3.param.a; + this->param.b = poly3.param.b; + this->param.c = poly3.param.c; + this->param.d = poly3.param.d; } CAdcGeoPoly3::CAdcGeoPoly3(double min_s, double max_s, double x, double y, double heading): @@ -212,6 +269,23 @@ CAdcGeometry(min_s, max_s, x, y, heading) this->param.d = param.d; } +CAdcGeoPoly3::~CAdcGeoPoly3() +{ + this->param.a = 0.0; + this->param.b = 0.0; + this->param.c = 0.0; + this->param.d = 0.0; +} + +void CAdcGeoPoly3::operator = (const CAdcGeoPoly3 &poly3) +{ + CAdcGeometry::operator = (poly3); + this->param.a = poly3.param.a; + this->param.b = poly3.param.b; + this->param.c = poly3.param.c; + this->param.d = poly3.param.d; +} + void CAdcGeoPoly3::set_params(Adc_poly3_param param) { this->param.a = param.a; @@ -249,17 +323,18 @@ CAdcGeoParamPoly3::CAdcGeoParamPoly3() this->normalized = true; } -CAdcGeoParamPoly3::~CAdcGeoParamPoly3() +CAdcGeoParamPoly3::CAdcGeoParamPoly3(const CAdcGeoParamPoly3 ¶mpoly3): +CAdcGeometry(parampoly3) { - this->u_param.a = 0.0; - this->u_param.b = 0.0; - this->u_param.c = 0.0; - this->u_param.d = 0.0; - this->v_param.a = 0.0; - this->v_param.b = 0.0; - this->v_param.c = 0.0; - this->v_param.d = 0.0; - this->normalized = true; + this->u_param.a = parampoly3.u_param.a; + this->u_param.b = parampoly3.u_param.b; + this->u_param.c = parampoly3.u_param.c; + this->u_param.d = parampoly3.u_param.d; + this->v_param.a = parampoly3.v_param.a; + this->v_param.b = parampoly3.v_param.b; + this->v_param.c = parampoly3.v_param.c; + this->v_param.d = parampoly3.v_param.d; + this->normalized = parampoly3.normalized; } CAdcGeoParamPoly3::CAdcGeoParamPoly3(double min_s, double max_s, double x, double y, double heading): @@ -282,6 +357,33 @@ CAdcGeometry(min_s, max_s, x, y, heading) this->normalized = normalized; } +CAdcGeoParamPoly3::~CAdcGeoParamPoly3() +{ + this->u_param.a = 0.0; + this->u_param.b = 0.0; + this->u_param.c = 0.0; + this->u_param.d = 0.0; + this->v_param.a = 0.0; + this->v_param.b = 0.0; + this->v_param.c = 0.0; + this->v_param.d = 0.0; + this->normalized = true; +} + +void CAdcGeoParamPoly3::operator = (const CAdcGeoParamPoly3 ¶mpoly3) +{ + CAdcGeometry::operator = (parampoly3); + this->u_param.a = parampoly3.u_param.a; + this->u_param.b = parampoly3.u_param.b; + this->u_param.c = parampoly3.u_param.c; + this->u_param.d = parampoly3.u_param.d; + this->v_param.a = parampoly3.v_param.a; + this->v_param.b = parampoly3.v_param.b; + this->v_param.c = parampoly3.v_param.c; + this->v_param.d = parampoly3.v_param.d; + this->normalized = parampoly3.normalized; +} + void CAdcGeoParamPoly3::set_params(Adc_poly3_param u_param, Adc_poly3_param v_param, bool normalized) { this->u_param.a = u_param.a; diff --git a/src/adc_road.cpp b/src/adc_road.cpp index cf5d4d10ebcf0fd431121daa143fc8762ff42708..d9a8610f0be2ebfa1ef3cb17fe63b13483030c24 100644 --- a/src/adc_road.cpp +++ b/src/adc_road.cpp @@ -16,6 +16,15 @@ CAdcRoad::CAdcRoad(int id, double length, std::string name) this->name = name; } +CAdcRoad::CAdcRoad(const CAdcRoad &road) +{ + this->id = road.id; + this->length = road.length; + this->name = road.name; + this->signals = road.signals; + this->geometries = road.geometries; +} + CAdcRoad::~CAdcRoad() { // std::cout << "road destructor " << this->id << std::endl; @@ -26,6 +35,15 @@ CAdcRoad::~CAdcRoad() clear_signals(); } +void CAdcRoad::operator = (const CAdcRoad &road) +{ + this->id = road.id; + this->length = road.length; + this->name = road.name; + this->signals = road.signals; + this->geometries = road.geometries; +} + void CAdcRoad::clear_geometries(void) { // for (unsigned int i = 0; i < this->geometries.size(); i++) diff --git a/src/adc_signals.cpp b/src/adc_signals.cpp index c61f8e9a639087dac325513a93f0d39440a5f543..932e81dd3cfd86a31016f74d86a938468ebb7277 100644 --- a/src/adc_signals.cpp +++ b/src/adc_signals.cpp @@ -38,6 +38,21 @@ CAdcSignals::~CAdcSignals() this->text = ""; } +CAdcSignals::CAdcSignals(const CAdcSignals & signal) +{ + this->id = signal.id; + this->s = signal.s; + this->t = signal.t; + this->heading = signal.heading; + this->type = signal.type; + this->sub_type = signal.sub_type; + this->value = signal.value; + this->text = signal.text; + this->world_x = signal.world_x; + this->world_y = signal.world_y; + this->world_yaw = signal.world_yaw; +} + CAdcSignals::CAdcSignals(int id, double s, double t, double heading, std::string type, std::string sub_type, int value, std::string text, bool reverse) { this->id = id; @@ -53,6 +68,22 @@ CAdcSignals::CAdcSignals(int id, double s, double t, double heading, std::string this->world_yaw = 0; set_urdf_map(); } + +void CAdcSignals::operator = (const CAdcSignals &signal) +{ + this->id = signal.id; + this->s = signal.s; + this->t = signal.t; + this->heading = signal.heading; + this->type = signal.type; + this->sub_type = signal.sub_type; + this->value = signal.value; + this->text = signal.text; + this->world_x = signal.world_x; + this->world_y = signal.world_y; + this->world_yaw = signal.world_yaw; +} + void CAdcSignals::set_urdf_map(void) { if (urdf_map.size() == 0)