File indexing completed on 2024-06-16 11:34:23

0001 //
0002 // C++ Interface: electronicconnector
0003 //
0004 // Description:
0005 //
0006 //
0007 // Author: David Saxton, Alan Grimes, Zoltan Padrah <zoltan.padrah@gmail.com>, (C) 2008
0008 //
0009 // Copyright: See COPYING file that comes with this distribution
0010 //
0011 //
0012 #ifndef ELECTRONICCONNECTOR_H
0013 #define ELECTRONICCONNECTOR_H
0014 
0015 #include <connector.h>
0016 
0017 #include "ecnode.h"
0018 
0019 /**
0020     @author David Saxton, Alan Grimes, Zoltan Padrah <zoltan.padrah@gmail.com>
0021 
0022     An electronic connector, connecting 2 ECNodes.
0023 */
0024 class ElectronicConnector : public Connector
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     ElectronicConnector(ECNode *startNode, ECNode *endNode, ICNDocument *_ICNDocument, QString *id = nullptr);
0030 
0031     ~ElectronicConnector() override;
0032 
0033     /**
0034      * Node at start of connector (which refers to this as the output connector)
0035      */
0036     Node *startNode() const override
0037     {
0038         return m_startEcNode;
0039     }
0040 
0041     /**
0042      * Node at end of connector (which refers to this as the input connector)
0043      */
0044     Node *endNode() const override
0045     {
0046         return m_endEcNode;
0047     }
0048 
0049 public slots:
0050     /**
0051      * Takes the minimum pin count of the start and end nodes, and creates a
0052      * connector for each pin up to that minimum.
0053      */
0054     void syncWiresWithNodes();
0055 
0056 private:
0057     /// pointers to the endnodes of the connectors
0058     QPointer<ECNode> m_startEcNode;
0059     QPointer<ECNode> m_endEcNode;
0060 };
0061 
0062 #endif