Selaa lähdekoodia

修改boost判断子节点为空

caizm 2 vuotta sitten
vanhempi
säilyke
42a5fefe54
21 muutettua tiedostoa jossa 35 lisäystä ja 34 poistoa
  1. 1 15
      CAE_Solution/src/Rabbitmq/rabbitClient/rabbitclient.cpp
  2. 30 18
      CAE_Solution/src/threadPool_and_statemachine/dealWith/boostjsonobject.cpp
  3. 1 0
      CAE_Solution/src/threadPool_and_statemachine/dealWith/boostjsonobject.h
  4. 2 0
      CAE_Solution/src/threadPool_and_statemachine/dealWith/display_struct.h
  5. 1 1
      CAE_Solution/src/threadPool_and_statemachine/dealWith/handlepool.cpp
  6. BIN
      build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/ResultMeshManager.o
  7. BIN
      build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/boostjsonobject.o
  8. BIN
      build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/cmdmainprocess.o
  9. BIN
      build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/contourdisplay.o
  10. BIN
      build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/handlepool.o
  11. BIN
      build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/linedisplay.o
  12. BIN
      build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/main.o
  13. BIN
      build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/moc_handlepool.o
  14. BIN
      build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/rabbitclient.o
  15. BIN
      build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/resultvtkmanager.o
  16. BIN
      build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/rwritefile.o
  17. BIN
      build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/slicewidget.o
  18. BIN
      build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/solidsurfacewidget.o
  19. BIN
      build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/src
  20. BIN
      build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/streamwidget.o
  21. BIN
      build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/vectordisplay.o

+ 1 - 15
CAE_Solution/src/Rabbitmq/rabbitClient/rabbitclient.cpp

@@ -181,7 +181,7 @@ int rabbitClient::recvMsg()
                 //-----------去除paramjson里面的多余转义字符--------------------//
                 int num1 = t.find_first_of('{',0);
                 int num2 = t.find_first_of('}',0);
-                int num3 = t.find_last_of('}',0);
+                int num3 = t.find_last_of('}');
                 if(num2 == num3){//*****************{**********}*****************
                     if(num1!=-1){
                         string first_t;
@@ -208,25 +208,11 @@ int rabbitClient::recvMsg()
                     t = original_t;
                     array_end_t = t.substr(num3);//}***********
                     array_middle_t = original_t.substr(num1+1,num3-num1-1);//****{*****}**{****}**{****}**
-                    bool judge_flag = false;
                     for(int i=0;i<array_middle_t.size();i++){
-                        if(!judge_flag){
                             if(array_middle_t[i]== '"'){
                                 last_t += '\\';
-                            }else if(array_middle_t[i] == '{'){
-                                judge_flag = true;
                             }
                             last_t+=array_middle_t[i];
-                        }else{
-                            if(array_middle_t[i]== '"'){
-                                last_t += '\\';
-                                last_t += '\\';
-                                last_t += '\\';
-                            }else if(array_middle_t[i] == '}'){
-                                judge_flag = false;
-                            }
-                            last_t+=array_middle_t[i];
-                        }
                     }
                     t = '{'+array_first_t+last_t+array_end_t+'}';
                 }

+ 30 - 18
CAE_Solution/src/threadPool_and_statemachine/dealWith/boostjsonobject.cpp

@@ -79,7 +79,9 @@ boostJsonObject::~boostJsonObject()
  */
 void boostJsonObject::FromJson(std::string msg)
 {
+    cout<<"__________________________"<<endl;
     cout<<msg<<endl;
+    cout<<"__________________________"<<endl;
     stringstream msgs(msg);
     boost::property_tree::ptree root;
     boost::property_tree::read_json(msgs,root);//boost 方法
@@ -503,14 +505,16 @@ void boostJsonObject::FromParamJson(string param)
 
         try{
             boost::property_tree::ptree tetra_data = root.get_child("tetraParam");
-
-            da_struct->TetraParam_ = true;
-            da_struct->tetraParam->components = tetra_data.get<std::string>("components");
-            da_struct->tetraParam->gradation = tetra_data.get<std::string>("gradation");
-            da_struct->tetraParam->min_size = tetra_data.get<std::string>("min_size");
-            da_struct->tetraParam->max_size = tetra_data.get<std::string>("max_size");
-            da_struct->style = 1;
-
+            if(!tetra_data.empty()){
+                da_struct->TetraParam_ = true;
+                da_struct->tetraParam->components = tetra_data.get<std::string>("components");
+                da_struct->tetraParam->gradation = tetra_data.get<std::string>("gradation");
+                da_struct->tetraParam->min_size = tetra_data.get<std::string>("min_size");
+                da_struct->tetraParam->max_size = tetra_data.get<std::string>("max_size");
+                da_struct->style = 1;
+            }else{
+                da_struct->TetraParam_ = false;
+            }
         }catch(myException &ex){
             std::cout<<"-----no TetraParam-----"<<std::endl;
             throw myException("tetraParam miss some parameters!");
@@ -519,9 +523,13 @@ void boostJsonObject::FromParamJson(string param)
 
         try{
             boost::property_tree::ptree hexa_data = root.get_child("hexaParam");
-            da_struct->HexaParam_ = true;
-            da_struct->hexaParam->components = hexa_data.get<std::string>("components");
-            da_struct->style = 2;
+            if(!hexa_data.empty()){
+                da_struct->HexaParam_ = true;
+                da_struct->hexaParam->components = hexa_data.get<std::string>("components");
+                da_struct->style = 2;
+            }else{
+                da_struct->HexaParam_ = false;
+            }
         }catch(myException &ex){
             std::cout<<"-----no HexaParam-----"<<std::endl;
             throw myException("hexaParam miss some parameters!");
@@ -530,13 +538,17 @@ void boostJsonObject::FromParamJson(string param)
 
         try{
             boost::property_tree::ptree hybrid_data = root.get_child("hybridParam");
-            da_struct->HybridParaml_ = true;
-            da_struct->hybridParam->HybridStyle = hybrid_data.get<std::string>("element_generation");
-            da_struct->style = 3;
-            da_struct->hybridParam->number_of_boundary_layers = hybrid_data.get<std::string>("number_of_boundary_layers");
-            da_struct->hybridParam->normal_direction = hybrid_data.get<std::string>("normal_direction");
-            da_struct->hybridParam->boundary_layer_global_initial_height = hybrid_data.get<std::string>("boundary_layer_global_initial_height");
-            da_struct->hybridParam->boundary_layer_geometric_progression = hybrid_data.get<std::string>("boundary_layer_geometric_progression");
+            if(!hybrid_data.empty()){
+                da_struct->HybridParaml_ = true;
+                da_struct->hybridParam->HybridStyle = hybrid_data.get<std::string>("element_generation");
+                da_struct->style = 3;
+                da_struct->hybridParam->number_of_boundary_layers = hybrid_data.get<std::string>("number_of_boundary_layers");
+                da_struct->hybridParam->normal_direction = hybrid_data.get<std::string>("normal_direction");
+                da_struct->hybridParam->boundary_layer_global_initial_height = hybrid_data.get<std::string>("boundary_layer_global_initial_height");
+                da_struct->hybridParam->boundary_layer_geometric_progression = hybrid_data.get<std::string>("boundary_layer_geometric_progression");
+            }else{
+                da_struct->HybridParaml_ = false;
+            }
         }catch(myException &ex){
             std::cout<<"-----no HybridParam-----"<<std::endl;
             throw myException("hybridParam miss some parameters!");

+ 1 - 0
CAE_Solution/src/threadPool_and_statemachine/dealWith/boostjsonobject.h

@@ -1,6 +1,7 @@
 #ifndef BOOSTJSONOBJECT_H
 #define BOOSTJSONOBJECT_H
 #include "display_struct.h"
+#include <boost/optional.hpp>
 #include <boost/property_tree/ptree.hpp>
 #include <boost/property_tree/json_parser.hpp>
 #include "../../VTK/widget/slicedisplaywidget.h"

+ 2 - 0
CAE_Solution/src/threadPool_and_statemachine/dealWith/display_struct.h

@@ -2,6 +2,8 @@
 #define DISPLAY_STRUCT_H
 #include <string>
 #include <vector>
+#include <stdlib.h>
+#include <stdexcept>
 using namespace std;
 //云图/等值线msg结构体
 class contourDisplay_struct

+ 1 - 1
CAE_Solution/src/threadPool_and_statemachine/dealWith/handlepool.cpp

@@ -203,7 +203,7 @@ void handlePool::operateRender(boostJsonObject* object,QVTKRenderer* render_)
     }else if(object->action == "animation"){
         result_contourinimationdisplay(object,render_);
         return;
-    }else if(object->action == "readIgs")
+    }else if(object->action == "meshSplit")
     {
         if(!result_readIgsFile(object,render_))
         {

BIN
build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/ResultMeshManager.o


BIN
build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/boostjsonobject.o


BIN
build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/cmdmainprocess.o


BIN
build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/contourdisplay.o


BIN
build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/handlepool.o


BIN
build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/linedisplay.o


BIN
build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/main.o


BIN
build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/moc_handlepool.o


BIN
build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/rabbitclient.o


BIN
build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/resultvtkmanager.o


BIN
build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/rwritefile.o


BIN
build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/slicewidget.o


BIN
build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/solidsurfacewidget.o


BIN
build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/src


BIN
build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/streamwidget.o


BIN
build-CAE_Solution-Desktop_Qt_5_10_1_GCC_64bit-Debug/src/vectordisplay.o