next up previous contents index
Next: 2.5 Error handling Up: 2. The C Interface Previous: 2.3 Windows

  
2.4 Accessing UDI_object data

The user can directly access the data in a UDI object. Since UDI supports multi-processor environments, the first step is to create a buffer  on the host. There are two routines to do this. The first creates a buffer big enough for the entire UDI object, the second creates a buffer for part of an object.    

void *create_host_buffer(object)
   UDI_object object;

void *create_part_host_buffer(object, offset, num)
   UDI_object object;
   int offset;        /* the element offset into the object */
   int num; /* the number of elements */
After creating the buffer on the host, data can be copied to or from the object. For copying data from a buffer on the host to a UDI object:

   

void put_object(buffer, object)
   void *buffer;
   UDI_object object;

void put_part_object(buffer, object, offset, num)
   void *buffer;
   UDI_object object;
   int offset, num;
For copying data from a UDI object to a buffer on the host:

   

void get_object(buffer, object)
   void *buffer;
   UDI_object object;

void get_part_object(buffer, object, offset, num)
   void *buffer;
   UDI_object object;
   int offset, num;
When the user no longer needs the host buffer, it should be freed using the standard library routine, free".

For scalars , there also exist the routines:    

void put_scalar(value, object)
   void *value; /* pointer to a short, long, float, or double */
   UDI_object object; /* the scalar receiving a new value */

void get_scalar(value, object)
   void *value;
   UDI_object object; /* the scalar from which we're getting a value */



Diemo Schwarz
1999-03-04