I had a look into the simulatormanager branch and want to add some
comments to the interface.
There are some methods that aren't supposed to
change the state of their class in any way. These should be declared as
const. These are:
The way it is now means that you
will be able to get the simulation-type and change it's value outside the
class, because it returns a reference to the string. Making the method const
means, that you won't be able to change internal state of the class using
this method. This would make the returned reference const. It's better to
just return a QString there, because it would break existing code,
otherwise. That's not a performance problem, because of QStrings
implicit-sharing. The string-data will only get copied, when you try to
manipulate the string itself. If you only call const methods of QString,
there won't be any copying.
More methods, that count in here:
I'm not sure about the
ISimulatorFactory::create-method, though. The current implementation doesn't
change the internals, but may be, it will do later.
class looks better, concerning constness. I dont't think, you should return
const QString&, but just plain QStrings. This would make it easier to use,
because you don't have to copy things around yourself, if you want to "work"
with the returned data. Same for the const QList.
The private member
variables in GenericElementFactory should have the "m_"-prefix, just to be
Okay, that's all for now. I think the next step should be to
try to implement some elements using all this and see, if this interface
works out. If we find some problems, we can still adapt (Yay, we're all
gonna be Borg!) :)