00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __SIM_DataHint__
00021 #define __SIM_DataHint__
00022
00023 #include "SIM_API.h"
00024 #include <UT/UT_String.h>
00025 #include <UT/UT_IntArray.h>
00026 #include <UT/UT_PtrArray.h>
00027 #include <UT/UT_SymbolTable.h>
00028
00029 class UT_StringArray;
00030 class SIM_Data;
00031 class SIM_Object;
00032 class SIM_Engine;
00033 class SIM_DataHint;
00034 class SIM_RootData;
00035
00036 typedef UT_PtrArray<SIM_DataHint *> SIM_DataHintArray;
00037
00038 class SIM_API SIM_DataHint
00039 {
00040 public:
00041 static void addHint(const UT_String &parentdatatype,
00042 const UT_String &expectedchildtype,
00043 const UT_String &expectedchildname,
00044 int maxcount);
00045 static void getAllDataHints(UT_StringArray &parentdatatypes,
00046 UT_StringArray &expectedchildtypes,
00047 UT_StringArray &expectedchildnames,
00048 UT_IntArray &maxcounts);
00049 static void getAllSubdataTypes(const char *parentdatatype,
00050 UT_StringArray &subdatatypes,
00051 UT_IntArray &maxcountindices,
00052 UT_IntArray &maxcounts);
00053 static void verifySimulationData(const SIM_Engine &engine);
00054 static void destroyAllDataHints();
00055
00056 static void addAlias(const char *datatype, const char *alias);
00057 static const char *getDataTypeFromAlias(const char *alias);
00058 static void getAllDataTypeAliases(UT_StringArray &aliases,
00059 UT_StringArray &datatypes);
00060
00061 private:
00062 SIM_DataHint(const char *parentdatatype,
00063 const char *expecteddatatype,
00064 const char *expecteddataname,
00065 int maxcount);
00066 virtual ~SIM_DataHint();
00067
00068 bool getDataIsExpected(const SIM_Data &child,
00069 const UT_String &childname) const;
00070
00071 static int mergeHintsForParent(UT_Thing &, const char *, void *);
00072 static void processHintsForData(const SIM_Engine &engine,
00073 const SIM_RootData &rootdata,
00074 const SIM_Data &parentdata);
00075 static int destroyHintTableEntry(UT_Thing &thing,
00076 const char *, void *);
00077 static void destroyDataHints(void *);
00078
00079 UT_String myParentDataType;
00080 UT_String myExpectedDataType;
00081 UT_String myExpectedDataName;
00082 int myMaxCount;
00083
00084 static SIM_DataHintArray *theMasterHintArray;
00085 static UT_SymbolTable *theHintTable;
00086 static UT_SymbolTable theDataTypeAliases;
00087 };
00088
00089 #endif