Hello people, As a code cleanup I'm plannig to separate electronics and flowparts, such that electornic nodes to be connected with electronic connectors, while flownodes to be connected with flowconnectors. Obviously buth connector types and node types will inherit from Connector respectively Node. I want to sketch here an implementation problem, to ask your advice.
A FPNode has some methods which return a ConnectorList; however a flowconnector should keep a list of FPNodes, an electronic connector a list of ECNodes, so they should return something like FlowConnectorList or ElectroincConnectorList. The problem is that is we define FlowConnectorList as: typedef QValueList< QGuaredPtr< FlowConnector > > FlowConnectorList; and typedef QValueList< QGuardedPtr< Connector> > ConnectorList; then we can't upcast a FlowConnectorList to ConnectorList (They are not compatible), but Node::connectorList method is used in many places in the program. Here are few solutions to this problem: a.) implement all methods related to ConnectorLists using {Flow|Electornic}ConnectorList. This is quite inefficient because in this way every time such method is called, a new ConnectorList should be created and filled with elements from the specialized ConnectorList. b.) create the FlowConnectorList as a subclass of ConnectorList and override most methods. I consider this a hack. c.) redesign the interface of Node and all subclasses, such that the class itself won't provide a list, only an interator and associated functions -- this way all the mess with *ConnectorList will disappear. This is more efficient as a), and it should be be enough for the majority of occurences of connectorList method. My question is how should be this problem threated? After fixing this and removing many unneded casts, I'd like to start fixing the bugs related to the open-save of the files. I have a feeling that the autorouter messes up the circuit, because sometimes dragging a component on the circuit has "side" effets. Have I seen right that unit testing framework integrated in qt exists only from version >= 4 ? Some unit tests in the program would be really useful -- at least we will know if we break something. Have fun, Zoltan ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Ktechlab-devel mailing list Ktechlab-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ktechlab-devel