File indexing completed on 2024-05-05 05:46:03

0001 /***************************************************************************
0002  *   Copyright (C) 2004-2005 by David Saxton                               *
0003  *   david@bluehaze.org                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  ***************************************************************************/
0010 
0011 #ifndef DEMULTIPLEXER_H
0012 #define DEMULTIPLEXER_H
0013 
0014 #include "component.h"
0015 #include "logic.h"
0016 
0017 // #include <q3ptrvector.h> // 2018.10.17
0018 
0019 /**
0020 @author David Saxton
0021 */
0022 class Demultiplexer : public CallbackClass, public Component
0023 {
0024 public:
0025     Demultiplexer(ICNDocument *icnDocument, bool newItem, const char *id = nullptr);
0026     ~Demultiplexer() override;
0027 
0028     static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id);
0029     static LibraryItem *libraryItem();
0030 
0031 protected:
0032     void dataChanged() override;
0033     /**
0034      * Add / remove pins according to the number of inputs the user has requested
0035      */
0036     void initPins(unsigned addressSize);
0037 
0038 public: // internal interface
0039     void inStateChanged(bool newState);
0040 protected:
0041 
0042     QVector<LogicIn *> m_aLogic;
0043     QVector<LogicOut *> m_xLogic;
0044     LogicIn *m_input;
0045 };
0046 
0047 #endif