Skip to content
Snippets Groups Projects
Commit 2d7e3f18 authored by dawehr's avatar dawehr
Browse files

Added type_id to node types. Linked graph_blocks to virtual quad. Fixed issues with commands array

parent c125577f
No related branches found
No related tags found
No related merge requests found
Showing
with 33 additions and 21 deletions
File added
......@@ -143,14 +143,14 @@ struct MessageType MessageTypes[MAX_TYPE_ID] =
// Function pointer
&cb_log
},
// RESPONSE
// LOG_END
{
// Command text
"response",
"logend",
// Type of the command data
stringType,
// Function pointer
&cb_response
&cb_logend
},
// SETPARAM
{
......@@ -259,15 +259,6 @@ struct MessageType MessageTypes[MAX_TYPE_ID] =
floatType,
// Function pointer
&cb_respaddnode
},
// LOG_END
{
// Command text
"logend",
// Type of the command data
stringType,
// Function pointer
&cb_logend
}
};
......
......@@ -34,6 +34,7 @@ struct graph_node_type {
execute_node_t execute; // Function describing how to produce outputs
reset_node_t reset; // Reset this node. Called upon (re)connection
size_t state_size; // Size of the state struct for this type
int type_id; // A unique ID for this node type
};
// Holds a tuple for defining the source of a node. Includes the node ID and its output ID
......
#ifndef __GRAPH_BLOCKS_H__
#define __GRAPH_BLOCKS_H__
#include "computation_graph.h"
#include "node_constant.h"
#include "node_add.h"
......@@ -48,4 +51,5 @@ extern const struct graph_node_type* blockDefs[MAX_BLOCK_TYPES];
* Creates a new node and adds it to the graph with the given type ID and name
* Returns the id of the new node upon success, -1 upon failure
*/
int graph_add_defined_block(struct computation_graph* graph, int type_id, const char* name);
\ No newline at end of file
int graph_add_defined_block(struct computation_graph* graph, int type_id, const char* name);
#endif // __GRAPH_BLOCKS_H__
......@@ -28,7 +28,8 @@ const struct graph_node_type node_accum_type = {
.n_params = 0,
.execute = accum_nodes,
.reset = reset,
.state_size = sizeof(struct accum_state)
.state_size = sizeof(struct accum_state),
.type_id = BLOCK_ACCUMULATE
};
int graph_add_node_accum(struct computation_graph *graph, const char* name) {
......
#ifndef __NODE_ACCUMULATOR_H__
#define __NODE_ACCUMULATOR_H__
#include "computation_graph.h"
#include "graph_blocks.h"
int graph_add_node_accum(struct computation_graph *graph, const char* name);
......
......@@ -18,7 +18,8 @@ const struct graph_node_type node_add_type = {
.n_params = 0,
.execute = add_nodes,
.reset = reset,
.state_size = 0
.state_size = 0,
.type_id = BLOCK_ADD
};
int graph_add_node_add(struct computation_graph *graph, const char* name) {
......
#ifndef __NODE_ADD_H__
#define __NODE_ADD_H__
#include "computation_graph.h"
#include "graph_blocks.h"
int graph_add_node_add(struct computation_graph *graph, const char* name);
......
......@@ -26,7 +26,8 @@ const struct graph_node_type node_bounds_type = {
.n_params = 2,
.execute = bounds_computation,
.reset = reset_bounds,
.state_size = 0
.state_size = 0,
.type_id = BLOCK_BOUNDS
};
int graph_add_node_bounds(struct computation_graph *graph, const char* name) {
......
#ifndef __NODE_BOUNDS_H__
#define __NODE_BOUNDS_H__
#include "computation_graph.h"
#include "graph_blocks.h"
int graph_add_node_bounds(struct computation_graph *graph, const char* name);
......
......@@ -18,7 +18,8 @@ const struct graph_node_type node_const_type = {
.n_params = 1,
.execute = output_const,
.reset = reset,
.state_size = 0
.state_size = 0,
.type_id = BLOCK_CONSTANT
};
int graph_add_node_const(struct computation_graph *graph, const char* name) {
......
#ifndef __NODE_CONSTANT_H__
#define __NODE_CONSTANT_H__
#include "computation_graph.h"
#include "graph_blocks.h"
int graph_add_node_const(struct computation_graph *graph, const char* name);
......
......@@ -18,7 +18,8 @@ const struct graph_node_type node_gain_type = {
.n_params = 1,
.execute = scale_nodes,
.reset = reset,
.state_size = 0
.state_size = 0,
.type_id = BLOCK_GAIN
};
int graph_add_node_gain(struct computation_graph *graph, const char* name) {
......
#ifndef __NODE_GAIN_H__
#define __NODE_GAIN_H__
#include "computation_graph.h"
#include "graph_blocks.h"
int graph_add_node_gain(struct computation_graph *graph, const char* name);
......
......@@ -35,7 +35,8 @@ const struct graph_node_type node_mixer_type = {
.n_params = 0,
.execute = mixer_computation,
.reset = reset_mixer,
.state_size = 0
.state_size = 0,
.type_id = BLOCK_MIXER
};
int graph_add_node_mixer(struct computation_graph *graph, const char* name) {
......
#ifndef __NODE_MIXER_H__
#define __NODE_MIXER_H__
#include "computation_graph.h"
#include "graph_blocks.h"
int graph_add_node_mixer(struct computation_graph *graph, const char* name);
......
......@@ -18,7 +18,8 @@ const struct graph_node_type node_mult_type = {
.n_params = 0,
.execute = mult_nodes,
.reset = reset,
.state_size = 0
.state_size = 0,
.type_id = BLOCK_MULT
};
int graph_add_node_mult(struct computation_graph *graph, const char* name) {
......
#ifndef __NODE_MULT_H__
#define __NODE_MULT_H__
#include "computation_graph.h"
#include "graph_blocks.h"
int graph_add_node_mult(struct computation_graph *graph, const char* name);
......
......@@ -91,7 +91,8 @@ const struct graph_node_type node_pid_type = {
.n_params = 4,
.execute = pid_computation,
.reset = reset_pid,
.state_size = sizeof(struct pid_node_state)
.state_size = sizeof(struct pid_node_state),
.type_id = BLOCK_PID
};
int graph_add_node_pid(struct computation_graph *graph, const char* name) {
......
#ifndef __NODE_PID_H__
#define __NODE_PID_H__
#include "computation_graph.h"
#include "graph_blocks.h"
int graph_add_node_pid(struct computation_graph *graph, const char* name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment