-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
130 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
//+------------------------------------------------------------------+ | ||
//| EA31337 framework | | ||
//| Copyright 2016-2021, EA31337 Ltd | | ||
//| https://github.com/EA31337 | | ||
//+------------------------------------------------------------------+ | ||
|
||
/* | ||
* This file is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
/** | ||
* @file | ||
* Includes Data struct serialization methods. | ||
*/ | ||
|
||
#ifndef __MQL__ | ||
// Allows the preprocessor to include a header file when it is needed. | ||
#pragma once | ||
#endif | ||
|
||
// Includes. | ||
#include "Data.struct.h" | ||
#include "Serializer/Serializer.h" | ||
|
||
/* Method to serialize DataParamEntry struct. */ | ||
SerializerNodeType DataParamEntry::Serialize(Serializer &s) { | ||
s.PassEnum(THIS_REF, "type", type, SERIALIZER_FIELD_FLAG_HIDDEN); | ||
string aux_string; | ||
|
||
switch (type) { | ||
case TYPE_BOOL: | ||
case TYPE_UCHAR: | ||
case TYPE_CHAR: | ||
case TYPE_USHORT: | ||
case TYPE_SHORT: | ||
case TYPE_UINT: | ||
case TYPE_INT: | ||
case TYPE_ULONG: | ||
case TYPE_LONG: | ||
s.Pass(THIS_REF, "value", integer_value); | ||
break; | ||
|
||
case TYPE_DOUBLE: | ||
s.Pass(THIS_REF, "value", double_value); | ||
break; | ||
|
||
case TYPE_STRING: | ||
s.Pass(THIS_REF, "value", string_value); | ||
break; | ||
|
||
case TYPE_DATETIME: | ||
if (s.IsWriting()) { | ||
aux_string = TimeToString(integer_value); | ||
s.Pass(THIS_REF, "value", aux_string); | ||
} else { | ||
s.Pass(THIS_REF, "value", aux_string); | ||
integer_value = StringToTime(aux_string); | ||
} | ||
break; | ||
|
||
default: | ||
// Unknown type. Serializing anyway. | ||
s.Pass(THIS_REF, "value", aux_string); | ||
} | ||
return SerializerNodeObject; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//+------------------------------------------------------------------+ | ||
//| EA31337 framework | | ||
//| Copyright 2016-2021, EA31337 Ltd | | ||
//| https://github.com/EA31337 | | ||
//+------------------------------------------------------------------+ | ||
|
||
/* | ||
* This file is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
/** | ||
* @file | ||
* Includes TaskCondition's structures serialization methods. | ||
*/ | ||
|
||
#ifndef __MQL__ | ||
// Allows the preprocessor to include a header file when it is needed. | ||
#pragma once | ||
#endif | ||
|
||
// Includes. | ||
#include "TaskCondition.struct.h" | ||
|
||
SerializerNodeType TaskConditionEntry::Serialize(Serializer &s) { | ||
s.Pass(THIS_REF, "flags", flags); | ||
s.Pass(THIS_REF, "id", id); | ||
s.Pass(THIS_REF, "last_check", last_check); | ||
s.Pass(THIS_REF, "last_success", last_success); | ||
s.Pass(THIS_REF, "tries", tries); | ||
s.PassEnum(THIS_REF, "freq", freq); | ||
s.PassArray(THIS_REF, "args", args); | ||
return SerializerNodeObject; | ||
} |