Changeset 18058 for trunk/FACT++/dim/src/discpp.cxx
- Timestamp:
- 01/03/15 18:26:23 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/dim/src/discpp.cxx
r15282 r18058 83 83 void DimService::storeIt(void *data, int size) 84 84 { 85 85 DISABLE_AST 86 if(!itsId) 87 { 88 ENABLE_AST 89 return; 90 } 86 91 if(!itsDataSize) 87 92 { … … 97 102 memcpy(itsData, data, (size_t)size); 98 103 itsSize = size; 104 ENABLE_AST 99 105 } 100 106 … … 131 137 { 132 138 // itsTagId = 0; 139 itsId = 0; 133 140 itsDns = dns; 134 141 itsName = new char[(int)strlen(name)+1]; … … 241 248 { 242 249 // itsTagId = 0; 250 itsIdIn = 0; 251 itsIdOut = 0; 243 252 itsDns = dns; 244 253 itsName = new char[(int)strlen(name)+1]; … … 287 296 void DimRpc::storeIt(void *data, int size) 288 297 { 289 298 DISABLE_AST 299 if(!itsIdIn) 300 { 301 ENABLE_AST 302 return; 303 } 290 304 if(!itsDataOutSize) 291 305 { … … 301 315 memcpy(itsDataOut, data, (size_t)size); 302 316 itsSizeOut = size; 317 ENABLE_AST 303 318 } 304 319 … … 776 791 { 777 792 // itsTagId = 0; 793 itsId = 0; 794 itsName = 0; 778 795 } 779 796 780 797 DimService::DimService(const char *name, int &value) 781 798 { 799 itsId = 0; 800 itsName = 0; 782 801 itsData = &value; 783 802 itsSize = sizeof(int); … … 788 807 DimService::DimService(const char *name, float &value) 789 808 { 809 itsId = 0; 810 itsName = 0; 790 811 itsData = &value; 791 812 itsSize = sizeof(float); … … 796 817 DimService::DimService(const char *name, double &value) 797 818 { 819 itsId = 0; 820 itsName = 0; 798 821 itsData = &value; 799 822 itsSize = sizeof(double); … … 804 827 DimService::DimService(const char *name, longlong &value) 805 828 { 829 itsId = 0; 830 itsName = 0; 806 831 itsData = &value; 807 832 itsSize = sizeof(longlong); … … 812 837 DimService::DimService(const char *name, short &value) 813 838 { 839 itsId = 0; 840 itsName = 0; 814 841 itsData = &value; 815 842 itsSize = sizeof(short); … … 820 847 DimService::DimService(const char *name, char *string) 821 848 { 849 itsId = 0; 850 itsName = 0; 822 851 itsData = string; 823 852 itsSize = (int)strlen(string)+1; … … 828 857 DimService::DimService(const char *name, char *format, void *structure, int size) 829 858 { 859 itsId = 0; 860 itsName = 0; 830 861 itsData = structure; 831 862 itsSize = size; … … 836 867 DimService::DimService(const char *name, char *format, DimServiceHandler *handler) 837 868 { 869 itsId = 0; 870 itsName = 0; 838 871 itsData = 0; 839 872 itsSize = 0; … … 844 877 DimService::DimService(const char *name, const char *format, void *structure, int size) 845 878 { 879 itsId = 0; 880 itsName = 0; 846 881 itsData = structure; 847 882 itsSize = size; … … 852 887 DimService::DimService(const char *name, const char *format, DimServiceHandler *handler) 853 888 { 889 itsId = 0; 890 itsName = 0; 854 891 itsData = 0; 855 892 itsSize = 0; … … 862 899 DimService::DimService(DimServerDns *dns, const char *name, int &value) 863 900 { 901 itsId = 0; 902 itsName = 0; 864 903 itsData = &value; 865 904 itsSize = sizeof(int); … … 870 909 DimService::DimService(DimServerDns *dns, const char *name, float &value) 871 910 { 911 itsId = 0; 912 itsName = 0; 872 913 itsData = &value; 873 914 itsSize = sizeof(float); … … 878 919 DimService::DimService(DimServerDns *dns, const char *name, double &value) 879 920 { 921 itsId = 0; 922 itsName = 0; 880 923 itsData = &value; 881 924 itsSize = sizeof(double); … … 886 929 DimService::DimService(DimServerDns *dns, const char *name, longlong &value) 887 930 { 931 itsId = 0; 932 itsName = 0; 888 933 itsData = &value; 889 934 itsSize = sizeof(longlong); … … 894 939 DimService::DimService(DimServerDns *dns, const char *name, short &value) 895 940 { 941 itsId = 0; 942 itsName = 0; 896 943 itsData = &value; 897 944 itsSize = sizeof(short); … … 902 949 DimService::DimService(DimServerDns *dns, const char *name, char *string) 903 950 { 951 itsId = 0; 952 itsName = 0; 904 953 itsData = string; 905 954 itsSize = (int)strlen(string)+1; … … 910 959 DimService::DimService(DimServerDns *dns, const char *name, char *format, void *structure, int size) 911 960 { 961 itsId = 0; 962 itsName = 0; 912 963 itsData = structure; 913 964 itsSize = size; … … 918 969 DimService::DimService(DimServerDns *dns, const char *name, char *format, DimServiceHandler *handler) 919 970 { 971 itsId = 0; 972 itsName = 0; 920 973 itsData = 0; 921 974 itsSize = 0; … … 927 980 DimService::DimService(DimServerDns *dns, const char *name, const char *format, void *structure, int size) 928 981 { 982 itsId = 0; 983 itsName = 0; 929 984 itsData = structure; 930 985 itsSize = size; … … 935 990 DimService::DimService(DimServerDns *dns, const char *name, const char *format, DimServiceHandler *handler) 936 991 { 992 itsId = 0; 993 itsName = 0; 937 994 itsData = 0; 938 995 itsSize = 0; … … 944 1001 DimService::~DimService() 945 1002 { 946 delete[] itsName; 1003 DISABLE_AST 1004 if(itsName) 1005 delete[] itsName; 947 1006 if(itsDataSize) 948 1007 delete[] (char *)itsData; 949 1008 // if(itsTagId) 950 1009 // id_free(itsTagId, SRC_DIS); 951 dis_remove_service( itsId ); 1010 if(itsId) 1011 dis_remove_service( itsId ); 1012 itsId = 0; 1013 ENABLE_AST 952 1014 } 953 1015 954 1016 int DimService::updateService() 955 1017 { 1018 if(!itsId) 1019 return 0; 956 1020 return dis_update_service( itsId ); 957 1021 } … … 959 1023 int DimService::updateService( int &value ) 960 1024 { 1025 if(!itsId) 1026 return 0; 961 1027 if( itsType == DisINT) 962 1028 { … … 969 1035 int DimService::updateService( float &value ) 970 1036 { 1037 if(!itsId) 1038 return 0; 971 1039 if( itsType == DisFLOAT) { 972 1040 itsData = &value; … … 978 1046 int DimService::updateService( double &value ) 979 1047 { 1048 if(!itsId) 1049 return 0; 980 1050 if( itsType == DisDOUBLE) { 981 1051 itsData = &value; … … 987 1057 int DimService::updateService( longlong &value ) 988 1058 { 1059 if(!itsId) 1060 return 0; 989 1061 if( itsType == DisXLONG) 990 1062 { … … 997 1069 int DimService::updateService( short &value ) 998 1070 { 1071 if(!itsId) 1072 return 0; 999 1073 if( itsType == DisSHORT) 1000 1074 { … … 1007 1081 int DimService::updateService( char *string ) 1008 1082 { 1083 if(!itsId) 1084 return 0; 1009 1085 if( itsType == DisSTRING) 1010 1086 { … … 1018 1094 int DimService::updateService( void *structure, int size ) 1019 1095 { 1096 if(!itsId) 1097 return 0; 1020 1098 if( itsType == DisPOINTER) 1021 1099 { … … 1029 1107 int DimService::selectiveUpdateService(int *cids) 1030 1108 { 1109 if(!itsId) 1110 return 0; 1031 1111 if( cids == 0) 1032 1112 { … … 1041 1121 int DimService::selectiveUpdateService( int &value, int *cids) 1042 1122 { 1123 if(!itsId) 1124 return 0; 1043 1125 if( itsType == DisINT) 1044 1126 { … … 1058 1140 int DimService::selectiveUpdateService( float &value, int *cids ) 1059 1141 { 1142 if(!itsId) 1143 return 0; 1060 1144 if( itsType == DisFLOAT) 1061 1145 { … … 1075 1159 int DimService::selectiveUpdateService( double &value, int *cids ) 1076 1160 { 1161 if(!itsId) 1162 return 0; 1077 1163 if( itsType == DisDOUBLE) 1078 1164 { … … 1092 1178 int DimService::selectiveUpdateService( longlong &value, int *cids ) 1093 1179 { 1180 if(!itsId) 1181 return 0; 1094 1182 if( itsType == DisXLONG) 1095 1183 { … … 1109 1197 int DimService::selectiveUpdateService( short &value, int *cids ) 1110 1198 { 1199 if(!itsId) 1200 return 0; 1111 1201 if( itsType == DisSHORT) 1112 1202 { … … 1126 1216 int DimService::selectiveUpdateService( char *string, int *cids ) 1127 1217 { 1218 if(!itsId) 1219 return 0; 1128 1220 if( itsType == DisSTRING) 1129 1221 { … … 1144 1236 int DimService::selectiveUpdateService( void *structure, int size, int *cids ) 1145 1237 { 1238 if(!itsId) 1239 return 0; 1146 1240 if( itsType == DisPOINTER) 1147 1241 { … … 1162 1256 void DimService::setQuality(int quality) 1163 1257 { 1258 if(!itsId) 1259 return; 1164 1260 dis_set_quality( itsId, quality ); 1165 1261 } … … 1167 1263 void DimService::setTimestamp(int secs, int millisecs) 1168 1264 { 1265 if(!itsId) 1266 return; 1169 1267 dis_set_timestamp( itsId, secs, millisecs ); 1170 1268 } … … 1357 1455 1358 1456 if(secs == 0) 1359 dis_get_timestamp(itsId, &secs, &millisecs); 1457 { 1458 DISABLE_AST 1459 if(itsId) 1460 dis_get_timestamp(itsId, &secs, &millisecs); 1461 ENABLE_AST 1462 } 1360 1463 return(secs); 1361 1464 } … … 1384 1487 DimCommand::~DimCommand() 1385 1488 { 1489 DISABLE_AST 1386 1490 delete[] itsName; 1387 1491 delete[] itsFormat; 1388 1492 // if(itsTagId) 1389 1493 // id_free(itsTagId, SRC_DIS); 1390 dis_remove_service( itsId ); 1494 if(itsId) 1495 dis_remove_service( itsId ); 1496 itsId = 0; 1497 ENABLE_AST 1391 1498 } 1392 1499 … … 1407 1514 DimRpc::~DimRpc() 1408 1515 { 1516 DISABLE_AST 1409 1517 delete[] itsName; 1410 1518 delete[] itsNameIn; … … 1412 1520 // if(itsTagId) 1413 1521 // id_free(itsTagId, SRC_DIS); 1414 dis_remove_service( itsIdIn ); 1415 dis_remove_service( itsIdOut ); 1522 if(itsIdIn) 1523 dis_remove_service( itsIdIn ); 1524 if(itsIdOut) 1525 dis_remove_service( itsIdOut ); 1526 itsIdIn = 0; 1527 itsIdOut = 0; 1528 ENABLE_AST 1416 1529 } 1417 1530
Note:
See TracChangeset
for help on using the changeset viewer.