5. Allowed fields in verticesΒΆ

For usage of vector types See Section 4, Vector types for details. Type support for fields is limited to the types in Types.hpp.

The following are not allowed as vertex fields

  • User-defined types are not allowed either as types in Vectors or as types.

  • Input, Output and InOut edges with user-defined types are not allowed.

  • Standard containers are not allowed, including those whose size is statically defined.

  • A non-static pointer to a supported type is not allowed.

  • A static pointer to a supported type is allowed but dynamic memory allocation via malloc() is not allowed, making it ineffectual.

The code example below clarifies what is allowed and not allowed as fields in vertices with the ones not allowed highlighted.

// User defined type
struct ComplexFloat {
  float a;
  float b;
};

// A vertex definition
class ProcessComplexFloat : public MultiVertex {
public:
  // User defined types are NOT allowed either as
  // types in Vectors or as types.
  Vector<Input<ComplexFloat>> x;
  ComplexFloat z;

  // Supported types are allowed
  Vector<Input<int>> y;

  // Standard containers are NOT allowed including those
  // whose size is statically defined
  unsigned aArray[10];
  std::vector<bool> bVector;
  std::array<unsigned, 10> cArray;

  // A single element of a supported type is allowed
  unsigned singleValue;

  // A non-static pointer to a supported type is NOT allowed
  short *ptrToShort;

  // A static pointer to supported type is allowed but dynamic
  // memory allocation via malloc is NOT allowed, making it
  // ineffectual.
  static int *staticPtrToInt;

  // An Input/Output/InOut edge with user defined type is NOT allowed
  Input<ComplexFloat> in;

  // An Input/Output/InOut edge with supported type is allowed
  Output<float> out;


  bool compute() {
    return true;

  }

};