All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TransportNodeId.h
1 #pragma once
2 
3 #include "Transport.h"
4 #include "TiledGraphNode.h"
5 
6 namespace Eegeo
7 {
8  namespace Transport
9  {
11  {
13  : CellKey(Streaming::MortonKey(0))
14  , LocalNodeId(-1)
15  , TransportNetworkType(TransportNetwork::TransportRoad)
16  {}
17 
19  TransportNetwork::Type transportNetworkType,
20  const Streaming::MortonKey& cellKey,
21  TransportLocalNodeId localNodeId
22  )
23  : CellKey(cellKey)
24  , LocalNodeId(localNodeId)
25  , TransportNetworkType(transportNetworkType)
26  {}
27 
29  TransportNetwork::Type transportNetworkType,
30  const Graphs::TiledGraphNodeId& graphNodeId
31  )
32  : CellKey(graphNodeId.CellKey)
33  , LocalNodeId(graphNodeId.LocalNodeId)
34  , TransportNetworkType(transportNetworkType)
35  {}
36 
37  Streaming::MortonKey CellKey;
38  TransportLocalNodeId LocalNodeId;
39  TransportNetwork::Type TransportNetworkType;
40  };
41 
42  inline bool operator == (const TransportNodeId& lhs, const TransportNodeId& rhs)
43  {
44  return (lhs.LocalNodeId == rhs.LocalNodeId) &&
45  (lhs.CellKey == rhs.CellKey) &&
46  (lhs.TransportNetworkType == rhs.TransportNetworkType);
47  }
48 
49 
51  {
52  std::size_t operator()(const TransportNodeId& nodeId) const
53  {
54  std::size_t h1 = Eegeo::Streaming::MortonKeyHash{}(nodeId.CellKey);
55  std::size_t h2 = std::hash<int>{}(nodeId.LocalNodeId);
56  std::size_t h3 = std::hash<int>{}(nodeId.TransportNetworkType);
57  return (h1 ^ (h2 << 1)) ^ (h3 << 1);
58  }
59  };
60  }
61 }