You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The EventStore currently has two methods to access it's collections by name:
/// access a collection by name. returns true if successful
template<typename T>
bool get(const std::string& name, const T*& collection);
/// access a collection by name
/// returns a collection w/ setting isValid to true if successful
template<typename T>
const T& get(const std::string& name );
That's not really ideal when trying to create collections from an external datasource where it is not known how many / which collections there are at compile time. In this case, ideally I would create branches according to what the external datasource provides and keep track of the collections in a map: branchname -> collectionptr.
The const pointer cannot be used for this purpose, as I cannot call create in the next step of filling the branches in the event loop. And dealing with maps involving references is quite painful - maybe it's possible but I haven't figured it out. I managed to implement the same thing with a vector of references, but would then have to do a lot more bookkeeping. Simply adding a getter for non-const pointers seems like the easiest way.
The text was updated successfully, but these errors were encountered:
The EventStore currently has two methods to access it's collections by name:
That's not really ideal when trying to create collections from an external datasource where it is not known how many / which collections there are at compile time. In this case, ideally I would create branches according to what the external datasource provides and keep track of the collections in a map: branchname -> collectionptr.
The const pointer cannot be used for this purpose, as I cannot call
create
in the next step of filling the branches in the event loop. And dealing with maps involving references is quite painful - maybe it's possible but I haven't figured it out. I managed to implement the same thing with a vector of references, but would then have to do a lot more bookkeeping. Simply adding a getter for non-const pointers seems like the easiest way.The text was updated successfully, but these errors were encountered: