VCC datatypes

VCC supports complex, user defined datatypes much like C itself. This section explains how to define your own datatypes and create messages of that type, which can then be sent between blocks.

Defining a new datatype

Before you can use a datatype, it must be defined in the VCC datatye window as follows:

VCC datatypes
VCC datatypes window
  1. Open the datatype window by clicking edit/datatypes.
  2. Right-click on the type of object that you want to create and choose new .... In this example, we'll create a new composite datatype, so right-click on composite and select new derived composite.
  3. A new entry will be created at the bottom of the composite list (it will have a pen symbol in the pen column). Double-click the name of the new entry and enter your own namespace and name in the format @namespace.name. For this example, lets call it @tutorial_2002.composite1.
  4. Now add some fields to the composite by right-clicking the name and choosing new composite field. Supply a name for the field and choose its datatype. Note that this can be any datatype that has already been defined in VCC.
  5. Once you are finished, click Apply followed by save and finally close.

Using the new datatype

Now we can create a message of type @tutorial_2002.composite1 and output it through a port using the following white box C code.

Using a composite datatype
Whitebox C code to create and send a composite datatype

Here's the corresponding code to read the message when it reaches its destination.

Receiving a composite message
Whitebox C code to receive a composite message

Before the above code will compile, you may need to edit the white.interface.h files of the blocks that use the new datatype. To do this, right-click on the code window of each block, choose edit white_interface.h and add the following lines:

These lines should appear between the existing #ifndef and #endif processing directives. If your behaviour includes a port to send/receive messages of the new datatype, the above lines will have been added automatically.

Home...


#pragma vccType screen_buffer Stratego */ ?>