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

0001 /***************************************************************************
0002  *   Copyright (C) 2005 by Fredy Yanardi                                   *
0003  *                                                                         *
0004  *   This program is free software; you can redistribute it and/or modify  *
0005  *   it under the terms of the GNU General Public License as published by  *
0006  *   the Free Software Foundation; either version 2 of the License, or     *
0007  *   (at your option) any later version.                                   *
0008  ***************************************************************************/
0009 
0010 #ifndef MAGNITUDECOMPARATOR_H
0011 #define MAGNITUDECOMPARATOR_H
0012 
0013 #include "component.h"
0014 #include "logic.h"
0015 
0016 #include <QBitArray>
0017 //#include <q3ptrvector.h>  // 2018.10.17
0018 
0019 /**
0020 @author Fredy Yanardi
0021  */
0022 class MagnitudeComparator : public CallbackClass, public Component
0023 {
0024 public:
0025     MagnitudeComparator(ICNDocument *icnDocument, bool newItem, const char *id = nullptr);
0026     ~MagnitudeComparator() override;
0027 
0028     static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id);
0029     static LibraryItem *libraryItem();
0030 
0031 protected:
0032     void initPins();
0033     void dataChanged() override;
0034 public: // internal interfaces
0035     void inStateChangedWithVal(bool /*isHigh*/);
0036 protected:
0037     void inStateChanged();
0038 
0039     int m_oldABLogicCount;
0040     int cascadingInputs;
0041     int outputs;
0042     bool firstTime;
0043 
0044     QBitArray m_data;
0045 
0046     QVector<LogicIn *> m_aLogic;
0047     QVector<LogicIn *> m_bLogic;
0048     QVector<LogicIn *> m_cLogic;
0049     QVector<LogicOut *> m_output;
0050 };
0051 
0052 #endif