4 Data Types

This chapter describes the different data types used in HARK  . The user needs to know about data types because of the following reasons:

Data types used in the node’s property settings

There are currently 6 data types that can be set in the properties of a node.

Type

Meaning

Data type level

int 

Integral type

Primitive type

float 

Single-precision floating point type

Primitive type

string 

String type

Primitive type

bool 

Logical type

Primitive type

Object 

Object type

HARK  -specific type

subnet_param 

Subnet parameter type

HARK  -specific type

The int , float , string  and bool data types have the same usage and specification as C++. Object  and subnet_param are HARK  -specific data types. Object  inherits the Object data type defined in the classes within HARK  . The Vector  and Matrix  data types, which are non-primitive data types and will be discussed later, inherits the Object data type of HARK  and can be set as Object in the node’s property as long as its values can be written in text. Primitive data types can also be set as Object   as long as it inherits the Object data type (example: $<$Int 1$>$). subnet_param is a special data type for setting a common parameter between nodes by assigning a value to a variable.

Data types used for connections between nodes

Different nodes can be connected (inter-node communication) by placing a line in between the terminals of the nodes (shown by a black line in the left or right side of a node) in the GUI of HARK Designer. The data types used for connecting nodes are the following.

Type

Meaning

Data type level

any 

Any type

HARK  -specific type

int 

integral type

Primitive type

float 

Single-precision floating point real type

Primitive type

double 

Double-precision floating point real type

Primitive type

complex<float> 

single-precision floating point complex type

Primitive type

complex<double> 

Double-precision floating point complex type

primitive type

char 

Character type

Primitive type

string 

String type

Primitive type

bool 

Logical type

Primitive type

Vector 

Array type

HARK  object type

Matrix 

Matrix type

HARK  object type

Int 

Integral type

HARK  object type

Float 

Single-precision floating point real type

HARK  object type

String 

String type

HARK  object type

Complex 

Complex type

HARK  object type

TrueObject 

Logical type (true)

HARK  object type

FalseObject 

Logical type (false)

HARK  object type

nilObject 

object type (nil)

HARK  object type

ObjectRef 

Object reference type

HARK  -specific type

Map 

Map type

HARK  -specific type

Source 

Sound source information type

HARK  -specific type

TransferFunction 

Tranfer function information type

HARK  -specific type

any  is a HARK  -specific data type that is generic and can handle all data types. int , float , double , complex<float> , complex<double> , char , string and bool has the same specification as C++ primitive types. When a primitive type (besides string and complex) is used as an Object , it will automatically be converted into GenericType<T> . For example, in data types like Int  and Float , the first letter of the data type name is replaced by a capital letter which means that it is handled as Object . For String  and Complex , although not defined as GenericType, but as std:string and std:complex, respectively, are also handled as Object . This is also applicable to TrueObject , FalseObject  and nilObject   for true, false and nil, respectively. Primitive types that inherited HARK  ’s Object class is called "HARK   Object types".

The most commonly used HARK  Object Types are the Vector , Matrix and Map . These inherited the C++ STL (Standard Template Library) and basically conforms to the specification of C++ STL. ObjectRef  is a HARK  -specific data type that acts as a smart pointer to the Object type. This is often used as an element for Vector , Matrix and Map data types. Source  is a HARK  -specific data type that is used to define sound source information.

TransferFunction  is a HARK  -specific data type that is used to define transfer function.

4.1 Node’s Terminal Type

In HARK Designer, the nodes can successfully connect when the terminals, both the sender and the receiver, has the same data type. The connection is shown by the black line connecting the terminals. Terminals that did not satisfy the conditions will cause an error and will fail to connect. The next section will discuss each of the primitive types, HARK   Object types and HARK   specific types.