Skip to content

Commit

Permalink
Renames Condition to TaskCondition
Browse files Browse the repository at this point in the history
  • Loading branch information
kenorb committed Apr 25, 2024
1 parent db4c9e3 commit 4154ad7
Show file tree
Hide file tree
Showing 16 changed files with 185 additions and 187 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ jobs:
- BufferTest
- ChartTest
- CompileIndicatorsTest
- ConditionTest
- DatabaseTest
# - DrawIndicatorTest
- EATest
Expand All @@ -62,7 +61,6 @@ jobs:
- StrategyTest-RSI
- SymbolInfoTest
- SummaryReportTest
- TaskTest
- TickerTest
- TradeTest
steps:
Expand Down
2 changes: 1 addition & 1 deletion Action.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class Action;
// Includes.
#include "Action.enum.h"
#include "Action.struct.h"
#include "Condition.enum.h"
#include "EA.mqh"
#include "Task/TaskCondition.enum.h"

/**
* Action class.
Expand Down
2 changes: 1 addition & 1 deletion Chart.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ class Market;
#include "Chart.enum.h"
#include "Chart.struct.h"
#include "Chart.struct.serialize.h"
#include "Condition.enum.h"
#include "Convert.mqh"
#include "Market.mqh"
#include "Serializer.mqh"
#include "Task/TaskCondition.enum.h"

#ifndef __MQL4__
// Defines structs (for MQL4 backward compatibility).
Expand Down
111 changes: 0 additions & 111 deletions Condition.struct.h

This file was deleted.

2 changes: 1 addition & 1 deletion EA.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
// Includes.
#include "Action.enum.h"
#include "Chart.mqh"
#include "Condition.enum.h"
#include "Data.struct.h"
#include "Dict.mqh"
#include "DictObject.mqh"
Expand All @@ -47,6 +46,7 @@
#include "Strategy.mqh"
#include "SummaryReport.mqh"
#include "Task/Task.h"
#include "Task/TaskCondition.enum.h"
#include "Terminal.mqh"
#include "Trade.mqh"
#include "Trade/TradeSignal.h"
Expand Down
2 changes: 1 addition & 1 deletion Market.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ class Market;
class SymbolInfo;

// Includes.
#include "Condition.enum.h"
#include "Market.struct.h"
#include "Math.h"
#include "Order.mqh"
#include "Serializer.mqh"
#include "SymbolInfo.mqh"
#include "Task/TaskCondition.enum.h"

// Structs.
// Market info.
Expand Down
4 changes: 2 additions & 2 deletions Task/Task.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@

// Includes.
#include "../Action.mqh"
#include "../Condition.mqh"
#include "../DictStruct.mqh"
#include "../Refs.mqh"
#include "../Task/TaskCondition.h"
#include "Task.enum.h"
#include "Task.struct.h"

Expand Down Expand Up @@ -98,7 +98,7 @@ class Task {
static bool Process(TaskEntry &_entry) {
bool _result = false;
if (_entry.IsActive()) {
if (Condition::Test(_entry.GetCondition())) {
if (TaskCondition::Test(_entry.GetCondition())) {
ActionEntry _action = _entry.GetAction();
Action::Execute(_action);
if (_action.IsDone()) {
Expand Down
22 changes: 11 additions & 11 deletions Task/Task.struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@

// Includes.
#include "../Action.struct.h"
#include "../Condition.struct.h"
#include "Task.enum.h"
#include "TaskCondition.struct.h"

struct TaskEntry {
ActionEntry action; // Action of the task.
ConditionEntry cond; // Condition of the task.
datetime expires; // Time of expiration.
datetime last_process; // Time of the last process.
datetime last_success; // Time of the last success.
unsigned char flags; // Action flags.
ActionEntry action; // Action of the task.
TaskConditionEntry cond; // TaskCondition of the task.
datetime expires; // Time of expiration.
datetime last_process; // Time of the last process.
datetime last_success; // Time of the last success.
unsigned char flags; // Action flags.
// Constructors.
void TaskEntry() { Init(); }
void TaskEntry(ActionEntry &_action, ConditionEntry &_cond) : action(_action), cond(_cond) { Init(); }
void TaskEntry(long _aid, ENUM_ACTION_TYPE _atype, long _cid, ENUM_CONDITION_TYPE _ctype)
void TaskEntry(ActionEntry &_action, TaskConditionEntry &_cond) : action(_action), cond(_cond) { Init(); }
void TaskEntry(long _aid, ENUM_ACTION_TYPE _atype, long _cid, ENUM_TASK_CONDITION_TYPE _ctype)
: action(_aid, _atype), cond(_cid, _ctype) {
Init();
}
Expand Down Expand Up @@ -80,9 +80,9 @@ struct TaskEntry {
long GetActionId() { return action.GetId(); }
long GetConditionId() { return cond.GetId(); }
ActionEntry GetAction() { return action; }
ConditionEntry GetCondition() { return cond; }
TaskConditionEntry GetCondition() { return cond; }
ENUM_ACTION_TYPE GetActionType() { return action.GetType(); }
ENUM_CONDITION_TYPE GetConditionType() { return cond.GetType(); }
ENUM_TASK_CONDITION_TYPE GetConditionType() { return cond.GetType(); }
// Setters.
void SetActionObject(void *_obj) { action.SetObject(_obj); }
void SetConditionObject(void *_obj) { cond.SetObject(_obj); }
Expand Down
8 changes: 4 additions & 4 deletions Condition.enum.h → Task/TaskCondition.enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

/**
* @file
* Includes Condition's enums.
* Includes TaskCondition's enums.
*/

#ifndef __MQL__
Expand Down Expand Up @@ -85,7 +85,7 @@ enum ENUM_MARKET_EVENT {
#endif

/* Defines condition entry flags. */
enum ENUM_CONDITION_ENTRY_FLAGS {
enum ENUM_TASK_CONDITION_ENTRY_FLAGS {
COND_ENTRY_FLAG_NONE = 0,
COND_ENTRY_FLAG_IS_ACTIVE = 1,
COND_ENTRY_FLAG_IS_EXPIRED = 2,
Expand All @@ -94,15 +94,15 @@ enum ENUM_CONDITION_ENTRY_FLAGS {
};

/* Defines condition statements (operators). */
enum ENUM_CONDITION_STATEMENT {
enum ENUM_TASK_CONDITION_STATEMENT {
COND_AND = 1, // Use AND statement.
COND_OR, // Use OR statement.
COND_SEQ, // Use sequential checks.
FINAL_ENUM_COND_STATEMENT
};

/* Defines condition types. */
enum ENUM_CONDITION_TYPE {
enum ENUM_TASK_CONDITION_TYPE {
COND_TYPE_ACCOUNT = 1, // Account condition.
COND_TYPE_ACTION, // Action condition.
COND_TYPE_CHART, // Chart condition.
Expand Down
Loading

0 comments on commit 4154ad7

Please sign in to comment.