Skip to content

Commit

Permalink
fix: Remove old functions
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomrno committed Nov 19, 2024
1 parent 909ab44 commit 985c799
Showing 1 changed file with 0 additions and 105 deletions.
105 changes: 0 additions & 105 deletions main/src/vortex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,111 +395,6 @@ bool VortexMaker::DebugCheckVersionAndDataLayout(const char *version)
return !error; // Return true if no error occurred
}

/**
* @brief Deploy an event with the specified arguments.
*
* This function deploys an event with the specified event name and arguments.
* It iterates through each EventManager in the Vortex context, checks if the output event
* matches the provided event name, and calls the corresponding event function with the arguments.
*
* @param args A shared pointer to the arguments for the event.
* @param event_name The name of the event to deploy.
*/
VORTEX_API void VortexMaker::DeployEvent(const std::shared_ptr<hArgs> &args, const std::string &event_name)
{
// Get reference to the Vortex context
VxContext &ctx = *CVortexMaker;

// Ensure args is not null before proceeding
if (!args)
{
VortexMaker::LogError("Core", "Null argument provided to DeployEvent.");
return;
}

// Iterate through each EventManager in the Vortex context
for (auto em : ctx.IO.em)
{
// Iterate through each output event in the EventManager
for (auto output_event : em->m_output_events)
{
// Check if the output event name matches the provided event name
if (output_event->m_name == event_name)
{
// Check if the event function pointer is valid
if (output_event->m_foo)
{
// Call the corresponding event function with the provided arguments
output_event->m_foo(args);
}
else
{
// Print an error message if the event function is null
VortexMaker::LogError("Core", "Event function is null for event " + event_name);
}
}
}
}
}

/**
* @brief Deploy an event with the specified arguments and callback.
*
* This function deploys an event with the specified event name and arguments.
* It iterates through each EventManager in the Vortex context, checks if the output event
* matches the provided event name, and calls the corresponding event function with the arguments.
* Additionally, it calls the provided callback function after executing the event function.
*
* @param args A shared pointer to the arguments for the event.
* @param event_name The name of the event to deploy.
* @param callback The callback function to be called after executing the event function.
*/
VORTEX_API void VortexMaker::DeployEvent(const std::shared_ptr<hArgs> &args, const std::string &event_name, void (*callback)(std::shared_ptr<hArgs> _args))
{
// Get reference to the Vortex context
VxContext &ctx = *CVortexMaker;

// Ensure args is not null before proceeding
if (!args)
{
VortexMaker::LogError("Core", "Null argument provided to DeployEvent.");
return;
}

// Ensure callback is not null before proceeding
if (!callback)
{
VortexMaker::LogError("Core", "Null callback provided to DeployEvent.");
return;
}

// Iterate through each EventManager in the Vortex context
for (auto em : ctx.IO.em)
{
// Iterate through each output event in the EventManager
for (auto output_event : em->m_output_events)
{
// Check if the output event name matches the provided event name
if (output_event->m_name == event_name)
{
// Check if the event function pointer is valid
if (output_event->m_foo)
{
// Call the corresponding event function with the provided arguments
output_event->m_foo(args);
// Call the provided callback function with the arguments
callback(args);
}
else
{
// Print an error message if the event function is null
VortexMaker::LogError("Core", "Event function is null for event " + event_name);
}
}
}
}
}

VORTEX_API void VortexMaker::CallOutputEvent(const std::string &event_name, ArgumentValues &args, ReturnValues &ret, const std::string& origin)
{
// Get reference to the Vortex context
Expand Down

0 comments on commit 985c799

Please sign in to comment.