| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .. | ||
| Generate | ||
| res | ||
| config.yaml | ||
| EnumsStr_Test.mq5 | ||
| Loader.mqh | ||
| README.md | ||
| Template.mqh | ||
Utils/EnumsStr
Automatic enum-to-string / string-to-value conversion, backed by generated perfect-hash lookup tables instead of switch statements.
Main features
- Code-generator macro that builds a lookup class from a set of keys, seeds and values (
TSN_MQLARTICLES_ENUM_REG_TEM/TSN_MQLARTICLES_ENUM_REG_TEMFinTemplate.mqh). - Generated class exposes O(1)
GetVal/GetValNoReflookups by string key, with a default fallback value. - A dynamic variant (
RunDinyamics) allows updating values at runtime, not just at generation time. - Table/seed generation tooling lives in
Generate/(CRecolectinGenerate/Recolect.mqh).
Basic usage
// Generated once via the macro (seeds/hashes/values produced by the Generate/ tooling):
// You must have previously generated the perfect hash table with SimPHash; the macro helps to define a custom class.
TSN_MQLARTICLES_ENUM_REG_TEM(MyEnum, seeds, valores, hashes, BUCKETS_SIZE_L, FINAL_TABLE_SIZE_L)
// Then used as:
ENUM_MY_TYPE v = CEnumRegMyEnum::GetVal("SOME_KEY", ENUM_MY_TYPE_DEFAULT);
Only the most representative macros/classes are shown here.