Changeset 978ccaf1 in mainline for uspace/app/bithenge/transform.h
 Timestamp:
 20120627T03:35:43Z (12 years ago)
 Branches:
 lfn, master, serial, ticket/834toolchainupdate, topic/msimupgrade, topic/simplifydevexport
 Children:
 600f5d1
 Parents:
 04a7435f
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

uspace/app/bithenge/transform.h
r04a7435f r978ccaf1 51 51 typedef struct bithenge_transform_ops { 52 52 /** @copydoc bithenge_transform_t::bithenge_transform_apply */ 53 int (*apply)(bithenge_transform_t * xform, bithenge_node_t *in, bithenge_node_t **out);53 int (*apply)(bithenge_transform_t *self, bithenge_node_t *in, bithenge_node_t **out); 54 54 /** @copydoc bithenge_transform_t::bithenge_transform_prefix_length */ 55 int (*prefix_length)(bithenge_transform_t * xform, bithenge_blob_t *blob, aoff64_t *out);55 int (*prefix_length)(bithenge_transform_t *self, bithenge_blob_t *blob, aoff64_t *out); 56 56 /** Destroy the transform. 57 * @param xform The transform. 58 * @return EOK on success or an error code from errno.h. */ 59 int (*destroy)(bithenge_transform_t *xform); 57 * @param self The transform. */ 58 void (*destroy)(bithenge_transform_t *self); 60 59 } bithenge_transform_ops_t; 61 60 62 61 /** Apply a transform. 63 62 * @memberof bithenge_transform_t 64 * @param xformThe transform.63 * @param self The transform. 65 64 * @param in The input tree. 66 65 * @param[out] out Where the output tree will be stored. 67 66 * @return EOK on success or an error code from errno.h. */ 68 static inline int bithenge_transform_apply(bithenge_transform_t * xform,67 static inline int bithenge_transform_apply(bithenge_transform_t *self, 69 68 bithenge_node_t *in, bithenge_node_t **out) 70 69 { 71 assert( xform);72 assert( xform>ops);73 return xform>ops>apply(xform, in, out);70 assert(self); 71 assert(self>ops); 72 return self>ops>apply(self, in, out); 74 73 } 75 74 … … 79 78 * subtransforms. 80 79 * @memberof bithenge_transform_t 81 * @param xformThe transform.80 * @param self The transform. 82 81 * @param blob The blob. 83 82 * @param[out] out Where the prefix length will be stored. 84 83 * @return EOK on success, ENOTSUP if not supported, or another error code from 85 84 * errno.h. */ 86 static inline int bithenge_transform_prefix_length(bithenge_transform_t * xform,85 static inline int bithenge_transform_prefix_length(bithenge_transform_t *self, 87 86 bithenge_blob_t *blob, aoff64_t *out) 88 87 { 89 assert( xform);90 assert( xform>ops);91 if (! xform>ops>prefix_length)88 assert(self); 89 assert(self>ops); 90 if (!self>ops>prefix_length) 92 91 return ENOTSUP; 93 return xform>ops>prefix_length(xform, blob, out);92 return self>ops>prefix_length(self, blob, out); 94 93 } 95 94 96 95 /** Increment a transform's reference count. 97 * @param xform The transform to reference. 98 * @return EOK on success or an error code from errno.h. */ 99 static inline int bithenge_transform_inc_ref(bithenge_transform_t *xform) 96 * @param self The transform to reference. */ 97 static inline void bithenge_transform_inc_ref(bithenge_transform_t *self) 100 98 { 101 assert(xform); 102 xform>refs++; 103 return EOK; 99 assert(self); 100 self>refs++; 104 101 } 105 102 106 103 /** Decrement a transform's reference count and free it if appropriate. 107 * @param xform The transform to dereference, or NULL. 108 * @return EOK on success or an error code from errno.h. */ 109 static inline int bithenge_transform_dec_ref(bithenge_transform_t *xform) 104 * @param self The transform to dereference, or NULL. */ 105 static inline void bithenge_transform_dec_ref(bithenge_transform_t *self) 110 106 { 111 if (!xform) 112 return EOK; 113 assert(xform>ops); 114 if (xform>refs == 0) 115 return xform>ops>destroy(xform); 116 return EOK; 107 if (!self) 108 return; 109 assert(self>ops); 110 if (self>refs == 0) 111 self>ops>destroy(self); 117 112 } 118 113 … … 127 122 extern bithenge_named_transform_t *bithenge_primitive_transforms; 128 123 129 int bithenge_ new_transform(bithenge_transform_t *xform,124 int bithenge_init_transform(bithenge_transform_t *self, 130 125 const bithenge_transform_ops_t *ops); 131 126
Note:
See TracChangeset
for help on using the changeset viewer.