Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

Issue

Issue

evolutional
evolutional.co.uk · · 1 min read
820 5
The current issue I'm trying to solve is whether the IDataEntitySet collections (eg: what you get back from a query) should hold pointers to entities or just the numeric Ids of the entities. The first is faster in terms of looking up the data (no handles to dereference) and is simpler, but the second method allows greater flexibility and concurrency of queries.

Specifically, if I hold pointers I have to find a way to ensure that the dataset remains valid even if an update query is called or otherwise something else which alters the data, such as a script. I'm thinking of perhaps having 'connected' entity sets wherein any changes to the underlying data is instantly reflected in the set - otherwise a disconnected set doesn't change (eg: a snapshot of results). The issue of pointers vs handles becomes important again here, if I hold pointers the disconnected sets could reference invalid data [1]. However if I provide handles, I'll need to provide an instance of my database class to each method/object to allow them to resolve the handle into real data.

Does anyone have any particular comments or ideas on this?



[1] Actually, the data will remain 'valid' as the pointers are stored in a shared_ptr, however the data itself could potentially not be registered within the database any longer and hence be considered invalid.

Discussion

Loading comments...