We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This example works fine when i change the federated to main. Is there way to use as a federated?
target C { timeout: 10 secs, protobufs: hello_string.proto } /** * Reactor that generates serialized Protocol Buffers messages. * @param prefix The prefix string. * @output message The serialized message (Protocol Buffers format). */ reactor MessageGenerator(prefix: string = "") { output message: uint8_t[] state count: int = 1 timer t(1 sec, 1 sec) reaction(t) -> message {= // Create and populate the Protocol Buffers message HelloString pack_msg = HELLO_STRING__INIT; char buffer[256]; snprintf(buffer, sizeof(buffer), "%s %d", self->prefix, self->count++); pack_msg.message = buffer; // Serialize the message unsigned len = hello_string__get_packed_size(&pack_msg); uint8_t* buf = malloc(len); hello_string__pack(&pack_msg, buf); // Set the output lf_set_array(message, buf, len); tag_t tag = lf_tag(); lf_print("At (elapsed) logical tag (%lld, %u), source sends message: %s", tag.time - lf_time_start(), tag.microstep, buffer ); =} } /** * Reactor that deserializes and prints Protocol Buffers messages. * @input message The serialized message (Protocol Buffers format). */ reactor PrintMessage { input message: uint8_t[] reaction(message) {= // Deserialize the incoming message unsigned len = message->length; HelloString* unpacked_msg = hello_string__unpack(NULL, len, message->value); // Print the unpacked message if (unpacked_msg != NULL) { tag_t tag = lf_tag(); lf_print("At (elapsed) logical tag (%lld, %u), print receives: %s", tag.time - lf_time_start(), tag.microstep, unpacked_msg->message ); hello_string__free_unpacked(unpacked_msg, NULL); } else { lf_print("Failed to deserialize message."); } =} } federated reactor HelloWorld { source = new MessageGenerator(prefix = "Hello Protocol Buffers") print = new PrintMessage() source.message -> print.message }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This example works fine when i change the federated to main. Is there way to use as a federated?
The text was updated successfully, but these errors were encountered: