Qi Yao / LinkNode---test123

Dependencies:   mbed

Fork of LinkNode-Test by Qi Yao

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pb_common.h Source File

pb_common.h

00001 /* pb_common.h: Common support functions for pb_encode.c and pb_decode.c.
00002  * These functions are rarely needed by applications directly.
00003  */
00004 
00005 #ifndef PB_COMMON_H_INCLUDED
00006 #define PB_COMMON_H_INCLUDED
00007 
00008 #include "pb.h"
00009 
00010 #ifdef __cplusplus
00011 extern "C" {
00012 #endif
00013 
00014 /* Iterator for pb_field_t list */
00015 struct pb_field_iter_s {
00016     const pb_field_t *start;       /* Start of the pb_field_t array */
00017     const pb_field_t *pos;         /* Current position of the iterator */
00018     unsigned required_field_index; /* Zero-based index that counts only the required fields */
00019     void *dest_struct;             /* Pointer to start of the structure */
00020     void *pData;                   /* Pointer to current field value */
00021     void *pSize;                   /* Pointer to count/has field */
00022 };
00023 typedef struct pb_field_iter_s pb_field_iter_t;
00024 
00025 /* Initialize the field iterator structure to beginning.
00026  * Returns false if the message type is empty. */
00027 bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_field_t *fields, void *dest_struct);
00028 
00029 /* Advance the iterator to the next field.
00030  * Returns false when the iterator wraps back to the first field. */
00031 bool pb_field_iter_next(pb_field_iter_t *iter);
00032 
00033 /* Advance the iterator until it points at a field with the given tag.
00034  * Returns false if no such field exists. */
00035 bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag);
00036 
00037 #ifdef __cplusplus
00038 } /* extern "C" */
00039 #endif
00040 
00041 #endif