#ifndef _CEGOPROCCOND_H_INCLUDED_
#define _CEGOPROCCOND_H_INCLUDED_
///////////////////////////////////////////////////////////////////////////////
//                                                         
// CegoProcCond.h  
// --------------
// Cego procedure condition
//                                                        
// Design and Implementation by Bjoern Lemke
//
// (C)opyright 2000-2019 Bjoern Lemke
//
// INTERFACE MODULE
//
// Class: CegoProcCond
// 
// Description: Stored procedure block condition ( if and while )
//
// Status: CLEAN
//
///////////////////////////////////////////////////////////////////////////////

// CEGO INCLUDES
#include "CegoProcPred.h"
#include "CegoProcStmt.h"

class CegoProcPred;

class CegoProcCond  {
    
public:
    
    enum ConditionMode { AND , OR, PRED };
    
    CegoProcCond();
    
    CegoProcCond(CegoProcCond* pCond, CegoProcPred *pPred, ConditionMode mode);
    CegoProcCond(CegoProcPred *pPred);

    ~CegoProcCond();

    void setBlock(CegoProcBlock *pBlock);

    bool eval() const;

    CegoProcCond& operator = (const CegoProcCond& c);

    Chain toChain() const;
    Chain dbFormat(CegoDatabaseFormater *pForm) const;
    friend ostream& operator << (ostream& s, const CegoProcCond& c);
    
private:

    ConditionMode _mode;
    CegoProcCond* _pCond;
    CegoProcPred* _pPred;    
};

#endif
