enhance bitfield copy
[babeltrace.git] / include / babeltrace / types.h
index 23fec0fcfcba89c48fd2715b30b55e0daa389b7a..ed3e7aca60fa8caba4085a12336f378d4e4afc76 100644 (file)
@@ -4,7 +4,7 @@
 /*
  * BabelTrace
  *
- * Type header
+ * Type Header
  *
  * Copyright (c) 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <babeltrace/format.h>
+
+struct type_class {
+       GQuark name;            /* type name */
+       size_t alignment;       /* type alignment, in bits */
+       /*
+        * Type copy function. Knows how to find the child type_class from the
+        * parent type_class.
+        */
+       size_t (*copy)(unsigned char *dest, const struct format *fdest, 
+                      const unsigned char *src, const struct format *fsrc,
+                      const struct type_class *type_class);
+};
+
+struct type_class_integer {
+       struct type_class p;
+       size_t len;             /* length, in bits. */
+       int byte_order;         /* byte order */
+       int signedness;
+};
+
+int integer_type_new(const char *name, size_t len, int byte_order,
+                    int signedness);
+
+struct type_class_bitfield {
+       struct type_class_integer p;
+       size_t start_offset;    /* offset from base address, in bits */
+};
+
+int bitfield_type_new(const char *name, size_t start_offset,
+                     size_t len, int byte_order, int signedness);
+
+struct type_class_float {
+       struct type_class p;
+       size_t mantissa_len;
+       size_t exp_len;
+       int byte_order;
+};
+
+struct type_class_enum {
+       struct type_class_bitfield;     /* inherit from bitfield */
+       struct enum_table *table;
+};
+
+struct type_class_struct {
+       struct type_class p;
+       /* TODO */
+};
+
+struct type_class *ctf_lookup_type(GQuark qname);
+int ctf_register_type(struct type_class *type_class);
+
 #endif /* _BABELTRACE_TYPES_H */
This page took 0.023855 seconds and 4 git commands to generate.