/******************************************************************
** Copyright (C) 2001, University of Alabama in Huntsville. 
** All rights reserved.
**
** File   : Instance.h
**
** Author : Saranyu Tantipongsakul
**
** Description:
**    This file provides definition for the CLIPS Instance
**    class.
**
** History:
**    26-Nov-2001 : Saranyu Tantipongsakul
**        Created file.
******************************************************************/

#ifndef _INSTANCE_H_
#define _INSTANCE_H_

#include <string>
#include "Construct.h"
#include "Class.h"
extern "C" 
{
  #include "clips/inscom.h"
  #include "clips/insfun.h"		
  #include "clips/commline.h"
  #include "clips/evaluatn.h"		// For DATA_OBJECT data structure
}

// CLIPS_Instance class
class CCLPInstance : public CCLPConstruct		
{
 public:
    class CLIPS_Exception {};
    class Instance_Not_Found : public CLIPS_Exception {};

    bool Make(std::string instanceName, std::string conceptType);
    static bool Unmake(std::string instanceName);
    void Send();
    void Setvalue(std::string strNameValue);
    static CCLPInstance *FindByName(std::string instanceName);
    static void ListInstances();
    std::string NameOf();
    static CCLPInstance *GetNext(void * pCurrInstance);
    static CCLPInstance *GetNextInClass(void *pClass, void *pCurrInstance);
    static CCLPClass *GetClass(void *pInstance);
    int GetChangedStatus();
    void SetChangedStatus(int Status);
    bool Delete();
    void IncrementCount(void *instance_ptr);
    void DecrementCount(void *instance_ptr);
    void DirGetSlot(void *instance_ptr, std::string slotName, DATA_OBJECT *result);
    int DirPutSlot(void *instance_ptr, std::string slotName, DATA_OBJECT *newValue);
    CCLPInstance();						// Constructor

    void  *pClipsInstance;				// Pointer to Instance Object.
 private:
    std::string strNameValuePairs;		// String Name Value Pair.
};

#endif // _INSTANCE_H_
