LCOV - code coverage report
Current view: top level - flamenco/types - fd_types_meta.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 26 37 70.3 %
Date: 2025-11-29 04:46:19 Functions: 6 1396 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         228 : #define FD_FLAMENCO_TYPE_UINT      (0x06)
      19           0 : #define FD_FLAMENCO_TYPE_SINT      (0x07)
      20        2412 : #define FD_FLAMENCO_TYPE_ULONG     (0x08)
      21          15 : #define FD_FLAMENCO_TYPE_SLONG     (0x09)
      22           0 : #define FD_FLAMENCO_TYPE_UINT128   (0x0a)
      23           0 : #define FD_FLAMENCO_TYPE_SINT128   (0x0b)
      24           0 : #define FD_FLAMENCO_TYPE_FLOAT     (0x0c)
      25           0 : #define FD_FLAMENCO_TYPE_DOUBLE    (0x0d)
      26         525 : #define FD_FLAMENCO_TYPE_HASH256   (0x0e)  /* pubkey, account */
      27           0 : #define FD_FLAMENCO_TYPE_SIG512    (0x0f)
      28           0 : #define FD_FLAMENCO_TYPE_CSTR      (0x10)
      29           0 : #define FD_FLAMENCO_TYPE_HASH16384 (0x12)
      30        2982 : #define FD_FLAMENCO_TYPE_ENUM_DISC (0x13)
      31             : 
      32          78 : #define FD_FLAMENCO_TYPE_ARR       (0x20)
      33          33 : #define FD_FLAMENCO_TYPE_ARR_END   (0x21)
      34        1374 : #define FD_FLAMENCO_TYPE_MAP       (0x22)
      35         729 : #define FD_FLAMENCO_TYPE_MAP_END   (0x23)
      36         660 : #define FD_FLAMENCO_TYPE_ENUM      (0x24)
      37           9 : #define FD_FLAMENCO_TYPE_ENUM_END  (0x25)
      38             : 
      39             : FD_PROTOTYPES_BEGIN
      40             : 
      41             : /* fd_flamenco_type_is_primitive returns 1 if type does not contain
      42             :    any child nodes.  Returns 0 otherwise. */
      43             : 
      44             : FD_FN_CONST static inline int
      45          63 : fd_flamenco_type_is_primitive( int type ) {
      46          63 :   return (type&0xe0)==0x00;
      47          63 : }
      48             : 
      49             : /* fd_flamenco_type_is_collection returns 1 if node type marks the
      50             :    beginning or end of a collection.  Returns 0 otherwise. */
      51             : 
      52             : FD_FN_CONST static inline int
      53        3054 : fd_flamenco_type_is_collection( int type ) {
      54        3054 :   return (type&0xe0)==0x20;
      55        3054 : }
      56             : 
      57             : /* fd_flamenco_type_is_collection_{begin,end} return 1 if collection
      58             :    type marks the beginning or end of a collection respectively. */
      59             : 
      60             : FD_FN_CONST static inline int
      61          12 : fd_flamenco_type_is_collection_begin( int type ) {
      62          12 :   return fd_flamenco_type_is_collection(type) && ((type&1)==0);
      63          12 : }
      64             : 
      65             : FD_FN_CONST static inline int
      66        2979 : fd_flamenco_type_is_collection_end( int type ) {
      67        2979 :   return fd_flamenco_type_is_collection(type) && ((type&1)!=0);
      68        2979 : }
      69             : 
      70             : FD_PROTOTYPES_END
      71             : 
      72             : #endif /* HEADER_fd_src_flamenco_types_fd_types_meta_h */

Generated by: LCOV version 1.14