Serializable Info

20 views
Skip to first unread message

sheershak agarwal

unread,
Jun 9, 2021, 4:50:51 PM6/9/21
to F´ Community Group
In the Math Example, there is are two port created and then a serializable port? I still don't get what is the use of the  serializable port. What will happen if I don't make one for my set of ports. I am asking because I have a lot of components now and creating ports and serializable for all of them is troublesome. 

lestarch

unread,
Jun 9, 2021, 5:32:42 PM6/9/21
to F´ Community Group
The serializable type is a way of specifying composite data types in F´.  Like a C++ `struct` a serializable has members but it comes with the autocoding required to serialize those members for sending through ports or to the ground.  If you project does not need these composite types and can get away with ports containing multiple non-composite arguments or existing types in the system then you are not required to use serializables.

Does this answer your question, or have I miss-understood?

-Michael

sheershak agarwal

unread,
Jun 9, 2021, 10:56:18 PM6/9/21
to F´ Community Group
Yes you understood it right. What do exactly mean by composite data types? So it means I don't need to create serializable types if I am using data types(U32, F32, Fw::StringBase, Fw::Array ) supported by fprime, but if I am creating my own data type then I would create a serializable type (struct).

lestarch

unread,
Jun 10, 2021, 1:49:10 PM6/10/21
to F´ Community Group
Correct.  A composite data type is one composed of others.  Think C style struct.  Below, the composite type (struct) has 2 members it is composed of.

```
struct MyPair {
    U32 member1;
    U32 member2;
}
```

Our serializable would represent the same type:

```
<serializable name="MyPair" namespace="Ref">
   <members>
     <member type="U32" name="time" format="%u"/>
     <member type="U32" name="value" format="%u" />
   </members>
</serializable>
```

If you don't need these more complex types, then you don't need to use them.

-Michael
Reply all
Reply to author
Forward
0 new messages