OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
PathTreeOwner.h
Go to the documentation of this file.
1 
11 // Copyright 2015 Sensics, Inc.
12 //
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 //
17 // http://www.apache.org/licenses/LICENSE-2.0
18 //
19 // Unless required by applicable law or agreed to in writing, software
20 // distributed under the License is distributed on an "AS IS" BASIS,
21 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 // See the License for the specific language governing permissions and
23 // limitations under the License.
24 
25 #ifndef INCLUDED_PathTreeOwner_h_GUID_3B8C4AD4_90FA_4485_1388_CCFABF5EB66F
26 #define INCLUDED_PathTreeOwner_h_GUID_3B8C4AD4_90FA_4485_1388_CCFABF5EB66F
27 
28 // Internal Includes
30 #include <osvr/Common/PathTree.h>
31 #include <osvr/Common/Export.h>
32 
33 // Library/third-party includes
34 #include <boost/noncopyable.hpp>
35 #include <json/value.h>
36 
37 // Standard includes
38 #include <vector>
39 
40 namespace osvr {
41 namespace common {
48  class PathTreeOwner : private boost::noncopyable {
49  public:
50  PathTreeOwner() = default;
51 
53  PathTreeOwner(PathTreeOwner const &) = delete;
55  PathTreeOwner &operator=(PathTreeOwner const &) = delete;
56 
59  explicit operator bool() const { return m_valid; }
60 
66  OSVR_COMMON_EXPORT PathTreeObserverPtr makeObserver();
67 
70  OSVR_COMMON_EXPORT void replaceTree(Json::Value const &nodes);
71 
73  PathTree &get() { return m_tree; }
74 
76  PathTree const &get() const { return m_tree; }
77 
78  private:
79  PathTree m_tree;
80  std::vector<PathTreeObserverWeakPtr> m_observers;
81  bool m_valid = false;
82  };
83 } // namespace common
84 } // namespace osvr
85 #endif // INCLUDED_PathTreeOwner_h_GUID_3B8C4AD4_90FA_4485_1388_CCFABF5EB66F
void replaceTree(Json::Value const &nodes)
Replace the entirety of the path tree from the given serialized array of nodes.
A tree representation, with path/url syntax, of the known OSVR system.
Definition: PathTree.h:43
Object responsible for owning a path tree (specifically a "downstream"/client path tree)...
Definition: PathTreeOwner.h:48
PathTreeObserverPtr makeObserver()
Make an observer object that can hold callbacks for tree updates. Callbacks are called in the order t...
Header.
Automatically-generated export header - do not edit!
PathTreeOwner & operator=(PathTreeOwner const &)=delete
non-copy-assignable