7#include "dico_replace_var.h"
18 fieldType = value & 7;
33 iter +=
sizeof(uint64_t);
39 iter +=
sizeof(uint32_t);
52 size_t dataOffset = iter - (
char*)message;
53 std::cout <<
"ByteArray/SubMessage(data_offset = " << dataOffset <<
", size = " << nbByte <<
")" << std::endl;
77 std::cout <<
"Unknown Type" << std::endl;
106 if(!parser_yml(dico, fileName)){
107 std::cerr <<
"phoenix_parseFieldConfig : cannot open yml file '"<<fileName<<
"'" << std::endl;
110 dico_replace_var(dico);
112 std::cerr <<
"phoenix_parseFieldConfig : cannot parse yml file '"<<fileName<<
"'" << std::endl;
126 const DicoValue * ymlField = dico.getMap(fieldConfigKey);
127 if(ymlField != NULL){
130 std::cerr <<
"phoenix_parseFieldConfig : FieldConfig definition '"<<fieldConfigKey<<
"' does not exist in yml file" << std::endl;
141 const MapDicoValue & mapChildren = dico.getMapChild();
142 for(MapDicoValue::const_iterator it(mapChildren.begin()); it != mapChildren.end(); ++it){
143 PString name(it->first);
144 size_t id(phoenix_load_value_from_config<size_t>(it->second,
"id", 0lu));
145 PString typeStr(phoenix_get_string(it->second,
"type",
"uint64"));
146 bool isArray(phoenix_load_value_from_config<bool>(it->second,
"is_array",
false));
152 std::cerr <<
"phoenix_parseFieldConfig : cannot parse 'sub_message' of Field '"<<name<<
"'" << std::endl;
158 std::cerr <<
"phoenix_parseFieldConfig : type '"<<typeStr<<
"' does not exist for Field '"<<name<<
"'. Please use one of :" << std::endl;
159 std::cerr <<
"\t- enum" << std::endl;
160 std::cerr <<
"\t- submessage" << std::endl;
161 std::cerr <<
"\t- uint64" << std::endl;
162 std::cerr <<
"\t- uint32" << std::endl;
163 std::cerr <<
"\t- uint16" << std::endl;
164 std::cerr <<
"\t- uint8" << std::endl;
165 std::cerr <<
"\t- int64" << std::endl;
166 std::cerr <<
"\t- int32" << std::endl;
167 std::cerr <<
"\t- int16" << std::endl;
168 std::cerr <<
"\t- int8" << std::endl;
181 char* iter = (
char*)message + offset;
182 size_t messageSize = nbByte - offset;
183 std::cout <<
"Field{" << std::endl;
184 while(iter < message + messageSize){
185 size_t fieldId(0lu), fieldType(0lu);
187 size_t fieldOffset = iter - (
char*)message;
188 std::cout <<
"\t- Field " << fieldId <<
" : field_offset = " << fieldOffset <<
", ";
191 std::cout <<
"}" << std::endl;
FieldType::FieldType phoenix_fieldTypeFromStr(const std::string &name)
Convert a string into a FieldType.
Configuration to be used to create a field from a yml file.
void setType(const FieldType::FieldType &type)
Sets the type of the FieldConfig.
void setId(size_t id)
Sets the id of the FieldConfig.
const std::map< PString, FieldConfig > & getVecChildren() const
Gets the vecChildren of the FieldConfig.
void setName(const PString &name)
Sets the name of the FieldConfig.
void setIsArray(bool isArray)
Sets the isArray of the FieldConfig.
FieldType
Type of the Field.
FieldConfig phoenix_createField(FieldType::FieldType type, size_t id, const PString &name, bool isArray)
Create a FieldConfig.
bool phoenix_parseFieldConfig(FieldConfig &field, const PPath &fileName, const PString &fieldConfigKey)
Parse a yml file and search for a field_config key.
void phoenix_field(size_t &fieldId, size_t &fieldType, char *&iter)
Reads a Field header.
void phoenix_fieldPrint(char *&iter, size_t fieldType, const char *message)
Print the current field.
void phoenix_fieldPrintArray(char *&iter, const char *message)
Print the current ByteArray.
void phoenix_fieldSkip(char *&iter, size_t fieldType)
Skip the current field.
void phoenix_printFieldMessage(const char *message, size_t nbByte, size_t offset)
Print the Fields in a message.
T phoenix_readValue(char *&iter)
Read a value.
size_t phoenix_readVarInt(char *&iter)
Reads and print a varint from protocol buffer.
void phoenix_skipVarInt(char *&iter)
Skips a varint.