This chapter describes the different data types used in HARK . The user needs to know about data types because of the following reasons:
Setting the properties of a node
Connecting one node to another (inter-node communication)
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 |
Integral type |
Primitive type |
|
Single-precision floating point type |
Primitive type |
|
String type |
Primitive type |
|
Logical type |
Primitive type |
|
Object type |
HARK -specific type |
|
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 type |
HARK -specific type |
|
integral type |
Primitive type |
|
Single-precision floating point real type |
Primitive type |
|
Double-precision floating point real type |
Primitive type |
|
single-precision floating point complex type |
Primitive type |
|
Double-precision floating point complex type |
primitive type |
|
Character type |
Primitive type |
|
String type |
Primitive type |
|
Logical type |
Primitive type |
|
Array type |
HARK object type |
|
Matrix type |
HARK object type |
|
Integral type |
HARK object type |
|
Single-precision floating point real type |
HARK object type |
|
String type |
HARK object type |
|
Complex type |
HARK object type |
|
Logical type (true) |
HARK object type |
|
Logical type (false) |
HARK object type |
|
object type (nil) |
HARK object type |
|
Object reference type |
HARK -specific type |
|
Map type |
HARK -specific type |
|
Sound source information type |
HARK -specific type |
|
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.
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.