1
1
using System ;
2
2
using System . ComponentModel ;
3
3
using System . Reactive . Linq ;
4
+ using Bonsai . ML . LinearDynamicalSystems . Kinematics ;
4
5
using Newtonsoft . Json ;
5
6
6
7
namespace Bonsai . ML . LinearDynamicalSystems
7
8
{
8
9
/// <summary>
9
10
/// Serializes a sequence of data model objects into JSON strings.
10
11
/// </summary>
11
- [ Combinator ( ) ]
12
+ [ Combinator ]
12
13
[ WorkflowElementCategory ( ElementCategory . Transform ) ]
13
14
[ Description ( "Serializes a sequence of data model objects into JSON strings." ) ]
14
15
public class SerializeToJson
@@ -18,34 +19,100 @@ private IObservable<string> Process<T>(IObservable<T> source)
18
19
return source . Select ( value => JsonConvert . SerializeObject ( value ) ) ;
19
20
}
20
21
21
- public IObservable < string > Process ( IObservable < Kinematics . KFModelParameters > source )
22
+ /// <summary>
23
+ /// Serializes each <see cref="KFModelParameters"/> object in the sequence to
24
+ /// a JSON string.
25
+ /// </summary>
26
+ /// <param name="source">
27
+ /// A sequence of <see cref="KFModelParameters"/> objects.
28
+ /// </param>
29
+ /// <returns>
30
+ /// A sequence of JSON strings representing the corresponding
31
+ /// <see cref="KFModelParameters"/> object.
32
+ /// </returns>
33
+ public IObservable < string > Process ( IObservable < KFModelParameters > source )
22
34
{
23
- return Process < Kinematics . KFModelParameters > ( source ) ;
35
+ return Process < KFModelParameters > ( source ) ;
24
36
}
25
37
26
- public IObservable < string > Process ( IObservable < Kinematics . Observation2D > source )
38
+ /// <summary>
39
+ /// Serializes each <see cref="Observation2D"/> object in the sequence to
40
+ /// a JSON string.
41
+ /// </summary>
42
+ /// <param name="source">
43
+ /// A sequence of <see cref="Observation2D"/> objects.
44
+ /// </param>
45
+ /// <returns>
46
+ /// A sequence of JSON strings representing the corresponding
47
+ /// <see cref="Observation2D"/> object.
48
+ /// </returns>
49
+ public IObservable < string > Process ( IObservable < Observation2D > source )
27
50
{
28
- return Process < Kinematics . Observation2D > ( source ) ;
51
+ return Process < Observation2D > ( source ) ;
29
52
}
30
53
54
+ /// <summary>
55
+ /// Serializes each <see cref="State"/> object in the sequence to
56
+ /// a JSON string.
57
+ /// </summary>
58
+ /// <param name="source">
59
+ /// A sequence of <see cref="State"/> objects.
60
+ /// </param>
61
+ /// <returns>
62
+ /// A sequence of JSON strings representing the corresponding
63
+ /// <see cref="State"/> object.
64
+ /// </returns>
31
65
public IObservable < string > Process ( IObservable < State > source )
32
66
{
33
67
return Process < State > ( source ) ;
34
68
}
35
69
70
+ /// <summary>
71
+ /// Serializes each <see cref="StateComponent"/> object in the sequence to
72
+ /// a JSON string.
73
+ /// </summary>
74
+ /// <param name="source">
75
+ /// A sequence of <see cref="StateComponent"/> objects.
76
+ /// </param>
77
+ /// <returns>
78
+ /// A sequence of JSON strings representing the corresponding
79
+ /// <see cref="StateComponent"/> object.
80
+ /// </returns>
36
81
public IObservable < string > Process ( IObservable < StateComponent > source )
37
82
{
38
83
return Process < StateComponent > ( source ) ;
39
84
}
40
85
41
- public IObservable < string > Process ( IObservable < Kinematics . KinematicState > source )
86
+ /// <summary>
87
+ /// Serializes each <see cref="KinematicState"/> object in the sequence to
88
+ /// a JSON string.
89
+ /// </summary>
90
+ /// <param name="source">
91
+ /// A sequence of <see cref="KinematicState"/> objects.
92
+ /// </param>
93
+ /// <returns>
94
+ /// A sequence of JSON strings representing the corresponding
95
+ /// <see cref="KinematicState"/> object.
96
+ /// </returns>
97
+ public IObservable < string > Process ( IObservable < KinematicState > source )
42
98
{
43
- return Process < Kinematics . KinematicState > ( source ) ;
99
+ return Process < KinematicState > ( source ) ;
44
100
}
45
101
46
- public IObservable < string > Process ( IObservable < Kinematics . KinematicComponent > source )
102
+ /// <summary>
103
+ /// Serializes each <see cref="KinematicComponent"/> object in the sequence to
104
+ /// a JSON string.
105
+ /// </summary>
106
+ /// <param name="source">
107
+ /// A sequence of <see cref="KinematicComponent"/> objects.
108
+ /// </param>
109
+ /// <returns>
110
+ /// A sequence of JSON strings representing the corresponding
111
+ /// <see cref="KinematicComponent"/> object.
112
+ /// </returns>
113
+ public IObservable < string > Process ( IObservable < KinematicComponent > source )
47
114
{
48
- return Process < Kinematics . KinematicComponent > ( source ) ;
115
+ return Process < KinematicComponent > ( source ) ;
49
116
}
50
117
}
51
118
}
0 commit comments