refactor: use vector
of banks for algorithm I/O
#18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Run
method now operates on aBankVec
, astd::vector
of bank pointersRun
now returnsvoid
; instead it is allowed to mutate the inputBankVec
; this saves some time by avoiding copying banksStart
will set the index of theBankVec
for each required bank, soRun
avoids hashing (cf. previous design'sBankMap
, an unordered map of bank names to bank pointers, which requires extensive hashing)BankVec
Start()
: a default (algorithm-dependent) ordering of banks will be assumed byRun
Start(std::unordered_map<std::string, int> m)
, wherem
provides the index of theBankVec
for each bankThis design provides compatibility with @gavalian's idea of a
BankStore
:If a user wants to use a
BankStore
, they would write the following (pseudocode):Algorithm algo; BankStore b = reader.getBanks(bank1, bank2); algo.Start(b.bankMap); while(event) algo.run(b.banks);
Alternatively, if a user wants to work with the banks and avoid the bank store, they need to know the order of the banks that the algorithm
Run
call expects (or change it usingStart(map)
):This alternative, while slower, may be preferred in the case where refactoring one's analysis code to use
BankStore
is difficult.