Overte C++ Documentation
Proxy.h
1 //
2 // Proxy.h
3 // libraries/workload/src/workload
4 //
5 // Created by Andrew Meadows 2018.01.30
6 // Copyright 2018 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 #ifndef hifi_workload_Proxy_h
12 #define hifi_workload_Proxy_h
13 
14 #include "View.h"
15 
16 namespace workload {
17 
18 class Owner {
19 public:
20  Owner() = default;
21  Owner(const Owner& other) = default;
22  Owner& operator=(const Owner& other) = default;
23  template <class T> Owner(const T& data) : _concept(std::make_shared<Model<T>>(data)) {}
24  ~Owner() {}
25  template <class T> const T get() const { return std::static_pointer_cast<const Model<T>>(_concept)->_data; }
26 protected:
27  class Concept {
28  public:
29  virtual ~Concept() = default;
30  };
31  template <class T> class Model : public Concept {
32  public:
33  using Data = T;
34  Data _data;
35  Model(const Data& data) : _data(data) {}
36  virtual ~Model() = default;
37  };
38 private:
39  std::shared_ptr<Concept> _concept;
40 };
41 
42 class Proxy {
43 public:
44  Proxy() : sphere(0.0f) {}
45  Proxy(const Sphere& s) : sphere(s) {}
46 
47  Sphere sphere;
48  uint8_t region{ Region::INVALID };
49  uint8_t prevRegion{ Region::INVALID };
50  uint16_t _padding;
51  uint32_t _paddings[3];
52 
53  using Vector = std::vector<Proxy>;
54 };
55 
56 
57 } // namespace workload
58 
59 #endif // hifi_workload_Proxy_h
A generic 3D model displaying geometry loaded from a URL.
Definition: Model.h:84