Feature #2240
Updated by Junxiao Shi almost 10 years ago
Allow multiple `StrategyInfo` objects of distinct types to be attached to `StrategyInfoHost`. `StrategyInfo` derived class must declare a `int getTypeId()` static method, which returns a unique identifier for the `StrategyInfo` type. Those identifiers are assigned on [[StrategyInfoType]] wiki page. `StrategyInfoHost` will store `StrategyInfo` objects in `std::map<int, `std::unordered_map<std::type_index, shared_ptr<StrategyInfo>>` container. This change is backwards compatible. **Necessity**: * Various parts of a complex strategy needs to store different types of information that are used at different occasions. Although it's possible to make a complex `StrategyInfo` type that contains everything, it's more convenient if `StrategyInfoHost` can allow multiple `StrategyInfo` of distinct types, because it allows sub modules to be shared between strategies. * In a composed strategy (#2000), each building block wants to store information for its own use. Although it's possible to compose a `StrategyInfo` type that contains everything, that is basically a container of building block's `StrategyInfo` indexed by type, which is same as what `StrategyInfoHost` is expected to do. * Measurements could be shared between strategies if they are using compatible types. StrategyInfo doesn't have to be cleared when changing strategy.