Skip to content

Commit

Permalink
Removed EventReceiver.h includes
Browse files Browse the repository at this point in the history
  • Loading branch information
gtremper committed Aug 1, 2014
1 parent fb53737 commit 010251b
Show file tree
Hide file tree
Showing 14 changed files with 13 additions and 72 deletions.
2 changes: 0 additions & 2 deletions autowiring/Autowired.h
Expand Up @@ -299,8 +299,6 @@ template<class T>
AutoFired(const std::shared_ptr<CoreContext>& ctxt = CoreContext::CurrentContext()):
m_junctionBox(ctxt->GetJunctionBox<T>())
{
static_assert(std::is_base_of<EventReceiver, T>::value, "Cannot AutoFire a non-event type, your type must inherit EventReceiver");

// Add an utterance of the TypeRegistry so we can add this AutoFired type to our collection
(void) RegType<T>::r;
}
Expand Down
5 changes: 1 addition & 4 deletions autowiring/AutowiringEvents.h
@@ -1,14 +1,11 @@
// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved.
#pragma once
#include "EventReceiver.h"
#include TYPE_INDEX_HEADER

struct AnySharedPointer;
class CoreContext;

class AutowiringEvents:
public virtual EventReceiver
{
class AutowiringEvents {
public:
virtual void NewContext(CoreContext&)=0;
virtual void ExpiredContext(CoreContext&)=0;
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion autowiring/DispatchQueue.h
@@ -1,6 +1,5 @@
// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved.
#pragma once
#include "EventReceiver.h"
#include "DispatchThunk.h"
#include <list>
#include <queue>
Expand Down
2 changes: 1 addition & 1 deletion autowiring/ExceptionFilter.h
Expand Up @@ -70,5 +70,5 @@ class ExceptionFilter
/// <remarks>
/// Implementors can use "throw" with no arguments to trigger a rethrow of the originating exception.
/// </remarks>
virtual void Filter(const JunctionBoxBase* pJunctionBox, EventReceiver* pRecipient) {}
virtual void Filter(const JunctionBoxBase* pJunctionBox, Object* pRecipient) {}
};
6 changes: 2 additions & 4 deletions autowiring/JunctionBox.h
Expand Up @@ -2,7 +2,6 @@
#pragma once
#include "DispatchQueue.h"
#include "DispatchThunk.h"
#include "EventReceiver.h"
#include "EventOutputStream.h"
#include "EventInputStream.h"
#include "fast_pointer_cast.h"
Expand All @@ -17,7 +16,6 @@
#include TYPE_TRAITS_HEADER

class CoreContext;
class EventReceiver;
class JunctionBoxBase;

template<typename T>
Expand Down Expand Up @@ -81,14 +79,14 @@ class JunctionBox:
return (std::lock_guard<std::mutex>)m_lock, !m_st.empty();
}

void Add(const JunctionBoxEntry<EventReceiver>& rhs) override {
void Add(const JunctionBoxEntry<Object>& rhs) override {
auto casted = rhs.Rebind<T>();
if(casted)
// Proposed type is directly one of our receivers
Add(casted);
}

void Remove(const JunctionBoxEntry<EventReceiver>& rhs) override {
void Remove(const JunctionBoxEntry<Object>& rhs) override {
auto casted = rhs.Rebind<T>();
if(casted)
Remove(casted);
Expand Down
7 changes: 3 additions & 4 deletions autowiring/JunctionBoxBase.h
Expand Up @@ -8,7 +8,6 @@
class CoreContext;
class DispatchQueue;
class EventOutputStreamBase;
class EventReceiver;

template<class T>
struct JunctionBoxEntry;
Expand Down Expand Up @@ -47,7 +46,7 @@ class JunctionBoxBase {
/// This is a convenience routine, its only purpose is to add the "this" parameter to the
/// call to FilterFiringException
/// </remarks>
void FilterFiringException(const std::shared_ptr<EventReceiver>& pReceiver) const;
void FilterFiringException(const std::shared_ptr<Object>& pReceiver) const;

/// <summary>
/// Converts a dumb pointer into a weak pointer
Expand All @@ -74,6 +73,6 @@ class JunctionBoxBase {
virtual bool HasListeners(void) const = 0;

// Event attachment and detachment pure virtuals
virtual void Add(const JunctionBoxEntry<EventReceiver>& rhs) = 0;
virtual void Remove(const JunctionBoxEntry<EventReceiver>& rhs) = 0;
virtual void Add(const JunctionBoxEntry<Object>& rhs) = 0;
virtual void Remove(const JunctionBoxEntry<Object>& rhs) = 0;
};
4 changes: 2 additions & 2 deletions autowiring/TypeRegistry.h
Expand Up @@ -49,7 +49,7 @@ struct TypeRegistryEntry {
/// <returns>
/// True if this type is an event receiver type
/// </returns>
virtual bool IsEventReceiver(void) const = 0;
//virtual bool IsEventReceiver(void) const = 0;

/// <summary>
/// Constructor method, used to generate a new junction box
Expand Down Expand Up @@ -89,7 +89,7 @@ struct TypeRegistryEntryT:

virtual const std::type_info& GetTypeInfo(void) const override { return typeid(T); }

bool IsEventReceiver(void) const override { return std::is_base_of<EventReceiver, T>::value; }
//bool IsEventReceiver(void) const override { return std::is_base_of<EventReceiver, T>::value; }

virtual std::shared_ptr<JunctionBoxBase> NewJunctionBox(void) const override {
return std::static_pointer_cast<JunctionBoxBase>(
Expand Down
40 changes: 0 additions & 40 deletions autowiring/deferred_ptr.h

This file was deleted.

4 changes: 1 addition & 3 deletions src/autowiring/CMakeLists.txt
Expand Up @@ -53,15 +53,13 @@ set(Autowiring_SRCS
Decompose.h
DecorationDisposition.h
Deserialize.h
deferred_ptr.h
Deferred.h
DispatchQueue.h
DispatchQueue.cpp
DispatchThunk.h
EventInputStream.h
EventOutputStream.h
EventOutputStream.cpp
EventReceiver.h
EventReceiver.cpp
fast_pointer_cast.h
JunctionBox.h
JunctionBoxBase.h
Expand Down
3 changes: 0 additions & 3 deletions src/autowiring/EventReceiver.cpp

This file was deleted.

3 changes: 1 addition & 2 deletions src/autowiring/JunctionBoxManager.cpp
Expand Up @@ -8,8 +8,7 @@
JunctionBoxManager::JunctionBoxManager(void) {
// Enumerate all event types to initialize a new JunctionBox for each
for(auto p = g_pFirstEntry; p; p = p->pFlink)
if(p->IsEventReceiver())
m_junctionBoxes[p->ti] = p->NewJunctionBox();
m_junctionBoxes[p->ti] = p->NewJunctionBox();

// Ensure that these two types are specially mentioned:
(void) RegType<AutowiringEvents>::r;
Expand Down
3 changes: 1 addition & 2 deletions src/autowiring/test/ExceptionFilterTest.cpp
Expand Up @@ -3,7 +3,6 @@
#include "ExceptionFilterTest.hpp"
#include "TestFixtures/ThrowsWhenFired.hpp"
#include "TestFixtures/ThrowsWhenRun.hpp"
#include <autowiring/EventReceiver.h>
#include <autowiring/ExceptionFilter.h>
#include <stdexcept>
#include <sstream>
Expand Down Expand Up @@ -69,7 +68,7 @@ class GenericFilter:
}
}

virtual void Filter(const JunctionBoxBase* pJunctionBox, EventReceiver* pRecipient) override {
virtual void Filter(const JunctionBoxBase* pJunctionBox, Object* pRecipient) override {
m_hit = true;
try {
throw;
Expand Down
5 changes: 1 addition & 4 deletions src/autowiring/test/TestFixtures/ThrowingListener.hpp
@@ -1,9 +1,6 @@
#pragma once
#include <autowiring/EventReceiver.h>

class ThrowingListener:
public virtual EventReceiver
{
class ThrowingListener {
public:
ThrowingListener(void) {}
virtual void DoThrow(void) = 0;
Expand Down

0 comments on commit 010251b

Please sign in to comment.