NAP
sequenceevent.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7 // external includes
8 #include <nap/event.h>
9 #include <glm/vec2.hpp>
10 #include <glm/vec3.hpp>
11 
12 namespace nap
13 {
15 
19  class NAPAPI SequenceEventBase : public Event
20  {
21  RTTI_ENABLE(Event)
22  public:
28  template<typename T>
29  bool isEventType() const { return RTTI_OF(T) == this->get_type(); }
30 
31 
37  template<typename T>
38  const T& getEventType() const { assert(this->get_type() == RTTI_OF(T)); return static_cast<const T &>(*this); }
39  };
40 
41 
46  template<typename T>
48  {
49  RTTI_ENABLE(SequenceEventBase)
50  public:
55  SequenceEvent(const T& value) :
56  mValue(value) { }
57 
61  const T& getValue() const { return mValue; }
62 
63  private:
64  // the value
65  T mValue;
66  };
67 
68  using SequenceEventPtr = std::unique_ptr<SequenceEventBase>;
69 
71  // Definitions of all supported events
73 
79 }
nap::SequenceEvent::SequenceEvent
SequenceEvent(const T &value)
Definition: sequenceevent.h:55
nap::Event
Definition: event.h:17
nap::SequenceEventBase::isEventType
bool isEventType() const
Definition: sequenceevent.h:29
nap::SequenceEventBase::getEventType
const T & getEventType() const
Definition: sequenceevent.h:38
nap::SequenceEvent::getValue
const T & getValue() const
Definition: sequenceevent.h:61
nap::SequenceEventPtr
std::unique_ptr< SequenceEventBase > SequenceEventPtr
Definition: sequenceevent.h:68
nap::SequenceEvent
Definition: sequenceevent.h:47
nap
Definition: templateapp.h:17
nap::SequenceEventBase
Definition: sequenceevent.h:19