Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

element Struct Reference

The representation of a tuple element in C code, in both the server and a C client. More...

#include <tuple.h>


Data Fields

int tag
union {
   int   i
   double   d
   struct {
      char *   ptr
      int   len
   }   s
data


Detailed Description

The representation of a tuple element in C code, in both the server and a C client.

Definition at line 114 of file tuple.h.


Field Documentation

double element::d
 

Double-precision floating-point value for a tuple element. Eight bytes on an Intel Linux box.

Definition at line 147 of file tuple.h.

union { ... } element::data
 

Since I'm only concerned with Linux running on Intel hardware, it's safe to say this union is an eight-byte field.

Referenced by LinuxTuple_to_PyTuple, main, make_tuple_internal, print_element, PyTuple_to_LinuxTuple, recv_tuple, send_tuple, tuple_double_field, tuple_int_field, tuple_string_field, and tuples_match.

int element::i
 

Integer value for a tuple element. Four bytes on an Intel Linux box.

Definition at line 142 of file tuple.h.

int element::len
 

The length of a string. We do not depend on zero-termination bytes for strings, because we want to be able to use strings to move arbitrary binary data around. Strings can be large.

Definition at line 166 of file tuple.h.

char* element::ptr
 

A pointer to the memory space for a string.

Definition at line 158 of file tuple.h.

struct { ... } element::s
 

String value for a tuple element. Strings can be ASCII strings, or they can be a handy efficient way to move around binary data, such as arrays of doubles or structs.

int element::tag
 

Data type for this element. The values are `i' for integer, `d' for double, `?' for wildcard, and `s' for string. Because the Intel architecture is little-endian, the ASCII character occupies the first byte in memory (and the first one to be shipped over the network) and the other three bytes are zeroes. That sounds inefficient, but if I declare ``char tag'', the storage size for ``struct element'' is still 12 bytes. The knowledge that those three bytes are zeroes could, in future, be used to compress the network protocol.

Since I'm only concerned with Linux running on Intel hardware, it's safe to say this is a four-byte little-endian field.

Definition at line 131 of file tuple.h.

Referenced by LinuxTuple_to_PyTuple, make_tuple_internal, print_element, PyTuple_to_LinuxTuple, recv_tuple, send_tuple, tuple_double_field, tuple_int_field, tuple_string_field, and tuples_match.


The documentation for this struct was generated from the following file:
Generated on Sun Mar 30 23:46:51 2003 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002