//+------------------------------------------------------------------+ //| Factory.mqh | //| Copyright 2025, Niquel Mendoza. | //| https://www.mql5.com/es/users/nique_372/news | //+------------------------------------------------------------------+ #property copyright "Copyright 2025, Niquel Mendoza." #property link "https://www.mql5.com/es/users/nique_372/news" #property strict #ifndef MQLARTICLES_POSMGMT_CONDPARTIALS_BASE_FACTORY_MQH #define MQLARTICLES_POSMGMT_CONDPARTIALS_BASE_FACTORY_MQH //+------------------------------------------------------------------+ //| Include | //+------------------------------------------------------------------+ #include "ConstantPartial.mqh" //+------------------------------------------------------------------+ //| CConditionalPartialsFactory class | //+------------------------------------------------------------------+ class CConditionalPartialsFactory { public: CConditionalPartialsFactory(void) {} ~CConditionalPartialsFactory(void) {} static CConditionalPartials* Create(ENUM_TYPE_CONDITIONAL_PARTIAL_CLASS type); }; //+------------------------------------------------------------------+ //| Function to return a dynamic instance of type | //| CConditionalPartials* | //| Inputs: | //| - ENUM_TYPE_CONDITIONAL_PARTIAL_CLASS type: Type of base class | //| that will serve as the manager for the conditional | //| partial closure class. | //| Outputs: | //| - On success, dynamic instance of type CConditionalPartials, | //| otherwise NULL | //+------------------------------------------------------------------+ static CConditionalPartials* CConditionalPartialsFactory::Create(ENUM_TYPE_CONDITIONAL_PARTIAL_CLASS type) { switch(type) { case CONDITIONAL_PARTIAL_CLASS_TYPE_BASE: return new CConditionalPartials(); case CONDITIONAL_PARTIAL_CLASS_TYPE_CONSTANT: return new CConditionalPartialsConst(); default: FastLog(FUNCION_ACTUAL, CRITICAL_ERROR_TEXT, StringFormat("Class type %s\nInvalid", EnumToString(type))); Remover(); return NULL; } } #endif // MQLARTICLES_POSMGMT_CONDPARTIALS_BASE_FACTORY_MQH //+------------------------------------------------------------------+