No reverse operation for ArchiveManager::addArchiveFactory

What it says on the tin: a place to discuss proposed new features.
Post Reply
peterpi
Gnoblar
Posts: 2
Joined: Fri Oct 12, 2007 5:11 pm
Location: Brighton, UK

No reverse operation for ArchiveManager::addArchiveFactory

Post by peterpi »

Hello Ogre forums. This is my first post here. I've been using Ogre for about a week, so I'm a bit of a noob.

My question is: Is there a good reason why there does not exist an ArchiveManager::removeArchiveFactory call? It would behave in a similar way to the ArchiveManager destructor; finding relevant Archives and shutting them down first.

The reason I ask is that I'm having to implement my own ArchiveFactory. It makes sense from my point of view for the order of operations to be:

1) Initialise Ogre
2) Instantiate my ArchiveFactory
3) Register it with the ArchiveManager
(game plays for a bit)
4) Unregister my ArchiveFactory from the ArchiveManager
5) delete my ArchiveFactory
6) shut down Ogre

This way, steps 4,5&6 are the reverse of 1,2&3. Objects are deleted in the reverse order that they were instantiated.

As it is I never delete my ArchiveFactory, and my memory manager complains at me when I exit main ;)

Thanks,
Peter Pimley

PS: Small bug report: The message in the exception thrown in ArchiveManager::unload claims to be from ArchiveManager::~ArchiveManager
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

No particularly good reason other than we've never needed it, and it's a little more complex; in that removing the factory also requires cascading through and destroying the Archive instances it has created, which itself may have a knock-on effect on threaded loading.

If you like you can add it and submit a patch if you need it, that's what open source is about :)
peterpi
Gnoblar
Posts: 2
Joined: Fri Oct 12, 2007 5:11 pm
Location: Brighton, UK

Post by peterpi »

sinbad wrote:other than we've never needed it
Great. I thought that was probably the case, I just wanted to be sure. I'll add it to my local copy, and if it seems to work I'll submit a patch.

Thanks,
Peter P
Post Reply