//---------------------------------------------------------------------------

#ifndef BlifH
#define BlifH
                       
class Blif {
  private:
	string model;					// name of the model
	vector<string> inames;			// names of input ports
	vector<string> onames;			// names of output ports
	list<SoPLA> data;				    // here are the PLAs

	void clear(void);				// clears all the structure

  public:

	Blif(void);
	Blif( const Blif& orig );			// non-copying constructor
	Blif( const vector<string> _inames, const vector<string> _onames );
    ~Blif(void);

	void LoadBlif( const char *fn );	// loads Blif from file
	void SaveBlif( const char *fn );	// save the Blif

		// getters & setters
	unsigned int GetInputs(void) const;
	unsigned int GetOutputs(void) const;
	list<SoPLA> *GetData(void) { return &data; };
	string GetModel(void) const { return model; };
	void SetModel(const string _model) { model = _model; };
	unsigned int GetNodes(void) const { return data.size(); };
	vector<string> GetINames(void) const { return inames;};
	vector<string> GetONames(void) const { return onames;};
	string GetIName( const unsigned int i ) const;
	string GetOName( const unsigned int i ) const;

		// info
	unsigned int GetLiterals(void);
	unsigned int GetGEs(void);
	unsigned int GetLevels(void);		// returns the number of BLIF levels (longest path)
	unsigned int GetANDORLevels(void);		// returns the number of levels of the AND-OR implementation
	unsigned int GetNonTrivNodes(void);	// returns the number of non-trivial (not inv, buff, const) nodes

		// data manipulation
	void AppendPLA( const SoPLA *_pla );
	void Splice( list<SoPLA> &plas );
	void Splice( SoPLA *_pla );
	void Splice( Blif &blif );
	void AppendBlif( const Blif *_blif );	// Joins data from two Blifs. Input and output names are not considered!
};

//---------------------------------------------------------------------------
#endif
