Sigma icon indicating copy to clipboard operation
Sigma copied to clipboard

Component and composite ID's should not be of type std::string

Open catageek opened this issue 11 years ago • 2 comments

The reason for this is that strings and templates are not friends.

We can not write a template that would take the component ID as argument if this is a string.

As a consequence, we need to create a class for each component where a template would be sufficient.

I propose ID's to be of type unsigned int, and to create "name resolver" classes to transform a name into an ID.

catageek avatar Jan 19 '14 06:01 catageek

uint32_t instead of a unsign int . If not, we can find the the size of the type can change depending of the compiler and if the OS is a 32 or 64 bit.

The "name resolver" sounds me to a hash function. We can use the same hash function to generate the ID from the string, and to store these strings in a hash table.

Zardoz89 avatar Jan 19 '14 10:01 Zardoz89

See ResourceSystem and a resource like Mesh to see how I handled this in a manner that has both a string and an ID.

adam4813 avatar Mar 02 '14 19:03 adam4813