#ifndef LIB_MQLPLUS_SCALE_ARRAY_TEMPLATES_MQH_INCLUDED #define LIB_MQLPLUS_SCALE_ARRAY_TEMPLATES_MQH_INCLUDED #property version "1.2"; /********************************************************************************** * Copyright (C) 2010-2022 Dominik Egert * * This file is the scale array include file. * * MQLplus, including this file may not be copied and/or distributed * without explecit permit by the author. * Author Dominik Egert / Freie Netze UG. ********************************************************************************** * * Version: 1.2 * State: production * * File information * ================ * * * * */ #ifdef DBG_MSG_TRACE_FILE_LOADER DBG_MSG_TRACE_FILE_LOADER; #endif /////////////////////////////// // // Include mt5api Array // #include "base/lib_base_scale_array.mqh" /*********************************************************************************************************************************************************/ /* */ /* MQLplus data structures */ /* */ /*********************************************************************************************************************************************************/ /////////////////////////////////////// // // Dynamic scale array simple type // template class scale_array : public _generic_scale_array { public: // Default constructor scale_array(const bool dnd = false) { value = NULL; }; // Element function const T append(T p_in) { return(_base_scale_array::append(p_in)); } const T prepend(T p_in) { return(_base_scale_array::prepend(p_in)); } const T remove() { _base_scale_array::remove_dim(); T tmp = value; value = (T)NULL; return(tmp); }; // Assignment operator const T operator=(const T p_in) { value = p_in; return(value); }; }; /////////////////////////////////////// // // Dynamic scale array struct type // template class struct_scale_array : public _generic_scale_array { public: // Default constructor struct_scale_array(const bool dnd = false) { }; // Assignment operator const T operator=(const T& p_in) { value = p_in; return(value); }; }; /////////////////////////////////////// // // Dynamic scale array pointer type // template class ptr_scale_array : public _generic_scale_array { // Local storage bool do_not_destroy; public: // Default constructor ptr_scale_array() : do_not_destroy (false) { value = NULL; }; // Custom constructor ptr_scale_array(const bool _do_not_destroy) : do_not_destroy (_do_not_destroy) { value = NULL; }; // Destructor ~ptr_scale_array() { if((!do_not_destroy) && (value != NULL)) { delete(value); } }; // Buffer functions const bool dnd(const bool _do_not_destroy = true) { do_not_destroy |= _do_not_destroy; return(do_not_destroy); }; // Element function T* append(T* p_in) { return(_base_scale_array::append(p_in)); } T* prepend(T* p_in) { return(_base_scale_array::prepend(p_in)); } T* remove() { _base_scale_array::remove_dim(); T* tmp = value; if(!do_not_destroy) { delete(value); } value = (T*)NULL; return(tmp); }; // Assignment operator T* operator=(const T& p_in) { value = new T(p_in); return(value); }; T* operator=(T* p_in) { value = p_in; return(value); }; }; // // END MQL data structures */ //*********************************************************************************************************************************************************/ #endif // LIB_MQLPLUS_SCALE_ARRAY_TEMPLATES_MQH_INCLUDED