ResourceGroupManager::ResourceGroup impedence mismatch

Minor issues with the Ogre API that can be trivial to fix
Post Reply
User avatar
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France
x 35

ResourceGroupManager::ResourceGroup impedence mismatch

Post by Mikachu »

Hi,

2 public methods in ResourceGroupManager use protected struct ResourceGroupManager::ResourceGroup in their arguments :

Code: Select all

   /** Find out if the named file exists in a group. 
        @param group Pointer to the resource group
        @param filename Fully qualified name of the file to test for
        */
        bool resourceExists(ResourceGroup* group, const String& filename);

....

	/** Retrieve the modification time of a given file */
		time_t resourceModifiedTime(ResourceGroup* group, const String& filename); 
Those 2 methods should be made protected as well, or ResourceGroupManager::ResourceGroup should be public...

Actually, I don't know why the compiler is letting this happen :wink:
OgreProcedural - Procedural Geometry for Ogre3D
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: ResourceGroupManager::ResourceGroup impedence mismatch

Post by masterfalcon »

I don't believe that it matters because it's not an instance but rather the definition of the type. The definition is within the class scope and so class methods have access to those types. I could be wrong and this is just something that compilers just allow. I haven't checked in the C++ spec to verify.
User avatar
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France
x 35

Re: ResourceGroupManager::ResourceGroup impedence mismatch

Post by Mikachu »

I've setup a test case here : http://ideone.com/KHkTGT

I think the compiler doesn't throw an error because:
  • the pointer can be null, in which case the caller doesn't need pointer type
  • a pointer to the type can be used by callee if it doesn't explicitely name it, as in the above example
None of the above cases is useful for Ogre, so the fact that the 2 functions are public is misleading.
IMHO, the struct ResourceGroupManager::ResourceGroup should be made public...

Shall I file an issue for this?
OgreProcedural - Procedural Geometry for Ogre3D
Post Reply