PointSimpleListSearcher2.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: PointSimpleListSearcher2.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: Simple ad-hoc 2-D point searcher.
6 > Created Time: 2017/05/25
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_POINT_SIMPLE_LIST_SEARCHER2_H
10 #define CUBBYFLOW_POINT_SIMPLE_LIST_SEARCHER2_H
11 
13 
14 namespace CubbyFlow
15 {
24  {
25  public:
27 
28  class Builder;
29 
32 
35 
44  void Build(const ConstArrayAccessor1<Vector2D>& points) override;
45 
54  void ForEachNearbyPoint(
55  const Vector2D& origin,
56  double radius,
57  const ForEachNearbyPointFunc& callback) const override;
58 
68  bool HasNearbyPoint(const Vector2D& origin, double radius) const override;
69 
76  PointNeighborSearcher2Ptr Clone() const override;
77 
80 
82  void Set(const PointSimpleListSearcher2& other);
83 
85  void Serialize(std::vector<uint8_t>* buffer) const override;
86 
88  void Deserialize(const std::vector<uint8_t>& buffer) override;
89 
91  static Builder GetBuilder();
92 
93  private:
94  std::vector<Vector2D> m_points;
95  };
96 
98  using PointSimpleListSearcher2Ptr = std::shared_ptr<PointSimpleListSearcher2>;
99 
104  {
105  public:
108 
111 
114  };
115 }
116 
117 #endif
PointSimpleListSearcher2Ptr MakeShared() const
Builds shared pointer of PointSimpleListSearcher2 instance.
void ForEachNearbyPoint(const Vector2D &origin, double radius, const ForEachNearbyPointFunc &callback) const override
void Deserialize(const std::vector< uint8_t > &buffer) override
Deserializes the neighbor searcher from the buffer.
std::function< void(size_t, const Vector2D &)> ForEachNearbyPointFunc
Definition: PointNeighborSearcher2.h:34
PointSimpleListSearcher2 Build() const
Builds PointSimpleListSearcher2 instance.
Simple ad-hoc 2-D point searcher.
Definition: PointSimpleListSearcher2.h:23
void Build(const ConstArrayAccessor1< Vector2D > &points) override
Builds internal structure for given points list.
#define CUBBYFLOW_NEIGHBOR_SEARCHER2_TYPE_NAME(DerivedClassName)
Definition: PointNeighborSearcher2.h:94
1-D read-only array accessor class.
Definition: ArrayAccessor1.h:185
Abstract base class for 2-D point neighbor searcher builders.
Definition: PointNeighborSearcher2.h:82
Definition: pybind11Utils.h:24
Abstract base class for 2-D neighbor point searcher.
Definition: PointNeighborSearcher2.h:29
PointSimpleListSearcher2()
Default constructor.
Front-end to create PointSimpleListSearcher2 objects step by step.
Definition: PointSimpleListSearcher2.h:103
PointNeighborSearcher2Ptr Clone() const override
Creates a new instance of the object with same properties than original.
void Set(const PointSimpleListSearcher2 &other)
Copy from the other instance.
void Serialize(std::vector< uint8_t > *buffer) const override
Serializes the neighbor searcher into the buffer.
PointSimpleListSearcher2 & operator=(const PointSimpleListSearcher2 &other)
Assignment operator.
PointNeighborSearcher2Ptr BuildPointNeighborSearcher() const override
Returns shared pointer of PointNeighborSearcher3 type.
2-D vector class.
Definition: Vector2.h:26
std::shared_ptr< PointNeighborSearcher2 > PointNeighborSearcher2Ptr
Shared pointer for the PointNeighborSearcher2 type.
Definition: PointNeighborSearcher2.h:79
std::shared_ptr< PointSimpleListSearcher2 > PointSimpleListSearcher2Ptr
Shared pointer for the PointSimpleListSearcher2 type.
Definition: PointSimpleListSearcher2.h:98
bool HasNearbyPoint(const Vector2D &origin, double radius) const override
static Builder GetBuilder()
Returns builder fox PointSimpleListSearcher2.