LCOV - code coverage report
Current view: top level - flamenco/types - fd_types_meta.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 28 38 73.7 %
Date: 2025-07-01 05:00:49 Functions: 6 804 0.7 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_flamenco_types_fd_types_meta_h
       2             : #define HEADER_fd_src_flamenco_types_fd_types_meta_h
       3             : 
       4             : #include "../../util/fd_util_base.h"
       5             : #include "fd_bincode.h"
       6             : 
       7             : /* fd_types_meta.h provides reflection APIs for fd_types. */
       8             : 
       9             : /* FD_FLAMENCO_TYPE_{...} identifies kinds of nodes encountered in a
      10             :    bincode/borsh data structure graph. */
      11             : 
      12           9 : #define FD_FLAMENCO_TYPE_NULL      (0x00)
      13          12 : #define FD_FLAMENCO_TYPE_BOOL      (0x01)
      14        1104 : #define FD_FLAMENCO_TYPE_UCHAR     (0x02)
      15           0 : #define FD_FLAMENCO_TYPE_SCHAR     (0x03)
      16         336 : #define FD_FLAMENCO_TYPE_USHORT    (0x04)
      17           0 : #define FD_FLAMENCO_TYPE_SSHORT    (0x05)
      18         261 : #define FD_FLAMENCO_TYPE_UINT      (0x06)
      19           0 : #define FD_FLAMENCO_TYPE_SINT      (0x07)
      20        2946 : #define FD_FLAMENCO_TYPE_ULONG     (0x08)
      21          12 : #define FD_FLAMENCO_TYPE_SLONG     (0x09)
      22             : #if FD_HAS_INT128
      23           0 : #define FD_FLAMENCO_TYPE_UINT128   (0x0a)
      24           0 : #define FD_FLAMENCO_TYPE_SINT128   (0x0b)
      25             : #endif /* FD_HAS_INT128 */
      26           0 : #define FD_FLAMENCO_TYPE_FLOAT     (0x0c)
      27           0 : #define FD_FLAMENCO_TYPE_DOUBLE    (0x0d)
      28         558 : #define FD_FLAMENCO_TYPE_HASH256   (0x0e)  /* pubkey, account */
      29          96 : #define FD_FLAMENCO_TYPE_SIG512    (0x0f)
      30           0 : #define FD_FLAMENCO_TYPE_CSTR      (0x10)
      31           0 : #define FD_FLAMENCO_TYPE_HASH1024  (0x11)
      32           0 : #define FD_FLAMENCO_TYPE_HASH16384 (0x12)
      33        5442 : #define FD_FLAMENCO_TYPE_ENUM_DISC (0x13)
      34             : 
      35         321 : #define FD_FLAMENCO_TYPE_ARR       (0x20)
      36         150 : #define FD_FLAMENCO_TYPE_ARR_END   (0x21)
      37        1722 : #define FD_FLAMENCO_TYPE_MAP       (0x22)
      38         843 : #define FD_FLAMENCO_TYPE_MAP_END   (0x23)
      39        1197 : #define FD_FLAMENCO_TYPE_ENUM      (0x24)
      40         159 : #define FD_FLAMENCO_TYPE_ENUM_END  (0x25)
      41             : 
      42             : FD_PROTOTYPES_BEGIN
      43             : 
      44             : /* fd_flamenco_type_is_primitive returns 1 if type does not contain
      45             :    any child nodes.  Returns 0 otherwise. */
      46             : 
      47             : FD_FN_CONST static inline int
      48          63 : fd_flamenco_type_is_primitive( int type ) {
      49          63 :   return (type&0xe0)==0x00;
      50          63 : }
      51             : 
      52             : /* fd_flamenco_type_is_collection returns 1 if node type marks the
      53             :    beginning or end of a collection.  Returns 0 otherwise. */
      54             : 
      55             : FD_FN_CONST static inline int
      56        5211 : fd_flamenco_type_is_collection( int type ) {
      57        5211 :   return (type&0xe0)==0x20;
      58        5211 : }
      59             : 
      60             : /* fd_flamenco_type_is_collection_{begin,end} return 1 if collection
      61             :    type marks the beginning or end of a collection respectively. */
      62             : 
      63             : FD_FN_CONST static inline int
      64          12 : fd_flamenco_type_is_collection_begin( int type ) {
      65          12 :   return fd_flamenco_type_is_collection(type) && ((type&1)==0);
      66          12 : }
      67             : 
      68             : FD_FN_CONST static inline int
      69        5136 : fd_flamenco_type_is_collection_end( int type ) {
      70        5136 :   return fd_flamenco_type_is_collection(type) && ((type&1)!=0);
      71        5136 : }
      72             : 
      73             : FD_PROTOTYPES_END
      74             : 
      75             : #endif /* HEADER_fd_src_flamenco_types_fd_types_meta_h */

Generated by: LCOV version 1.14