Merge "Remove kBytesFieldAtoms from atoms_info" into rvc-dev am: 4d57eccd1d am: 01a94e2a02
Change-Id: I3f8463e6cb3d4dc32de565ecb2673f9a73ba368e
This commit is contained in:
@@ -357,30 +357,7 @@ void writeFieldValueTreeToStreamHelper(int tagId, const std::vector<FieldValue>&
|
|||||||
protoOutput->write(FIELD_TYPE_FLOAT | fieldNum, dim.mValue.float_value);
|
protoOutput->write(FIELD_TYPE_FLOAT | fieldNum, dim.mValue.float_value);
|
||||||
break;
|
break;
|
||||||
case STRING: {
|
case STRING: {
|
||||||
bool isBytesField = false;
|
protoOutput->write(FIELD_TYPE_STRING | fieldNum, dim.mValue.str_value);
|
||||||
// Bytes field is logged via string format in log_msg format. So here we check
|
|
||||||
// if this string field is a byte field.
|
|
||||||
std::map<int, std::vector<int>>::const_iterator itr;
|
|
||||||
if (depth == 0 && (itr = AtomsInfo::kBytesFieldAtoms.find(tagId)) !=
|
|
||||||
AtomsInfo::kBytesFieldAtoms.end()) {
|
|
||||||
const std::vector<int>& bytesFields = itr->second;
|
|
||||||
for (int bytesField : bytesFields) {
|
|
||||||
if (bytesField == fieldNum) {
|
|
||||||
// This is a bytes field
|
|
||||||
isBytesField = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isBytesField) {
|
|
||||||
if (dim.mValue.str_value.length() > 0) {
|
|
||||||
protoOutput->write(FIELD_TYPE_MESSAGE | fieldNum,
|
|
||||||
(const char*)dim.mValue.str_value.c_str(),
|
|
||||||
dim.mValue.str_value.length());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
protoOutput->write(FIELD_TYPE_STRING | fieldNum, dim.mValue.str_value);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STORAGE:
|
case STORAGE:
|
||||||
|
|||||||
@@ -55,8 +55,7 @@ AtomDecl::AtomDecl(const AtomDecl &that)
|
|||||||
resetState(that.resetState),
|
resetState(that.resetState),
|
||||||
nested(that.nested),
|
nested(that.nested),
|
||||||
uidField(that.uidField),
|
uidField(that.uidField),
|
||||||
whitelisted(that.whitelisted),
|
whitelisted(that.whitelisted) {}
|
||||||
binaryFields(that.binaryFields) {}
|
|
||||||
|
|
||||||
AtomDecl::AtomDecl(int c, const string& n, const string& m)
|
AtomDecl::AtomDecl(int c, const string& n, const string& m)
|
||||||
:code(c),
|
:code(c),
|
||||||
@@ -422,10 +421,6 @@ int collate_atom(const Descriptor *atom, AtomDecl *atomDecl,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Binary field validity is already checked above.
|
|
||||||
if (isBinaryField) {
|
|
||||||
atomDecl->binaryFields.push_back(it->first);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return errorCount;
|
return errorCount;
|
||||||
|
|||||||
@@ -147,8 +147,6 @@ struct AtomDecl {
|
|||||||
|
|
||||||
bool whitelisted = false;
|
bool whitelisted = false;
|
||||||
|
|
||||||
vector<int> binaryFields;
|
|
||||||
|
|
||||||
AtomDecl();
|
AtomDecl();
|
||||||
AtomDecl(const AtomDecl& that);
|
AtomDecl(const AtomDecl& that);
|
||||||
AtomDecl(int code, const string& name, const string& message);
|
AtomDecl(int code, const string& name, const string& message);
|
||||||
|
|||||||
@@ -47,9 +47,6 @@ static void write_atoms_info_header_body(FILE* out, const Atoms& atoms) {
|
|||||||
fprintf(out,
|
fprintf(out,
|
||||||
" const static std::map<int, StateAtomFieldOptions> "
|
" const static std::map<int, StateAtomFieldOptions> "
|
||||||
"kStateAtomsFieldOptions;\n");
|
"kStateAtomsFieldOptions;\n");
|
||||||
fprintf(out,
|
|
||||||
" const static std::map<int, std::vector<int>> "
|
|
||||||
"kBytesFieldAtoms;\n");
|
|
||||||
fprintf(out,
|
fprintf(out,
|
||||||
" const static std::set<int> kWhitelistedAtoms;\n");
|
" const static std::set<int> kWhitelistedAtoms;\n");
|
||||||
fprintf(out, "};\n");
|
fprintf(out, "};\n");
|
||||||
@@ -175,35 +172,6 @@ static void write_atoms_info_cpp_body(FILE* out, const Atoms& atoms) {
|
|||||||
"const std::map<int, StateAtomFieldOptions> "
|
"const std::map<int, StateAtomFieldOptions> "
|
||||||
"AtomsInfo::kStateAtomsFieldOptions = "
|
"AtomsInfo::kStateAtomsFieldOptions = "
|
||||||
"getStateAtomFieldOptions();\n");
|
"getStateAtomFieldOptions();\n");
|
||||||
|
|
||||||
fprintf(out,
|
|
||||||
"static std::map<int, std::vector<int>> "
|
|
||||||
"getBinaryFieldAtoms() {\n");
|
|
||||||
fprintf(out, " std::map<int, std::vector<int>> options;\n");
|
|
||||||
for (set<AtomDecl>::const_iterator atom = atoms.decls.begin();
|
|
||||||
atom != atoms.decls.end(); atom++) {
|
|
||||||
if (atom->binaryFields.size() == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
fprintf(out,
|
|
||||||
"\n // Adding binary fields for atom "
|
|
||||||
"(%d)%s\n",
|
|
||||||
atom->code, atom->name.c_str());
|
|
||||||
|
|
||||||
for (const auto& field : atom->binaryFields) {
|
|
||||||
fprintf(out, " options[%d /* %s */].push_back(%d);\n",
|
|
||||||
atom->code, make_constant_name(atom->name).c_str(), field);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(out, " return options;\n");
|
|
||||||
fprintf(out, "}\n");
|
|
||||||
|
|
||||||
fprintf(out,
|
|
||||||
"const std::map<int, std::vector<int>> "
|
|
||||||
"AtomsInfo::kBytesFieldAtoms = "
|
|
||||||
"getBinaryFieldAtoms();\n");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_atoms_info_header(FILE* out, const Atoms &atoms, const string& namespaceStr) {
|
int write_atoms_info_header(FILE* out, const Atoms &atoms, const string& namespaceStr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user