Radium Engine  1.5.0
SignalManager.cpp
1 #include <Engine/Scene/SignalManager.hpp>
2 
3 namespace Ra {
4 namespace Engine {
5 namespace Scene {
6 
8  return m_entityCreatedCallbacks;
9 }
10 
11 SignalManager::ItemObservable& SignalManager::getEntityDestroyedNotifier() {
12  return m_entityDestroyedCallbacks;
13 }
14 
15 SignalManager::ItemObservable& SignalManager::getComponentCreatedNotifier() {
16  return m_componentAddedCallbacks;
17 }
18 
19 SignalManager::ItemObservable& SignalManager::getComponentDestroyedNotifier() {
20  return m_componentRemovedCallbacks;
21 }
22 
23 SignalManager::ItemObservable& SignalManager::getRenderObjectCreatedNotifier() {
24  return m_roAddedCallbacks;
25 }
26 
27 SignalManager::ItemObservable& SignalManager::getRenderObjectDestroyedNotifier() {
28  return m_roRemovedCallbacks;
29 }
30 
31 SignalManager::FrameObservable& SignalManager::getEndFrameNotifier() {
32  return m_frameEndCallbacks;
33 }
34 
35 void SignalManager::fireEntityCreated( const ItemEntry& entity ) const {
36  CORE_ASSERT( entity.isEntityNode(), "Invalid entry" );
37  notify<const ItemEntry&>( m_entityCreatedCallbacks, entity );
38 }
39 
40 void SignalManager::fireEntityDestroyed( const ItemEntry& entity ) const {
41  CORE_ASSERT( entity.isEntityNode(), "Invalid entry" );
42  notify<const ItemEntry&>( m_entityDestroyedCallbacks, entity );
43 }
44 
45 void SignalManager::fireComponentAdded( const ItemEntry& component ) const {
46  CORE_ASSERT( component.isComponentNode(), "Invalid entry" );
47  notify<const ItemEntry&>( m_componentAddedCallbacks, component );
48 }
49 
50 void SignalManager::fireComponentRemoved( const ItemEntry& component ) const {
51  CORE_ASSERT( component.isComponentNode(), "Invalid entry" );
52  notify<const ItemEntry&>( m_componentRemovedCallbacks, component );
53 }
54 
56  CORE_ASSERT( ro.isRoNode(), "Invalid entry" );
57  notify<const ItemEntry&>( m_roAddedCallbacks, ro );
58 }
60  CORE_ASSERT( ro.isRoNode(), "Invalid entry" );
61  notify<const ItemEntry&>( m_roRemovedCallbacks, ro );
62 }
63 
65  notify<>( m_frameEndCallbacks );
66 }
67 
68 } // namespace Scene
69 } // namespace Engine
70 } // namespace Ra
void fireEntityDestroyed(const ItemEntry &entity) const
Notifies all observers of an entity removal.
ItemObservable & getEntityCreatedNotifier()
void fireRenderObjectRemoved(const ItemEntry &ro) const
Notifies all observers of a render object removal.
Ra::Core::Utils::Observable<> FrameObservable
Type for frame observable.
void fireComponentAdded(const ItemEntry &component) const
Notifies all observers of a component creation.
void fireEntityCreated(const ItemEntry &entity) const
Notifies all observers of an entity creation.
void fireComponentRemoved(const ItemEntry &component) const
Notifies all observers of a component removal.
void fireRenderObjectAdded(const ItemEntry &ro) const
Notifies all observers of a render object creation.
void fireFrameEnded() const
Notifies all observers of a end of frame event.
Ra::Core::Utils::Observable< const ItemEntry & > ItemObservable
Type for item (entity, component or render object) observable.
Definition: Cage.cpp:3
bool isComponentNode() const
Returns true if the item represents a component.
Definition: ItemEntry.hpp:85
bool isEntityNode() const
Returns true if the item represents an entity.
Definition: ItemEntry.hpp:80
bool isRoNode() const
Returns true if the item represents a render object.
Definition: ItemEntry.hpp:90