Adding a macro DECLARE_VISITOR_AND_DEBUG_PRINT and using it at transit.

This commit is contained in:
Vladimir Byko-Ianko 2017-10-03 18:29:59 +03:00 committed by Vladimir Byko-Ianko
parent ab949b13df
commit 64605a8d85
2 changed files with 18 additions and 16 deletions

View file

@ -50,3 +50,7 @@ private:
c.Visit(visitor); \
return visitor.ToString(); \
}
#define DECLARE_VISITOR_AND_DEBUG_PRINT(className, ...) \
DECLARE_VISITOR(__VA_ARGS__) \
DECLARE_DEBUG_PRINT(className)

View file

@ -37,14 +37,12 @@ struct TransitHeader
void Reset();
bool IsEqualForTesting(TransitHeader const & header) const;
DECLARE_VISITOR(visitor(m_version, "m_version"), visitor(m_reserve, "m_reserve"),
visitor(m_gatesOffset, "m_gatesOffset"), visitor(m_edgesOffset, "m_edgesOffset"),
visitor(m_transfersOffset, "m_transfersOffset"),
visitor(m_linesOffset, "m_linesOffset"),
visitor(m_shapesOffset, "m_shapesOffset"),
visitor(m_networksOffset, "m_networksOffset"),
visitor(m_endOffset, "m_endOffset"))
DECLARE_DEBUG_PRINT(TransitHeader)
DECLARE_VISITOR_AND_DEBUG_PRINT(
TransitHeader, visitor(m_version, "m_version"), visitor(m_reserve, "m_reserve"),
visitor(m_gatesOffset, "m_gatesOffset"), visitor(m_edgesOffset, "m_edgesOffset"),
visitor(m_transfersOffset, "m_transfersOffset"), visitor(m_linesOffset, "m_linesOffset"),
visitor(m_shapesOffset, "m_shapesOffset"), visitor(m_networksOffset, "m_networksOffset"),
visitor(m_endOffset, "m_endOffset"))
uint16_t m_version;
uint16_t m_reserve;
@ -67,10 +65,9 @@ public:
m2::PointD const & point);
bool IsEqualForTesting(Stop const & stop) const;
DECLARE_VISITOR(visitor(m_id, "id"), visitor(m_featureId, "osm_id"),
visitor(m_transferId, "transfer_id"), visitor(m_lineIds, "line_ids"),
visitor(m_point, "point"))
DECLARE_DEBUG_PRINT(Stop)
DECLARE_VISITOR_AND_DEBUG_PRINT(Stop, visitor(m_id, "id"), visitor(m_featureId, "osm_id"),
visitor(m_transferId, "transfer_id"),
visitor(m_lineIds, "line_ids"), visitor(m_point, "point"))
private:
StopId m_id = kInvalidStopId;
@ -90,10 +87,11 @@ public:
std::vector<ShapeId> const & shapeIds);
bool IsEqualForTesting(Edge const & edge) const;
DECLARE_VISITOR(visitor(m_startStopId, "start_stop_id"), visitor(m_finishStopId, "finish_stop_id"),
visitor(m_weight, "weight"), visitor(m_lineId, "line_id"),
visitor(m_transfer, "transfer"), visitor(m_shapeIds, "shape_ids"))
DECLARE_DEBUG_PRINT(Edge)
DECLARE_VISITOR_AND_DEBUG_PRINT(Edge, visitor(m_startStopId, "start_stop_id"),
visitor(m_finishStopId, "finish_stop_id"),
visitor(m_weight, "weight"), visitor(m_lineId, "line_id"),
visitor(m_transfer, "transfer"), visitor(m_shapeIds, "shape_ids"))
private:
StopId m_startStopId = kInvalidStopId;