![]() |
|
PhoenixProtocolBuffer
1.0.1
Set of tools to decode offset from protocol buffer
|
Parser of Field. More...
#include <FieldParser.h>
Collaboration diagram for FieldParser:Public Member Functions | |
| template<typename T> | |
| bool | addParseFieldArray (T **tabPtr, size_t *nbElement, const FieldConfig &field) |
| Add a sub FieldParser for a Array type. | |
| template<typename T> | |
| bool | addParseFieldArray (T **tabPtr, size_t *nbElement, const FieldConfig &field, const PString &childName) |
| Add a sub FieldParser for a Array type. | |
| template<typename T> | |
| void | addParseFieldArray (T **tabPtr, size_t *nbElement, size_t fieldId, const PString &fieldName="") |
| Add a sub FieldParser for a Array type. | |
| bool | addParseFieldEnum (size_t *varPtr, const FieldConfig &field) |
| Add a sub FieldParser for a enum type. | |
| bool | addParseFieldEnum (size_t *varPtr, const FieldConfig &field, const PString &childName) |
| Add a sub FieldParser for a enum type. | |
| void | addParseFieldEnum (size_t *varPtr, size_t fieldId, const PString &fieldName="") |
| Add a sub FieldParser for a enum type. | |
| template<typename T> | |
| bool | addParseFieldValue (T *varPtr, const FieldConfig &field) |
| Add a sub FieldParser for a Array type. | |
| template<typename T> | |
| bool | addParseFieldValue (T *varPtr, const FieldConfig &field, const PString &childName) |
| Add a sub FieldParser for a enum type. | |
| template<typename T> | |
| void | addParseFieldValue (T *varPtr, size_t fieldId, const PString &fieldName="") |
| Add a sub FieldParser for a scalar type. | |
| FieldParser * | addSubMessage (const FieldConfig &field) |
| Add a sub message into the FieldParser. | |
| FieldParser * | addSubMessage (const FieldConfig &field, const PString &childName) |
| Add a sub message into the FieldParser. | |
| FieldParser * | addSubMessage (FieldConfig &childConfig, const FieldConfig &field, const PString &childName) |
| Add a sub message into the FieldParser. | |
| FieldParser * | addSubMessage (size_t fieldId, const PString &fieldName="") |
| Add a sub message into the FieldParser. | |
| void | clear () |
| Clear all the children of the FieldParser. | |
| FieldParser () | |
| Default constructor of FieldParser. | |
| bool | load (const char *message, size_t nbByte, std::ostream &out=std::cerr) |
| Load the Fields of the FieldParser (without offset on the first time and with offsets after) | |
| bool | load (const std::vector< char > &message, std::ostream &out=std::cerr) |
| Load the Fields of the FieldParser (without offset on the first time and with offsets after) | |
| void | print (std::ostream &out=std::cout, const PString &indentation="") const |
| Print the FieldParser. | |
| void | resetOffset () |
| Reset the offset of the FieldParser. | |
| virtual | ~FieldParser () |
| Destructor of FieldParser. | |
Private Member Functions | |
| template<typename T> | |
| bool | checkInputType (const FieldConfig &field) |
| Check the template type with the FieldConfig. | |
| bool | checkInputType (FieldType::FieldType type, const FieldConfig &field) |
| Check if the type is compatible with the type in the FieldConfig. | |
| void | createMapFieldParser (MapFieldParser &mapFieldParser) |
| Create the map of Field parser. | |
| FieldParser * | createSubFieldParser (size_t fieldId, const PString &fieldName) |
| Add a sub FieldParser. | |
| void | initialisationFieldParser () |
| Initialisation function of the class FieldParser. | |
| bool | loadComputeFieldOffset (char *&iter, const char *endMessage, const char *message, size_t fieldId, size_t fieldType, std::ostream &out) |
| Compute FIeld offset. | |
| bool | loadComputeFieldOffsetArray (char *&iter, const char *endMessage, const char *message, std::ostream &out) |
| Compute FIeld offset of an array. | |
| bool | loadComputeOffset (char *&iter, const char *endMessage, const char *message, std::ostream &out) |
| Load the Fields and compute the offset. | |
| bool | loadFieldFromOffset (char *&iter) |
| Load the Field directly from the offset. | |
| bool | loadFromOffset (char *&iter) |
| Load the Fields directly from the offset. | |
| void | setBaseField (size_t fieldId, const PString &fieldName) |
| Set the basis of a Field to be parsed. | |
Private Attributes | |
| AbtractField | p_field |
| Field to be parsed. | |
| VecFieldParser | p_vecChildren |
| Children used to parse other field and sub messages. | |
Parser of Field.
Definition at line 19 of file FieldParser.h.
| FieldParser::FieldParser | ( | ) |
Default constructor of FieldParser.
Definition at line 15 of file FieldParser.cpp.
References initialisationFieldParser().
Referenced by addParseFieldArray(), addParseFieldEnum(), addParseFieldValue(), addSubMessage(), addSubMessage(), addSubMessage(), addSubMessage(), and createSubFieldParser().
Here is the call graph for this function:
Here is the caller graph for this function:
|
virtual |
Destructor of FieldParser.
Definition at line 20 of file FieldParser.cpp.
References clear().
Here is the call graph for this function:| bool FieldParser::addParseFieldArray | ( | T ** | tabPtr, |
| size_t * | nbElement, | ||
| const FieldConfig & | field ) |
Add a sub FieldParser for a Array type.
| tabPtr | : pointer to the table to be updated on the parsing of the protocol buffer message |
| nbElement | : pointer to the variable which will contain the number of element of the parsed array |
| field | : description of the field to be used |
Definition at line 87 of file FieldParser_impl.h.
References addParseFieldArray(), checkInputType(), FieldConfig::getId(), FieldConfig::getIsArray(), and FieldConfig::getName().
Here is the call graph for this function:| bool FieldParser::addParseFieldArray | ( | T ** | tabPtr, |
| size_t * | nbElement, | ||
| const FieldConfig & | field, | ||
| const PString & | childName ) |
Add a sub FieldParser for a Array type.
| tabPtr | : pointer to the table to be updated on the parsing of the protocol buffer message |
| nbElement | : pointer to the variable which will contain the number of element of the parsed array |
| field | : description of the field to be used |
| childName | : name of the child of the field to be used as description |
Definition at line 101 of file FieldParser_impl.h.
References addParseFieldArray(), and FieldConfig::getVecChildren().
Here is the call graph for this function:| void FieldParser::addParseFieldArray | ( | T ** | tabPtr, |
| size_t * | nbElement, | ||
| size_t | fieldId, | ||
| const PString & | fieldName = "" ) |
Add a sub FieldParser for a Array type.
| tabPtr | : pointer to the table to be updated on the parsing of the protocol buffer message |
| nbElement | : pointer to the variable which will contain the number of element of the parsed array |
| fieldId | : id of the field that contain the sub message |
| fieldName | : name of the field |
Definition at line 37 of file FieldParser_impl.h.
References createSubFieldParser(), FieldParser(), p_field, p_vecChildren, phoenix_fieldType(), AbtractField::setArrayPtr(), AbtractField::setIsArray(), AbtractField::setIsOffsetReady(), AbtractField::setNbElement(), AbtractField::setOffset(), AbtractField::setType(), and AbtractField::setTypeSize().
Referenced by addParseFieldArray(), and addParseFieldArray().
Here is the call graph for this function:
Here is the caller graph for this function:| bool FieldParser::addParseFieldEnum | ( | size_t * | varPtr, |
| const FieldConfig & | field ) |
Add a sub FieldParser for a enum type.
| varPtr | : pointer to the variable to be updated on the parsing of the protocol buffer message |
| field | : FieldConfig which describes the field |
Definition at line 102 of file FieldParser.cpp.
References addParseFieldEnum(), checkInputType(), FieldType::ENUM_TYPE, FieldConfig::getId(), and FieldConfig::getName().
Here is the call graph for this function:| bool FieldParser::addParseFieldEnum | ( | size_t * | varPtr, |
| const FieldConfig & | field, | ||
| const PString & | childName ) |
Add a sub FieldParser for a enum type.
| varPtr | : pointer to the variable to be updated on the parsing of the protocol buffer message |
| field | : FieldConfig which describes the field |
| childName | : name of the child of the field to be used as description |
Definition at line 114 of file FieldParser.cpp.
References addParseFieldEnum(), and FieldConfig::getVecChildren().
Here is the call graph for this function:| void FieldParser::addParseFieldEnum | ( | size_t * | varPtr, |
| size_t | fieldId, | ||
| const PString & | fieldName = "" ) |
Add a sub FieldParser for a enum type.
| varPtr | : pointer to the variable to be updated on the parsing of the protocol buffer message |
| fieldId | : id of the field that contain the sub message |
| fieldName | : name of the field |
Definition at line 85 of file FieldParser.cpp.
References createSubFieldParser(), FieldType::ENUM_TYPE, FieldParser(), p_field, p_vecChildren, AbtractField::setIsArray(), AbtractField::setIsOffsetReady(), AbtractField::setNbElement(), AbtractField::setOffset(), AbtractField::setType(), AbtractField::setTypeSize(), and AbtractField::setVarPtr().
Referenced by addParseFieldEnum(), and addParseFieldEnum().
Here is the call graph for this function:
Here is the caller graph for this function:| bool FieldParser::addParseFieldValue | ( | T * | varPtr, |
| const FieldConfig & | field ) |
Add a sub FieldParser for a Array type.
| varPtr | : pointer to the variable to be updated on the parsing of the protocol buffer message |
| field | : description of the field to be used |
Definition at line 56 of file FieldParser_impl.h.
References addParseFieldValue(), checkInputType(), FieldConfig::getId(), and FieldConfig::getName().
Here is the call graph for this function:| bool FieldParser::addParseFieldValue | ( | T * | varPtr, |
| const FieldConfig & | field, | ||
| const PString & | childName ) |
Add a sub FieldParser for a enum type.
| varPtr | : pointer to the variable to be updated on the parsing of the protocol buffer message |
| field | : FieldConfig which describes the field |
| childName | : name of the child of the field to be used as description |
Definition at line 69 of file FieldParser_impl.h.
References addParseFieldValue(), and FieldConfig::getVecChildren().
Here is the call graph for this function:| void FieldParser::addParseFieldValue | ( | T * | varPtr, |
| size_t | fieldId, | ||
| const PString & | fieldName = "" ) |
Add a sub FieldParser for a scalar type.
| varPtr | : pointer to the variable to be updated on the parsing of the protocol buffer message |
| fieldId | : id of the field that contain the sub message |
| fieldName | : name of the field |
Definition at line 18 of file FieldParser_impl.h.
References createSubFieldParser(), FieldParser(), p_field, p_vecChildren, phoenix_fieldType(), AbtractField::setIsArray(), AbtractField::setIsOffsetReady(), AbtractField::setNbElement(), AbtractField::setOffset(), AbtractField::setType(), AbtractField::setTypeSize(), and AbtractField::setVarPtr().
Referenced by addParseFieldValue(), and addParseFieldValue().
Here is the call graph for this function:
Here is the caller graph for this function:| FieldParser * FieldParser::addSubMessage | ( | const FieldConfig & | field | ) |
Add a sub message into the FieldParser.
| field | : description of the field |
Definition at line 40 of file FieldParser.cpp.
References addSubMessage(), checkInputType(), FieldParser(), FieldConfig::getId(), FieldConfig::getName(), and FieldType::SUBMESSAGE.
Here is the call graph for this function:| FieldParser * FieldParser::addSubMessage | ( | const FieldConfig & | field, |
| const PString & | childName ) |
Add a sub message into the FieldParser.
| field | : main description of the field |
| childName | : name of the child of the field to be used as description |
Definition at line 50 of file FieldParser.cpp.
References addSubMessage(), FieldParser(), and FieldConfig::getVecChildren().
Here is the call graph for this function:| FieldParser * FieldParser::addSubMessage | ( | FieldConfig & | childConfig, |
| const FieldConfig & | field, | ||
| const PString & | childName ) |
Add a sub message into the FieldParser.
| childConfig | : configuration of the child with name childName |
| field | : main description of the field |
| childName | : name of the child of the field to be used as description |
Definition at line 67 of file FieldParser.cpp.
References addSubMessage(), FieldParser(), and FieldConfig::getVecChildren().
Here is the call graph for this function:| FieldParser * FieldParser::addSubMessage | ( | size_t | fieldId, |
| const PString & | fieldName = "" ) |
Add a sub message into the FieldParser.
| fieldId | : id of the field that contain the sub message |
| fieldName | : name of the field |
Definition at line 29 of file FieldParser.cpp.
References createSubFieldParser(), FieldParser(), p_field, p_vecChildren, AbtractField::setType(), and FieldType::SUBMESSAGE.
Referenced by addSubMessage(), addSubMessage(), and addSubMessage().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Check the template type with the FieldConfig.
| field | : description of the field to be used |
Definition at line 117 of file FieldParser_impl.h.
References checkInputType(), and phoenix_fieldType().
Referenced by addParseFieldArray(), addParseFieldEnum(), addParseFieldValue(), addSubMessage(), and checkInputType().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Check if the type is compatible with the type in the FieldConfig.
| type | : type to be checked |
| field | : configuration to be used |
Definition at line 241 of file FieldParser.cpp.
References FieldConfig::getName(), FieldConfig::getType(), and phoenix_fieldTypeToStr().
Here is the call graph for this function:| void FieldParser::clear | ( | ) |
Clear all the children of the FieldParser.
Definition at line 160 of file FieldParser.cpp.
References p_vecChildren.
Referenced by ~FieldParser().
Here is the caller graph for this function:
|
private |
Create the map of Field parser.
| [out] | mapFieldParser | : Map of FieldParser to be created |
Definition at line 360 of file FieldParser.cpp.
References p_vecChildren.
Referenced by loadComputeOffset().
Here is the caller graph for this function:
|
private |
Add a sub FieldParser.
| fieldId | : id of the field that contain the sub message |
| fieldName | : name of the field |
Definition at line 221 of file FieldParser.cpp.
References FieldParser(), and setBaseField().
Referenced by addParseFieldArray(), addParseFieldEnum(), addParseFieldValue(), and addSubMessage().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Initialisation function of the class FieldParser.
Definition at line 212 of file FieldParser.cpp.
Referenced by FieldParser().
Here is the caller graph for this function:| bool FieldParser::load | ( | const char * | message, |
| size_t | nbByte, | ||
| std::ostream & | out = std::cerr ) |
Load the Fields of the FieldParser (without offset on the first time and with offsets after)
| message | : message to be parsed |
| nbByte | : number of bytes of the message |
| out | : output stream to be used |
Definition at line 140 of file FieldParser.cpp.
References loadComputeOffset(), loadFromOffset(), and p_field.
Here is the call graph for this function:| bool FieldParser::load | ( | const std::vector< char > & | message, |
| std::ostream & | out = std::cerr ) |
Load the Fields of the FieldParser (without offset on the first time and with offsets after)
| message | : message to be parsed |
| out | : output stream to be used |
Definition at line 130 of file FieldParser.cpp.
References load().
Referenced by load().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Compute FIeld offset.
| [out] | iter | : iterator on the message to be used |
| endMessage | : end of the message | |
| message | : message to be read | |
| fieldId | : id of the current field | |
| fieldType | : type of the current field | |
| out | : ostream to be used |
Definition at line 302 of file FieldParser.cpp.
References loadComputeFieldOffsetArray(), p_field, and phoenix_readVarInt().
Here is the call graph for this function:
|
private |
Compute FIeld offset of an array.
| [out] | iter | : iterator on the message to be used |
| endMessage | : end of the message | |
| message | : message to be read | |
| out | : ostream to be used |
Definition at line 337 of file FieldParser.cpp.
References loadComputeOffset(), p_field, phoenix_readVarInt(), and FieldType::SUBMESSAGE.
Referenced by loadComputeFieldOffset().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Load the Fields and compute the offset.
| [out] | iter | : iterator over the message to be parsed |
| endMessage | : address of the end of the message | |
| message | : message to be read | |
| out | : ostream to be used |
Definition at line 256 of file FieldParser.cpp.
References createMapFieldParser(), p_field, phoenix_field(), phoenix_fieldSkip(), phoenix_fieldTypeToStr(), phoenix_pbTypeToFieldType(), and print().
Referenced by load(), and loadComputeFieldOffsetArray().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Load the Field directly from the offset.
| [out] | iter | : iterator over the message to be parsed |
Definition at line 386 of file FieldParser.cpp.
References FieldType::ENUM_TYPE, p_field, and phoenix_readVarInt().
Referenced by loadFromOffset().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Load the Fields directly from the offset.
| [out] | iter | : iterator over the message to be parsed |
Definition at line 370 of file FieldParser.cpp.
References loadFieldFromOffset(), and p_vecChildren.
Referenced by load().
Here is the call graph for this function:
Here is the caller graph for this function:| void FieldParser::print | ( | std::ostream & | out = std::cout, |
| const PString & | indentation = "" ) const |
Print the FieldParser.
| [out] | out | : output stream to be used to print FieldParser information |
| indentation | : indentatio to be used for the print |
Definition at line 171 of file FieldParser.cpp.
References p_field, and p_vecChildren.
Referenced by loadComputeOffset().
Here is the caller graph for this function:| void FieldParser::resetOffset | ( | ) |
Reset the offset of the FieldParser.
Definition at line 151 of file FieldParser.cpp.
References p_field, and p_vecChildren.
|
private |
Set the basis of a Field to be parsed.
| fieldId | : id of the field that contain the sub message |
| fieldName | : name of the field |
Definition at line 231 of file FieldParser.cpp.
References p_field.
Referenced by createSubFieldParser().
Here is the caller graph for this function:
|
private |
Field to be parsed.
Definition at line 69 of file FieldParser.h.
Referenced by addParseFieldArray(), addParseFieldEnum(), addParseFieldValue(), addSubMessage(), load(), loadComputeFieldOffset(), loadComputeFieldOffsetArray(), loadComputeOffset(), loadFieldFromOffset(), print(), resetOffset(), and setBaseField().
|
private |
Children used to parse other field and sub messages.
Definition at line 71 of file FieldParser.h.
Referenced by addParseFieldArray(), addParseFieldEnum(), addParseFieldValue(), addSubMessage(), clear(), createMapFieldParser(), loadFromOffset(), print(), and resetOffset().