OSVR-Core
PathTreeObserver.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_PathTreeObserver_h_GUID_229F0106_AC97_4997_0239_0900C9CB9A54
26 #define INCLUDED_PathTreeObserver_h_GUID_229F0106_AC97_4997_0239_0900C9CB9A54
27 
28 // Internal Includes
31 #include <osvr/Common/Export.h>
32 
33 // Library/third-party includes
34 #include <boost/noncopyable.hpp>
35 
36 // Standard includes
37 #include <map>
38 #include <functional>
39 
40 namespace osvr {
41 namespace common {
42  class PathTreeOwner;
43  enum class PathTreeEvents : std::size_t { AboutToUpdate, AfterUpdate };
44  class PathTreeObserver : public boost::noncopyable {
45  public:
46  using callback_argument = PathTree &;
47  void notifyEvent(PathTreeEvents e, callback_argument arg) const;
48 
49  using callback_type = std::function<void(callback_argument)>;
50  OSVR_COMMON_EXPORT void setEventCallback(PathTreeEvents e,
51  callback_type const &callback);
52 
53  protected:
54  PathTreeObserver() = default;
55 
56  private:
57  std::map<PathTreeEvents, callback_type> m_handlers;
58  };
59 } // namespace common
60 } // namespace osvr
61 #endif // INCLUDED_PathTreeObserver_h_GUID_229F0106_AC97_4997_0239_0900C9CB9A54
Handles spatial transformations.
Definition: SerializationTraitExample_Complicated.h:40
A tree representation, with path/url syntax, of the known OSVR system.
Definition: PathTree.h:43
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
Definition: PathTreeObserver.h:44