// General.h : interface of the CKBEditorsDoc class // ///////////////////////////////////////////////////////////////////////////// #if !defined(AFX_GENERAL_H__B419213B_A59E_11D3_9695_0040C7772DA0__INCLUDED_) #define AFX_GENERAL_H__B419213B_A59E_11D3_9695_0040C7772DA0__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #import "c:\Program Files\Common Files\system\ado\msadox.dll" no_namespace #import "c:\Program Files\Common Files\system\ado\msado15.dll" rename("EOF", "EndOfFile") inline void TESTHR(HRESULT x) {if FAILED(x) _com_issue_error(x);}; #include #include "stdafx.h" #include "resource.h" // main symbols class CKBEditorsView; class CKBEditorsDoc; class CKBDB :public CObject { private: CString Cpt; CString Prop; CString Table; CString Field; public: DECLARE_SERIAL(CKBDB); CKBDB(); CKBDB(CString,CString, CString, CString); void GetCptPropTblFld(CString&,CString&, CString&, CString&); virtual void Serialize(CArchive& ar); }; class CTblKeys :public CObject { private: CStringArray TblKeys; CStringArray TblKeysType; public: DECLARE_SERIAL(CTblKeys) CTblKeys(); CTblKeys(CStringArray& Keys,CStringArray& KeysType); void GetTblKeys(CStringArray& Keys,CStringArray& KeysType); virtual void Serialize(CArchive& ar); void RemoveAllKeys(); }; typedef CTypedPtrMap CKBDBList; typedef CTypedPtrMap CTblKeysList; class CDBHandle { private: _CatalogPtr m_pCatalog; TablesPtr m_pTable; ADODB::_ConnectionPtr pConnection; ADODB::_RecordsetPtr pRsTable; CStringArray TablesName; CStringArray FieldsName; CUIntArray FieldsType; int GetTableIndex(CString TableName); int GetFieldIndex(CString FieldName); public: CDBHandle(); ~CDBHandle(); void OpenDBCatalog(CString DBName); void GetTables(CStringArray& TablesArray); void GetFields(CString TableName,CStringArray& FieldsArray); CString GetFieldType(CString FieldName); void GetTableKeys(CString TableName,CStringArray& KeysArray); void OpenDBTable(CString DBName,CString Table ); CString GetDBValue(CString DBName,CString Table, CString Field, CStringArray& KeysName, CStringArray& KeysValue, CStringArray& KeysType ); }; class CCoordinator : public CObject { public: CKBEditorsView* pView; CKBEditorsDoc* pDoc; CCoordinator(); CCoordinator(CKBEditorsView* m_View,CKBEditorsDoc* m_Doc); void Start(); DECLARE_SERIAL(CCoordinator) public: virtual ~CCoordinator(); virtual void Serialize(CArchive& ar); }; /***/ /*class CRow : public CObject { public: CRow(); DECLARE_SERIAL(CRow) // Attributes public: CObArray Columns; // Array of CColumn CString Result; // Operations public: // Implementation public: virtual ~CRow(); virtual void Serialize(CArchive& ar); };*/ /***/ class CImageOb : public CObject { public: CImageOb(); DECLARE_SERIAL(CImageOb) CStringList m_ImageList; public: virtual ~CImageOb(); virtual void Serialize(CArchive& ar); }; typedef CTypedPtrMap CImageListOb; class CValueList : public CObject { public: CValueList(); DECLARE_SERIAL(CValueList) CObArray m_CValueList; public: virtual ~CValueList(); virtual void Serialize(CArchive& ar); }; class CValue : public CObject { public: CValue(); DECLARE_SERIAL(CValue) CString V; public: virtual ~CValue(); virtual void Serialize(CArchive& ar); }; typedef CTypedPtrMap CLegalValueList; class CProperty : public CObject { public: CProperty(); DECLARE_SERIAL(CProperty) CString NameL; long nID; CString NameA; CString PromptA; CString PromptL; int ControlID; CString Type; CString SourceOfValue; CString Default; float UL; float LL; CLegalValueList m_LegalValueList; CStringList m_SearchOrderList; BOOL Necessary; public: virtual ~CProperty(); virtual void Serialize(CArchive& ar); }; typedef CTypedPtrMap CPropList; class CConcept : public CObject { public: CConcept(); DECLARE_SERIAL(CConcept) CString NameL; long SupperNID; long nID; CString NameA; CString DescriptionA; CString DescriptionL; CPropList m_PropList; public: virtual ~CConcept(); virtual void Serialize(CArchive& ar); }; typedef CTypedPtrMap CCptList; typedef CMap CCptIDList; typedef CTypedPtrMap CWMStructure; class CRule : public CObject { public: CRule(); DECLARE_SERIAL(CRule) CString RuleID; int Priority; public: CString GetValue(CString str, CWMStructure * m_WM); void RemoveCptPropValFromWM(CString strCpt,CString strProp, CString strVal,CWMStructure * m_WM,CCptList*m_CptList); void DecomposeCptProp(CString str, CString &ssCpt, CString &ssProp); double CEvalExp(CString str); BOOL CEval(CString str); void GetValue(CString Cpt, CString Prop, CStringList &List,CWMStructure * m_WM,CCptList*pCptList); CString GetValue(CString Cpt, CString Prop, CWMStructure * m_WM); CString GetDefaultValue(CString strCpt,CString strProp,CCptList*pCptList); BOOL strCptPropIn(CString str,CString str2); CString AskUser(CString str,CWMStructure * m_WM,CCptList*pCptList); CString AskingCheck(CString strEval,CWMStructure * m_WM,CCptList*pCptList); void SetToWM(CString strCpt, CString strProp,CString strVal,CWMStructure * m_WM,CCptList*pCptList); BOOL Run(CWMStructure * m_WM,CCptList*pCptList); virtual ~CRule(); virtual void Serialize(CArchive& ar); CString GetCondition(); CString GetAction(); void SetCondition(CString Cond); void SetAction(CString Act); CTime StrToDate(CString str,int Expr); CString GetType(CString strCpt, CString strProp,CCptList * pCptList); CString GetType(CString str, CCptList *pCptList); CString ReplaceNow(CString str); CString Substitute(CString str,CWMStructure * m_WM,CCptList*pCptList); protected: void AddActionToWM(CString strAction,CWMStructure * m_WM,CCptList * pCptList); CString ReplaceAbsDate(CString str); CString EvalDateFun(CString str); CString EvalDate(CString str); CString EvalFunction(CString strExpr,CWMStructure * m_WM); CString RemoveSpace(CString strCond); CString Condition; CString Action; }; typedef CTypedPtrMap CRuleList; class CCluster : public CObject { public: CCluster(); DECLARE_SERIAL(CCluster) CString ClusterID; CObList Input; CObList Output; CRuleList RuleList; CRule * Rule; public: void RunByPriority( CWMStructure *m_WM,CCptList*pCptList); void Run(CWMStructure * m_WM,CCptList*pCptList); virtual ~CCluster(); virtual void Serialize(CArchive& ar); void RunRule(CWMStructure * m_WM,CString strRule,CCptList*pCptList); BOOL RunRule(CWMStructure * m_WM,CCptList*pCptList); protected: }; class CInference : public CObject { public: CInference(); DECLARE_SERIAL(CInference) CString InferenceID; CStringList StaticRoleList; public: virtual ~CInference(); virtual void Serialize(CArchive& ar); protected: }; typedef CTypedPtrMap CClusterList; typedef CTypedPtrMap CInferenceList; typedef CTypedPtrMap CWMStructure; class CCell : public CObject { public: CCell(); DECLARE_SERIAL(CCell) // Attributes public: CString Operator; CString Attribute; CString Value; // Operations public: // Implementation public: virtual ~CCell(); virtual void Serialize(CArchive& ar); }; typedef CTypedPtrMap CBody; //typedef CTypedPtrMap CResult; typedef CMap CResult; class CTable : public CObject { public: CTable(); DECLARE_SERIAL(CTable) // Attributes public: CBody Body; // Array of CRow CStringArray Schema; // List of Cpt-Prop /*CString CptProp; //Cpt-Prop not used*/ //CResult ResultList; CResult ResultList; // CString Result; int MaxRows; void SetCell(int Row,int Col ,CString OPVal); CString GetSeparator(CString Att, CCptList *pCptList); CCell * GetCell(int Row,int Col); // Operations public: // Implementation public: void Play(CWMStructure * m_WM,CCptList * pCptList); virtual ~CTable(); virtual void Serialize(CArchive& ar); }; typedef CTypedPtrMap CTableList; /***********************************/ class CService : public CObject { public: CService(); DECLARE_SERIAL(CService) CString ServiceName; CString TriggerCondition; CString Input; CString InputType; CString Output; public: virtual ~CService(); virtual void Serialize(CArchive& ar); protected: }; typedef CTypedPtrMap CServiceList; /**************************************/ class MainDoc : public CDocument { protected: MainDoc(); // protected constructor used by dynamic creation DECLARE_DYNCREATE(MainDoc) // Attributes public: CCluster *Cluster; CConcept * Cpt; CRule * Rule ; CProperty * Prop; public: CCptList m_TempCptList; CCptList m_CptList; CCptList m_CptListA; CCptIDList m_MapIDToCpt; long MaxConceptID; long MaxRuleID; CClusterList m_ClusterList; CInferenceList m_InferenceList; CWMStructure* m_WM; BOOL Language; CString CurrentCpt; CString CurrentProp; /* void InitWM(); void RemoveCptPropValFromWM(CConcept* Cpt,CString strVal); void PrintWM(); void PlayInference(CString strInf); void RemoveItemFromWM(CString Cpt, CString Prop); */ // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(MainDoc) public: virtual void Serialize(CArchive& ar); // overridden for document i/o protected: virtual BOOL OnNewDocument(); //}}AFX_VIRTUAL // Implementation public: virtual ~MainDoc(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif // Generated message map functions protected: //{{AFX_MSG(MainDoc) // NOTE - the ClassWizard will add and remove member functions here. //}}AFX_MSG DECLARE_MESSAGE_MAP() }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_GENERAL_H__B419213B_A59E_11D3_9695_0040C7772DA0__INCLUDED_)