OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
WrapRoute.h
Go to the documentation of this file.
1 
12 // Copyright 2015 Sensics, Inc.
13 //
14 // Licensed under the Apache License, Version 2.0 (the "License");
15 // you may not use this file except in compliance with the License.
16 // You may obtain a copy of the License at
17 //
18 // http://www.apache.org/licenses/LICENSE-2.0
19 //
20 // Unless required by applicable law or agreed to in writing, software
21 // distributed under the License is distributed on an "AS IS" BASIS,
22 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 // See the License for the specific language governing permissions and
24 // limitations under the License.
25 
26 #ifndef INCLUDED_WrapRoute_h_GUID_CC93B3E1_2C30_42AE_9880_FE43AD40AB81
27 #define INCLUDED_WrapRoute_h_GUID_CC93B3E1_2C30_42AE_9880_FE43AD40AB81
28 
29 // Internal Includes
31 
32 // Library/third-party includes
33 #include <json/value.h>
34 
35 // Standard includes
36 // - none
37 
38 inline Json::Value wrapRoute(Json::Value currentRoute, Json::Value newLevel) {
39  namespace routing_keys = osvr::common::routing_keys;
40  Json::Value ret = currentRoute;
41  Json::Value prevSource = currentRoute[routing_keys::source()];
42  ret[routing_keys::source()] = newLevel;
43  ret[routing_keys::source()][routing_keys::child()] = prevSource;
44  return ret;
45 }
46 
47 #endif // INCLUDED_WrapRoute_h_GUID_CC93B3E1_2C30_42AE_9880_FE43AD40AB81