LCOV - code coverage report
Current view: top level - flamenco/types - fd_types_meta.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 27 38 71.1 %
Date: 2025-10-13 04:42:14 Functions: 6 1336 0.4 %

          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           3 : #define FD_FLAMENCO_TYPE_NULL      (0x00)
      13          15 : #define FD_FLAMENCO_TYPE_BOOL      (0x01)
      14         210 : #define FD_FLAMENCO_TYPE_UCHAR     (0x02)
      15           0 : #define FD_FLAMENCO_TYPE_SCHAR     (0x03)
      16           0 : #define FD_FLAMENCO_TYPE_USHORT    (0x04)
      17           0 : #define FD_FLAMENCO_TYPE_SSHORT    (0x05)
      18         240 : #define FD_FLAMENCO_TYPE_UINT      (0x06)
      19           0 : #define FD_FLAMENCO_TYPE_SINT      (0x07)
      20        2448 : #define FD_FLAMENCO_TYPE_ULONG     (0x08)
      21          15 : #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         561 : #define FD_FLAMENCO_TYPE_HASH256   (0x0e)  /* pubkey, account */
      29          18 : #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        3099 : #define FD_FLAMENCO_TYPE_ENUM_DISC (0x13)
      34             : 
      35          78 : #define FD_FLAMENCO_TYPE_ARR       (0x20)
      36          33 : #define FD_FLAMENCO_TYPE_ARR_END   (0x21)
      37        1404 : #define FD_FLAMENCO_TYPE_MAP       (0x22)
      38         744 : #define FD_FLAMENCO_TYPE_MAP_END   (0x23)
      39         693 : #define FD_FLAMENCO_TYPE_ENUM      (0x24)
      40          18 : #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        3153 : fd_flamenco_type_is_collection( int type ) {
      57        3153 :   return (type&0xe0)==0x20;
      58        3153 : }
      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        3078 : fd_flamenco_type_is_collection_end( int type ) {
      70        3078 :   return fd_flamenco_type_is_collection(type) && ((type&1)!=0);
      71        3078 : }
      72             : 
      73             : FD_PROTOTYPES_END
      74             : 
      75             : #endif /* HEADER_fd_src_flamenco_types_fd_types_meta_h */

Generated by: LCOV version 1.14