Saving EntityType information

Hi there
I have encountered the following problem trying to write a library: I want certain classes (like e.g. an Entity class) in the library to include an EntityType enum. This enum is supposed to be constructed/edited by the user of the library though. So either I will have said enum within the library for the Entity class to include (this implies that the user of the library can't edit EntityType though) or the enum is not part of the library but then Entity can't have an EntityType attribute.

I have come up with a few solutions for this, but I don't think they accomplish what I'm meaning to do:
1. Let the user write his own EntityType enum and give the Entity class an int attribute for the user to cast his EntityTypes between (then it is not to required to have an enum for that at all though, obviously and the EntityType won't be part of the library)
2. Create an EntityType class within the library which contains a vector or array of strings in which the user can put his own identification for the entities. The entities would still have an int attribute though (representing the index in the container), but at least the EntityType would be within the library.
3. Detect EntityTypes using the typeid operator. This would cause issues in case I wanted to serialize an Entity as far as I know?

I still feel like there is another solution to this but I can't find it for the life of me xD
Last edited on
Topic archived. No new replies allowed.