Apollo 10.0
自动驾驶开放平台
protocol_asensing.h 文件参考
#include <functional>
#include <map>
#include <memory>
#include <string>
#include <vector>
protocol_asensing.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

struct  InsType
 
class  ProtocolAsensing
 
class  Decode_0A
 
class  Decode_0B
 

函数

template<typename T >
toValue (const uint8_t *add, int &index)
 
template<typename T >
toValue (const char *add, int &index)
 
bool createFileAndWrite (const std::string &filename, const std::string &content)
 
bool AppendCsv (const std::string &filename, const std::vector< std::string > &data)
 

函数说明

◆ AppendCsv()

bool AppendCsv ( const std::string &  filename,
const std::vector< std::string > &  data 
)

在文件 protocol_asensing.cc194 行定义.

195 {
196 std::ofstream file(filename, std::ios_base::app);
197 if (!file.is_open()) {
198 std::cerr << "无法打开文件 " << filename << "\n";
199 return false;
200 }
201
202 std::ostringstream oss;
203 for (const auto& s : data) {
204 oss << s << ",";
205 }
206 std::string line = oss.str();
207 if (!line.empty()) {
208 line.pop_back(); // 删除最后一个逗号
209 }
210 line += "\n";
211
212 file << line;
213
214 file.close();
215 return true;
216}

◆ createFileAndWrite()

bool createFileAndWrite ( const std::string &  filename,
const std::string &  content 
)

在文件 protocol_asensing.cc172 行定义.

173 {
174 std::ifstream checkFile(filename);
175 if (checkFile.good()) {
176 std::cout << "文件已存在: " << filename << std::endl;
177 return false;
178 }
179 checkFile.close();
180
181 std::ofstream file(filename);
182 if (!file) {
183 std::cerr << "无法创建文件: " << filename << std::endl;
184 return false;
185 }
186
187 file << content << std::endl;
188 file.close();
189
190 std::cout << "已写入文件: " << filename << std::endl;
191 return true;
192}

◆ toValue() [1/2]

template<typename T >
T toValue ( const char *  add,
int &  index 
)

在文件 protocol_asensing.h76 行定义.

76 {
77 T result = *reinterpret_cast<const T*>(add + index);
78 index += sizeof(T);
79 return result;
80}

◆ toValue() [2/2]

template<typename T >
T toValue ( const uint8_t *  add,
int &  index 
)

在文件 protocol_asensing.h69 行定义.

69 {
70 T result = *reinterpret_cast<const T*>(add + index);
71 index += sizeof(T);
72 return result;
73}