@@ -104,27 +104,22 @@ class ConstantFactory{
104104 }
105105
106106 std::string getDataTypeString (DATA_TYPE type) const {
107- if (type >= 0 && type < TYPE_COUNT)
108- return arrTypeStr[type];
109- else if (type >= ARRAY_TYPE_BASE){
110- return getDataTypeString ((DATA_TYPE)(type-ARRAY_TYPE_BASE))+" []" ;
111- }else {
112- return " UknownType" +std::to_string (type);
113- }
107+ return dolphindb::getDataTypeName (type);
114108 }
115109
116110 std::string getDataFormString (DATA_FORM form) const {
117111 if (form >= 0 && form < 9 )
118112 return arrFormStr[form];
119113 else
120- return " UknownForm " + std::to_string (form);
114+ return " Uknown data form " + std::to_string (form);
121115 }
122116
123117 std::string getTableTypeString (TABLE_TYPE type) const {
124- if (type >= 0 && type < 10 )
125- return arrTableTypeStr[type];
126- else
127- return " UknownTable" +std::to_string (type);
118+ switch (type) {
119+ case BASICTBL: return " BASIC" ;
120+ case COMPRESSTBL: return " COMPRESS" ;
121+ default : return " Uknown table type " + std::to_string (type);
122+ }
128123 }
129124
130125 Dictionary* createDictionary (DATA_TYPE keyInternalType, DATA_TYPE keyType, DATA_TYPE valueType){
@@ -770,28 +765,28 @@ class ConstantFactory{
770765 }
771766
772767 void init (){
773- arrConstParser[CONSTANT_VOID ]=&ConstantFactory::parseVoid;
774- arrConstParser[CONSTANT_BOOL ]=&ConstantFactory::parseBool;
775- arrConstParser[CONSTANT_CHAR ]=&ConstantFactory::parseChar;
776- arrConstParser[CONSTANT_SHORT ]=&ConstantFactory::parseShort;
777- arrConstParser[CONSTANT_INT ]=&ConstantFactory::parseInt;
778- arrConstParser[CONSTANT_LONG ]=&ConstantFactory::parseLong;
779- arrConstParser[CONSTANT_FLOAT ]=&ConstantFactory::parseFloat;
780- arrConstParser[CONSTANT_DOUBLE ]=&ConstantFactory::parseDouble;
781- arrConstParser[CONSTANT_DATE ]=&ConstantFactory::parseDate;
782- arrConstParser[CONSTANT_MONTH ]=&ConstantFactory::parseMonth;
783- arrConstParser[CONSTANT_DATETIME ]=&ConstantFactory::parseDateTime;
784- arrConstParser[CONSTANT_DATEHOUR ]=&ConstantFactory::parseDateHour;
785- arrConstParser[CONSTANT_TIME ]=&ConstantFactory::parseTime;
786- arrConstParser[CONSTANT_NANOTIME ]=&ConstantFactory::parseNanoTime;
787- arrConstParser[CONSTANT_TIMESTAMP ]=&ConstantFactory::parseTimestamp;
788- arrConstParser[CONSTANT_NANOTIMESTAMP ]=&ConstantFactory::parseNanoTimestamp;
789- arrConstParser[CONSTANT_MINUTE ]=&ConstantFactory::parseMinute;
790- arrConstParser[CONSTANT_SECOND ]=&ConstantFactory::parseSecond;
791- arrConstParser[CONSTANT_STRING ]=&ConstantFactory::parseString;
792- arrConstParser[CONSTANT_UUID ]=&ConstantFactory::parseUuid;
793- arrConstParser[CONSTANT_IP ]=&ConstantFactory::parseIPAddr;
794- arrConstParser[CONSTANT_INT128 ]=&ConstantFactory::parseInt128;
768+ arrConstParser[DT_VOID ]=&ConstantFactory::parseVoid;
769+ arrConstParser[DT_BOOL ]=&ConstantFactory::parseBool;
770+ arrConstParser[DT_CHAR ]=&ConstantFactory::parseChar;
771+ arrConstParser[DT_SHORT ]=&ConstantFactory::parseShort;
772+ arrConstParser[DT_INT ]=&ConstantFactory::parseInt;
773+ arrConstParser[DT_LONG ]=&ConstantFactory::parseLong;
774+ arrConstParser[DT_FLOAT ]=&ConstantFactory::parseFloat;
775+ arrConstParser[DT_DOUBLE ]=&ConstantFactory::parseDouble;
776+ arrConstParser[DT_DATE ]=&ConstantFactory::parseDate;
777+ arrConstParser[DT_MONTH ]=&ConstantFactory::parseMonth;
778+ arrConstParser[DT_DATETIME ]=&ConstantFactory::parseDateTime;
779+ arrConstParser[DT_DATEHOUR ]=&ConstantFactory::parseDateHour;
780+ arrConstParser[DT_TIME ]=&ConstantFactory::parseTime;
781+ arrConstParser[DT_NANOTIME ]=&ConstantFactory::parseNanoTime;
782+ arrConstParser[DT_TIMESTAMP ]=&ConstantFactory::parseTimestamp;
783+ arrConstParser[DT_NANOTIMESTAMP ]=&ConstantFactory::parseNanoTimestamp;
784+ arrConstParser[DT_MINUTE ]=&ConstantFactory::parseMinute;
785+ arrConstParser[DT_SECOND ]=&ConstantFactory::parseSecond;
786+ arrConstParser[DT_STRING ]=&ConstantFactory::parseString;
787+ arrConstParser[DT_UUID ]=&ConstantFactory::parseUuid;
788+ arrConstParser[DT_IP ]=&ConstantFactory::parseIPAddr;
789+ arrConstParser[DT_INT128 ]=&ConstantFactory::parseInt128;
795790 arrConstParser[CONSTANT_DOUBLE_ENUM]=&ConstantFactory::parseDoubleEnum;
796791
797792 arrConstFactory[DT_VOID]=&ConstantFactory::createVoid;
@@ -985,45 +980,6 @@ class ConstantFactory{
985980 arrTypeSymbol[DT_DECIMAL64] = ' ' ;
986981 arrTypeSymbol[DT_DECIMAL128] = ' ' ;
987982
988- arrTypeStr[DT_VOID]=" VOID" ;
989- arrTypeStr[DT_BOOL]=" BOOL" ;
990- arrTypeStr[DT_CHAR]=" CHAR" ;
991- arrTypeStr[DT_SHORT]=" SHORT" ;
992- arrTypeStr[DT_INT]=" INT" ;
993- arrTypeStr[DT_LONG]=" LONG" ;
994- arrTypeStr[DT_DATE]=" DATE" ;
995- arrTypeStr[DT_MONTH]=" MONTH" ;
996- arrTypeStr[DT_TIME]=" TIME" ;
997- arrTypeStr[DT_MINUTE]=" MINUTE" ;
998- arrTypeStr[DT_SECOND]=" SECOND" ;
999- arrTypeStr[DT_DATETIME]=" DATETIME" ;
1000- arrTypeStr[DT_TIMESTAMP]=" TIMESTAMP" ;
1001- arrTypeStr[DT_NANOTIME]=" NANOTIME" ;
1002- arrTypeStr[DT_NANOTIMESTAMP]=" NANOTIMESTAMP" ;
1003- arrTypeStr[DT_FLOAT]=" FLOAT" ;
1004- arrTypeStr[DT_DOUBLE]=" DOUBLE" ;
1005- arrTypeStr[DT_SYMBOL]=" SYMBOL" ;
1006- arrTypeStr[DT_STRING]=" STRING" ;
1007- arrTypeStr[DT_UUID]=" UUID" ;
1008- arrTypeStr[DT_FUNCTIONDEF]=" FUNCTIONDEF" ;
1009- arrTypeStr[DT_HANDLE]=" HANDLE" ;
1010- arrTypeStr[DT_CODE]=" CODE" ;
1011- arrTypeStr[DT_DATASOURCE]=" DATASOURCE" ;
1012- arrTypeStr[DT_RESOURCE]=" RESOURCE" ;
1013- arrTypeStr[DT_ANY]=" ANY" ;
1014- arrTypeStr[DT_COMPRESS] = " COMPRESS" ;
1015- arrTypeStr[DT_DICTIONARY]=" DICTIONARY" ;
1016- arrTypeStr[DT_DATEHOUR]=" DATEHOUR" ;
1017- arrTypeStr[DT_IP]=" IPADDR" ;
1018- arrTypeStr[DT_INT128]=" INT128" ;
1019- arrTypeStr[DT_BLOB] = " BLOB" ;
1020- arrTypeStr[DT_COMPLEX] = " COMPLEX" ;
1021- arrTypeStr[DT_POINT] = " POINT" ;
1022- arrTypeStr[DT_DURATION] = " DURATION" ;
1023- arrTypeStr[DT_DECIMAL32] = " DECIMAL32" ;
1024- arrTypeStr[DT_DECIMAL64] = " DECIMAL64" ;
1025- arrTypeStr[DT_DECIMAL128] = " DECIMAL128" ;
1026-
1027983 arrFormStr[DF_SCALAR]=" SCALAR" ;
1028984 arrFormStr[DF_PAIR]=" PAIR" ;
1029985 arrFormStr[DF_VECTOR]=" VECTOR" ;
@@ -1033,18 +989,8 @@ class ConstantFactory{
1033989 arrFormStr[DF_DICTIONARY]=" DICTIONARY" ;
1034990 arrFormStr[DF_CHART]=" CHART" ;
1035991 arrFormStr[DF_CHUNK]=" CHUNK" ;
1036-
1037- arrTableTypeStr[BASICTBL] = " BASIC" ;
1038- arrTableTypeStr[REALTIMETBL] = " REALTIME" ;
1039- arrTableTypeStr[SNAPTBL] = " SNAPSHOT" ;
1040- arrTableTypeStr[FILETBL] = " FILE" ;
1041- arrTableTypeStr[CHUNKTBL] = " CHUNK" ;
1042-
1043- arrTableTypeStr[JOINTBL] = " JOIN" ;
1044- arrTableTypeStr[SEGTBL] = " SEGMENT" ;
1045- arrTableTypeStr[ALIASTBL] = " ALIAS" ;
1046- arrTableTypeStr[COMPRESSTBL] = " COMPRESS" ;
1047- arrTableTypeStr[LOGROWTBL] = " LOGROW" ;
992+ arrFormStr[DF_SYSOBJ]=" SYSOBJ" ;
993+ arrFormStr[DF_TENSOR] = " TENSOR" ;
1048994
1049995 arrPartitionTypeStr[SEQ] = " SEQ" ;
1050996 arrPartitionTypeStr[VALUE] = " VALUE" ;
@@ -1062,6 +1008,8 @@ class ConstantFactory{
10621008 arrCategoryTypeStr[SYSTEM] = " SYSTEM" ;
10631009 arrCategoryTypeStr[MIXED] = " MIXED" ;
10641010 arrCategoryTypeStr[BINARY] = " BINARY" ;
1011+ arrCategoryTypeStr[COMPLEX] = " COMPLEX" ;
1012+ arrCategoryTypeStr[ARRAY] = " ARRAY" ;
10651013 arrCategoryTypeStr[DENARY] = " DENARY" ;
10661014 }
10671015
@@ -1073,11 +1021,9 @@ class ConstantFactory{
10731021 std::unordered_map<std::string,DATA_TYPE> typeMap_;
10741022 std::unordered_map<std::string,DATA_FORM> formMap_;
10751023 char arrTypeSymbol[TYPE_COUNT];
1076- std::string arrTypeStr[TYPE_COUNT];
1077- std::string arrFormStr[9 ];
1078- std::string arrTableTypeStr[10 ];
1079- std::string arrPartitionTypeStr[6 ];
1080- std::string arrCategoryTypeStr[12 ];
1024+ std::string arrFormStr[MAX_DATA_FORM];
1025+ std::string arrPartitionTypeStr[MAX_PARTITION_TYPE];
1026+ std::string arrCategoryTypeStr[MAX_CATEGORY];
10811027};
10821028
10831029}
0 commit comments