Overte C++ Documentation
ArrayEndpoint.h
1 //
2 // Created by Bradley Austin Davis 2015/10/23
3 // Copyright 2015 High Fidelity, Inc.
4 //
5 // Distributed under the Apache License, Version 2.0.
6 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
7 //
8 
9 #pragma once
10 #ifndef hifi_Controllers_ArrayEndpoint_h
11 #define hifi_Controllers_ArrayEndpoint_h
12 
13 #include "../Endpoint.h"
14 
15 namespace controller {
16 
17 class ArrayEndpoint : public Endpoint {
18  friend class UserInputMapper;
19 public:
20  static std::shared_ptr<Endpoint> newEndpoint() {
21  return std::shared_ptr<Endpoint>(new ArrayEndpoint());
22  };
23 
24  using Endpoint::apply;
25  using Pointer = std::shared_ptr<ArrayEndpoint>;
26 
27  virtual AxisValue peek() const override { return AxisValue(); }
28 
29  virtual void apply(AxisValue value, const Endpoint::Pointer& source) override {
30  for (auto& child : _children) {
31  if (child->writeable()) {
32  child->apply(value, source);
33  }
34  }
35  }
36 
37  virtual bool readable() const override { return false; }
38 
39 private:
40  ArrayEndpoint() : Endpoint(Input::INVALID_INPUT) { }
41  Endpoint::List _children;
42 };
43 
44 }
45 
46 #endif