XNSim/XNModelGenServer/XNModelGen.h

72 lines
1.8 KiB
C++

#pragma once
#include <string>
#include <vector>
struct InterfaceStructInfo {
std::string originalName;
std::string structType;
std::string structName;
bool isPointer;
bool isNumeric;
};
class XNModelGen
{
public:
XNModelGen();
~XNModelGen();
int Initialize(const std::string &className, const std::string &version,
const std::string &planeName, std::string &errorMsg);
int GenerateCode(std::string &errorMsg);
const std::string &GetCodePath() const;
private:
std::string GetXNCorePath();
std::string UpperCase(const std::string &str);
std::vector<std::string> SplitString(const std::string &str);
bool IsPointer(const std::string &str);
bool IsNumeric(const std::string &str);
void ParseStructName(const std::string &str, std::string &interfaceName,
std::string &structName);
void ParseStructOriginalName(InterfaceStructInfo &structInfo);
bool GenerateHeaderFile();
bool GenerateSourceFile();
bool GenerateCMakeLists();
bool GenerateConfigFile();
private:
std::string m_planeName;
std::string m_className;
std::string m_version;
int m_confID;
std::string m_name;
std::string m_author;
std::string m_description;
std::string m_createTime;
std::string m_changeTime;
std::string m_runFreq;
std::string m_runNode;
std::string m_priority;
std::string m_dataPackagePath;
std::string m_dataPackageName;
std::string m_dataPackageHeaderName;
std::string m_dataPackageEntryPoint;
std::string m_dataPackageInterfaceName;
bool m_hasDataPackage;
InterfaceStructInfo m_inputStructName;
std::string m_inputStructName_Interface;
InterfaceStructInfo m_outputStructName;
std::string m_outputStructName_Interface;
InterfaceStructInfo m_heartStructName;
std::string m_heartStructName_Interface;
std::string m_confName;
std::string m_workPath;
std::string m_modelsPath;
std::string m_codePath;
std::vector<std::string> m_cmdList;
};