Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sol-flow-single.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Soletta (TM) Project
3  *
4  * Copyright (C) 2015 Intel Corporation. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #pragma once
20 
21 #include "sol-flow.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
61 #define SOL_FLOW_SINGLE_CONNECTIONS(...) \
62  (const uint16_t[]){ __VA_ARGS__, UINT16_MAX }
63 
79 typedef struct sol_flow_single_options {
86 
87 #ifndef SOL_NO_API_VERSION
88 
96 #define SOL_FLOW_SINGLE_OPTIONS_API_VERSION (1)
97 #endif
98 
107 
126  void (*process)(void *user_data, struct sol_flow_node *node, uint16_t port, const struct sol_flow_packet *packet);
127 
131  const void *user_data;
132 
143  const uint16_t *connected_ports_in;
144 
157  const uint16_t *connected_ports_out;
159 
172 #define SOL_FLOW_SINGLE_OPTIONS_DEFAULTS(...) { \
173  .base = { \
174  SOL_SET_API_VERSION(.api_version = SOL_FLOW_NODE_OPTIONS_API_VERSION, ) \
175  SOL_SET_API_VERSION(.sub_api = SOL_FLOW_SINGLE_OPTIONS_API_VERSION) \
176  }, \
177  __VA_ARGS__ \
178 }
179 
180 
226 struct sol_flow_node *sol_flow_single_new(const char *id, const struct sol_flow_node_type *base_type, const struct sol_flow_node_options *options, const uint16_t *connected_ports_in, const uint16_t *connected_ports_out, void (*process)(void *user_data, struct sol_flow_node *node, uint16_t port, const struct sol_flow_packet *packet), const void *user_data);
227 
241 int32_t sol_flow_single_connect_port_in(struct sol_flow_node *node, uint16_t port_idx);
242 
256 int32_t sol_flow_single_disconnect_port_in(struct sol_flow_node *node, uint16_t port_idx);
257 
276 int32_t sol_flow_single_connect_port_out(struct sol_flow_node *node, uint16_t port_idx);
277 
291 int32_t sol_flow_single_disconnect_port_out(struct sol_flow_node *node, uint16_t port_idx);
292 
301 struct sol_flow_node *sol_flow_single_get_child(const struct sol_flow_node *node);
302 
341 struct sol_flow_node_type *sol_flow_single_new_type(const struct sol_flow_node_type *base_type);
342 
355 const struct sol_flow_node_type *sol_flow_single_type_get_child_type(const struct sol_flow_node_type *single_type);
360 #ifdef __cplusplus
361 }
362 #endif
struct sol_flow_node_type * sol_flow_single_new_type(const struct sol_flow_node_type *base_type)
create a wrapper type to use base_type nodes without a flow.
const uint16_t * connected_ports_in
indexes of input ports that should be connected.
Definition: sol-flow-single.h:143
Node options are a set of attributes defined by the Node Type that can change the behavior of a Node...
Definition: sol-flow.h:552
const struct sol_flow_node_type * sol_flow_single_type_get_child_type(const struct sol_flow_node_type *single_type)
Given a single-node type wrapper, return the internal (child) type.
const void * user_data
user data to give to callback process().
Definition: sol-flow-single.h:131
int32_t sol_flow_single_disconnect_port_in(struct sol_flow_node *node, uint16_t port_idx)
Disconnect the input port port_idx of the inner node.
struct sol_flow_node sol_flow_node
A node is an entity that has input/output ports.
Definition: sol-flow.h:71
void(* process)(void *user_data, struct sol_flow_node *node, uint16_t port, const struct sol_flow_packet *packet)
callback to deliver outgoing packets.
Definition: sol-flow-single.h:126
struct sol_flow_node * sol_flow_single_get_child(const struct sol_flow_node *node)
Return the reference to the inner node.
struct sol_flow_node * sol_flow_single_new(const char *id, const struct sol_flow_node_type *base_type, const struct sol_flow_node_options *options, const uint16_t *connected_ports_in, const uint16_t *connected_ports_out, void(*process)(void *user_data, struct sol_flow_node *node, uint16_t port, const struct sol_flow_packet *packet), const void *user_data)
create a single-node instance for the given base_type.
struct sol_flow_packet sol_flow_packet
A packet is a generic container for different kinds (types) of contents.
Definition: sol-flow-packet.h:54
struct sol_flow_node_options base
base guarantees sol_flow_node_options compatibility.
Definition: sol-flow-single.h:85
The node type describes the capabilities and operations of a node.
Definition: sol-flow.h:796
Structure for the specification of a single node.
Definition: sol-flow-single.h:79
int32_t sol_flow_single_connect_port_in(struct sol_flow_node *node, uint16_t port_idx)
Connect the input port port_idx of the inner node.
struct sol_flow_single_options sol_flow_single_options
Structure for the specification of a single node.
const struct sol_flow_node_options * options
options to give to the actual base type.
Definition: sol-flow-single.h:106
static int port
Definition: server-sse.c:72
These routines are used for Soletta flows manipulation.
const uint16_t * connected_ports_out
indexes of output ports that should be connected.
Definition: sol-flow-single.h:157
int32_t sol_flow_single_disconnect_port_out(struct sol_flow_node *node, uint16_t port_idx)
Disconnect the output port port_idx of the inner node.
int32_t sol_flow_single_connect_port_out(struct sol_flow_node *node, uint16_t port_idx)
Connect the output port port_idx of the inner node.