Logo Search packages:      
Sourcecode: ktechlab version File versions

multiinputgate.h

/***************************************************************************
 *   Copyright (C) 2004-2005 by David Saxton                               *
 *   david@bluehaze.org                                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/

#ifndef MULTIINPUTGATE_H
#define MULTIINPUTGATE_H

#include "component.h"
#include "logic.h"

const int maxGateInput = 256;

/**
@author David Saxton
*/
00022 class MultiInputGate : public CallbackClass, public Component
{
public:
      MultiInputGate( ICNDocument *icnDocument, bool newItem, const char *id, int baseWidth = -1 );
      ~MultiInputGate();
      
protected:
      virtual void inStateChanged( bool newState ) = 0;
      void dataChanged();
      void updateInputs( int newNum );
      
      int m_numInputs;
      int m_baseWidth;
      
      LogicIn *inLogic[maxGateInput];
      ECNode *inNode[maxGateInput];
      
      LogicOut * m_pOut;
      
      virtual void updateAttachedPositioning();
      
private:
      bool b_doneInit;
};


/**
@short Boolean XNOR
@author David Saxton
*/
00052 class ECXnor : public MultiInputGate
{
public:
      ECXnor( ICNDocument *icnDocument, bool newItem, const char *id = 0L );
      ~ECXnor();
      
      static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
      static LibraryItem *libraryItem();
      
private:
      void inStateChanged( bool newState );
      virtual void drawShape( QPainter &p );
};


/**
@short Boolean XOR
@author David Saxton
*/
00071 class ECXor : public MultiInputGate
{
public:
      ECXor( ICNDocument *icnDocument, bool newItem, const char *id = 0L );
      ~ECXor();
      
      static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
      static LibraryItem *libraryItem();
      
protected:
      void inStateChanged( bool newState );
      virtual void drawShape( QPainter &p );
};


/**
@short Boolean OR
@author David Saxton
*/
00090 class ECOr : public MultiInputGate
{
public:
      ECOr( ICNDocument *icnDocument, bool newItem, const char *id = 0L );
      ~ECOr();
      
      static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
      static LibraryItem *libraryItem();
      
protected:
      void inStateChanged( bool newState );
      virtual void drawShape( QPainter &p );
};

/**
@short Boolean NOR
@author David Saxton
*/
00108 class ECNor : public MultiInputGate
{
public:
      ECNor( ICNDocument *icnDocument, bool newItem, const char *id = 0L );
      ~ECNor();
      
      static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
      static LibraryItem *libraryItem();
      
private:
      void inStateChanged( bool newState );
      virtual void drawShape( QPainter &p );
};

/**
@short Boolean NAND
@author David Saxton
*/
00126 class ECNand : public MultiInputGate
{
public:
      ECNand( ICNDocument *icnDocument, bool newItem, const char *id = 0L );
      ~ECNand();
      
      static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
      static LibraryItem *libraryItem();
      
private:
      void inStateChanged( bool newState );
      virtual void drawShape( QPainter &p );
};

/**
@short Boolean AND
@author David Saxton
*/
00144 class ECAnd : public MultiInputGate
{
public:
      ECAnd( ICNDocument *icnDocument, bool newItem, const char *id = 0L );
      ~ECAnd();
      
      static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
      static LibraryItem *libraryItem();
      
private:
      void inStateChanged( bool newState );
      virtual void drawShape( QPainter &p );
};



#endif

Generated by  Doxygen 1.6.0   Back to index