diff --git a/SHADE_Managed/src/Events/CallbackAction.cxx b/SHADE_Managed/src/Events/CallbackAction.cxx deleted file mode 100644 index 0ad356c1..00000000 --- a/SHADE_Managed/src/Events/CallbackAction.cxx +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************************//*! -\file CallbackAction.cxx -\author Tng Kah Wei, kahwei.tng, 390009620 -\par email: kahwei.tng\@digipen.edu -\date Sep 20, 2022 -\brief Contains the definition of the functions for the CallbackAction managed - class. - - Note: This file is written in C++17/CLI. - -Copyright (C) 2021 DigiPen Institute of Technology. -Reproduction or disclosure of this file or its contents without the prior written consent -of DigiPen Institute of Technology is prohibited. -*//*************************************************************************************/ -// Precompiled Headers -#include "SHpch.h" -// Primary Header -#include "CallbackAction.hxx" - -namespace SHADE -{ - /*---------------------------------------------------------------------------------*/ - /* Constructors */ - /*---------------------------------------------------------------------------------*/ - generic - CallbackAction::CallbackAction(System::Reflection::MethodInfo^ method) - : CallbackAction(method, nullptr) - {} - generic - CallbackAction::CallbackAction(System::Reflection::MethodInfo^ method, System::Object^ obj) - : method { method } - , object { obj } - { - paramArray = gcnew cli::array(1); - } - - /*---------------------------------------------------------------------------------*/ - /* Usage Functions */ - /*---------------------------------------------------------------------------------*/ - generic - void CallbackAction::Invoke(T1 param1) - { - // Set parameters - paramArray[0] = safe_cast(param1); - // Invoke - method->Invoke(object, paramArray); - } -} diff --git a/SHADE_Managed/src/Events/CallbackAction.hxx b/SHADE_Managed/src/Events/CallbackAction.hxx deleted file mode 100644 index f8b50266..00000000 --- a/SHADE_Managed/src/Events/CallbackAction.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************************//*! -\file CallbackAction.hxx -\author Tng Kah Wei, kahwei.tng, 390009620 -\par email: kahwei.tng\@digipen.edu -\date Sep 20, 2021 -\brief Contains the definition of the managed CallbackAction class. - - Note: This file is written in C++17/CLI. - -Copyright (C) 2022 DigiPen Institute of Technology. -Reproduction or disclosure of this file or its contents without the prior written consent -of DigiPen Institute of Technology is prohibited. -*//*************************************************************************************/ -#pragma once - -namespace SHADE -{ - /// - /// Holds a function and their associated object for invoking later. - /// - /// Type of the first parameter. - generic - public ref class CallbackAction - { - public: - /*-----------------------------------------------------------------------------*/ - /* Constructors */ - /*-----------------------------------------------------------------------------*/ - /// - /// Constructs a CallbackAction with the specified static method. - /// - /// MethodInfo representing the method to call. - /// Object to call the method on. Set null if static. - CallbackAction(System::Reflection::MethodInfo^ method); - /// - /// Constructs a CallbackAction with the specified instance method and object - /// which will invoke the method. - /// - /// MethodInfo representing the method to call. - /// Object to call the method on. - CallbackAction(System::Reflection::MethodInfo^ method, System::Object^ obj); - - /*-----------------------------------------------------------------------------*/ - /* Usage Functions */ - /*-----------------------------------------------------------------------------*/ - /// - /// Invokes this action with the specified parameters. - /// - /// - void Invoke(T1 param1); - - private: - System::Reflection::MethodInfo^ method; - cli::array^ paramArray; - System::Object^ object; - }; -} \ No newline at end of file diff --git a/SHADE_Managed/src/Events/CallbackEvent.cxx b/SHADE_Managed/src/Events/CallbackEvent.cxx deleted file mode 100644 index 9ba82ef2..00000000 --- a/SHADE_Managed/src/Events/CallbackEvent.cxx +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************************//*! -\file CallbackEvent.cxx -\author Tng Kah Wei, kahwei.tng, 390009620 -\par email: kahwei.tng\@digipen.edu -\date Sep 20, 2022 -\brief Contains the definition of the functions for the CallbackEvent managed - class. - - Note: This file is written in C++17/CLI. - -Copyright (C) 2021 DigiPen Institute of Technology. -Reproduction or disclosure of this file or its contents without the prior written consent -of DigiPen Institute of Technology is prohibited. -*//*************************************************************************************/ -// Precompiled Headers -#include "SHpch.h" -// Primary Header -#include "CallbackEvent.hxx" - -namespace SHADE -{ - /*---------------------------------------------------------------------------------*/ - /* Constructors */ - /*---------------------------------------------------------------------------------*/ - generic - CallbackEvent::CallbackEvent() - { - actions = gcnew System::Collections::Generic::List ^>(); - } - - /*---------------------------------------------------------------------------------*/ - /* Properties */ - /*---------------------------------------------------------------------------------*/ - generic - System::Collections::Generic::IEnumerable^>^ CallbackEvent::Actions::get() - { - return actions; - } - - /*---------------------------------------------------------------------------------*/ - /* Usage Functions */ - /*---------------------------------------------------------------------------------*/ - generic - void CallbackEvent::AddAction(CallbackAction^ action) - { - actions->Add(action); - } - generic - void CallbackEvent::AddAction(System::Reflection::MethodInfo^ method) - { - actions->Add(gcnew CallbackAction(method)); - } - generic - void CallbackEvent::AddAction(System::Reflection::MethodInfo^ method, System::Object^ object) - { - actions->Add(gcnew CallbackAction(method, object)); - } - generic - void CallbackEvent::RemoveAction(CallbackAction^ action) - { - actions->Remove(action); - } - generic - void CallbackEvent::Invoke(T1 param1) - { - for each (CallbackAction^ action in actions) - { - action->Invoke(param1); - } - } -} diff --git a/SHADE_Managed/src/Events/CallbackEvent.hxx b/SHADE_Managed/src/Events/CallbackEvent.hxx deleted file mode 100644 index d0d6d2f1..00000000 --- a/SHADE_Managed/src/Events/CallbackEvent.hxx +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************************//*! -\file CallbackEvent.hxx -\author Tng Kah Wei, kahwei.tng, 390009620 -\par email: kahwei.tng\@digipen.edu -\date Sep 20, 2021 -\brief Contains the definition of the managed CallbackEvent class. - - Note: This file is written in C++17/CLI. - -Copyright (C) 2022 DigiPen Institute of Technology. -Reproduction or disclosure of this file or its contents without the prior written consent -of DigiPen Institute of Technology is prohibited. -*//*************************************************************************************/ -#pragma once - -#include "CallbackAction.hxx" - -namespace SHADE -{ - /// - /// Holds a set of CallbackActions that can be invoked together at a later time. - /// - /// Type of the first parameter. - generic - public ref class CallbackEvent - { - public: - /*-----------------------------------------------------------------------------*/ - /* Constructors */ - /*-----------------------------------------------------------------------------*/ - /// - /// Default Constructor - /// - CallbackEvent(); - - /*-----------------------------------------------------------------------------*/ - /* Properties */ - /*-----------------------------------------------------------------------------*/ - /// - /// Read only access to the list of Actions - /// - property System::Collections::Generic::IEnumerable^>^ Actions - { - System::Collections::Generic::IEnumerable^>^ get(); - } - - /*-----------------------------------------------------------------------------*/ - /* Usage Functions */ - /*-----------------------------------------------------------------------------*/ - /// - /// Adds the specified CallbackAction to the CallbackEvent. - /// - /// CallbackAction to add. - void AddAction(CallbackAction^ action); - /// - /// Adds a specified static method as a CallbackAction to the CallbackEvent. - /// - /// Method to add. - void AddAction(System::Reflection::MethodInfo^ method); - /// - /// Adds a specified instance method and associated object as a CallbackAction to - /// the CallbackEvent. - /// - /// Method to add. - /// Object that will call the specified method. - void AddAction(System::Reflection::MethodInfo^ method, System::Object^ object); - /// - /// Removes the specified CallbackAction from the CallbackEvent. - /// - /// CallbackAction to remove. - void RemoveAction(CallbackAction^ action); - /// - /// Invokes all CallbackActions registered with this CallbackEvent with the - /// specified parameters. - /// - /// - void Invoke(T1 param1); - - private: - /*-----------------------------------------------------------------------------*/ - /* Data Members */ - /*-----------------------------------------------------------------------------*/ - System::Collections::Generic::List^>^ actions; - }; -} \ No newline at end of file