CStructureInterpreter.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef CStructureInterpreter_h
  2. #define CStructureInterpreter_h
  3. #include <map>
  4. #include <unordered_set>
  5. #include <vector>
  6. #include <string>
  7. #include "CMethodInterface.h"
  8. #include "tinyxml2.h"
  9. namespace Chromium {
  10. class CStructureInterpreter
  11. {
  12. public:
  13. explicit CStructureInterpreter(const char* path);
  14. CMedthodInterface* getFunctionInterface(char* entityName, char* className, int methodID);
  15. std::vector<CMedthodInterface>* getAllMessageInterface(const char* entityName);
  16. bool checkEntityInservice(std::string entityName);
  17. private:
  18. // methods
  19. void getAllFiles();
  20. void loadXmlFiles();
  21. void loadEntityInterpreterFile();
  22. void parseXmlToMap(tinyxml2::XMLDocument& xml);
  23. void loadFunctionInterface(std::map<int, CMedthodInterface>& functionInterface, tinyxml2::XMLElement* pClass);
  24. void loadMessageInterface(std::vector<CMedthodInterface>& messageInterface, tinyxml2::XMLElement* pEntity);
  25. void loadParams(CTransStruct& params, tinyxml2::XMLElement* methodInterface);
  26. int convertStringToInt(std::string s);
  27. private:
  28. std::map<std::string, std::map<int, CMedthodInterface>> mMethodStructureMap;
  29. std::map<std::string, std::vector<CMedthodInterface>> mMessageStructureMap;
  30. std::string mPathOfXmls;
  31. std::vector<std::string> mFiles;
  32. std::unordered_set<std::string> m_inServiceEntity;
  33. };
  34. }
  35. #endif