OSVR-Core
MessageRegistration.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_MessageRegistration_h_GUID_F431F1DB_4193_42AB_3376_C67740E2C6FE
26 #define INCLUDED_MessageRegistration_h_GUID_F431F1DB_4193_42AB_3376_C67740E2C6FE
27 
28 // Internal Includes
30 
31 // Library/third-party includes
32 // - none
33 
34 // Standard includes
35 // - none
36 
37 namespace osvr {
38 namespace common {
44  template <typename Derived> class MessageRegistration {
45  public:
46  static const char *identifier() { return Derived::identifier(); }
47 
48  RawMessageType getMessageType() const { return m_type; }
49  void setMessageType(RawMessageType msgType) { m_type = msgType; }
50 
51  private:
52  Derived &derived() { return *static_cast<Derived *>(this); }
53  Derived const &derived() const {
54  return *static_cast<Derived const *>(this);
55  }
56 
57  RawMessageType m_type;
58  };
59 } // namespace common
60 } // namespace osvr
61 #endif // INCLUDED_MessageRegistration_h_GUID_F431F1DB_4193_42AB_3376_C67740E2C6FE
Handles spatial transformations.
Definition: SerializationTraitExample_Complicated.h:40
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
CRTP class template wrapping message-specific data and/or logic.
Definition: MessageRegistration.h:44
Type-safe wrapper with built-in default for a VRPN "message type" integer.
Definition: RawMessageType.h:45