Horde3D

Next-Generation Graphics Engine
It is currently 19.03.2024, 06:59

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: 25.10.2011, 12:18 
Offline

Joined: 25.10.2011, 12:06
Posts: 1
I was recently tasked with designing my own resource class and I noticed you the following in your declaration:

Code:
class SceneGraphResource : public Resource

{

public:

   static Resource *factoryFunc( const std::string &name, int flags )

      { return new SceneGraphResource( name, flags ); }


And again
Code:
   static Resource *factoryFunc( const std::string &name, int flags )

      { return new TextureResource( name, flags ); }

   


What is the purpose of such a repetition when it is clearly a common function to the parent class. The following declaration is valid:
Code:
template <class Derived>
class Resource {
  public:
    static Resource *factoryFunc(const std::string& name, int flags) {
        return new Derived(name, flag);
    }
};

class Texture : public Resource<Texture> {};


While the declaration may looks slightly odd it is part of the curiously recursive template pattern defined in section 16.3 of Templates the complete guide. I have also noticed the following:
Code:
bool checkDDS( const char *data, int size );


Wouldn't this be more appropriate?
Code:
bool checkDDS( const char *data, size_t size );


Just some suggestions I came up with after browsing through your code, if you dislike them feel free to provide me with a technical response of why you disagree that is all I am interested in. Thanks for your time.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Baidu [Spider] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group