@@ -8,9 +8,11 @@ namespace BI
88{
99
1010SERIALIZATION_INFO (UnaryOperationNode, 1 );
11- DYNAMIC_SERIALIZATION_INFO (AbsoluteNode, 1 , " {125E8E5E-F1CB-4AE4-8EA9-53343ACD193B}" );
12- DYNAMIC_SERIALIZATION_INFO (CeilNode, 1 , " {60B0DFF2-2718-46A1-B7D5-AA614BF21FDD}" );
11+ DYNAMIC_SERIALIZATION_INFO (AbsNode, 1 , " {125E8E5E-F1CB-4AE4-8EA9-53343ACD193B}" );
1312DYNAMIC_SERIALIZATION_INFO (FloorNode, 1 , " {0DB3D5E3-8B32-43A4-82D2-F5B816AB5CC1}" );
13+ DYNAMIC_SERIALIZATION_INFO (CeilNode, 1 , " {60B0DFF2-2718-46A1-B7D5-AA614BF21FDD}" );
14+ DYNAMIC_SERIALIZATION_INFO (NegativeNode, 1 , " {6440468C-E161-4245-9F8A-4DB637869BB5}" );
15+ DYNAMIC_SERIALIZATION_INFO (SqrtNode, 1 , " {FCDA9CB6-43CA-4E95-907E-63405D410D79}" );
1416
1517UnaryOperationNode::UnaryOperationNode () :
1618 UnaryOperationNode (NE::LocString (), NUIE::Point ())
@@ -88,31 +90,39 @@ NE::Stream::Status UnaryOperationNode::Write (NE::OutputStream& outputStream) co
8890NE::ValuePtr UnaryOperationNode::DoSingleOperation (const NE::ValueConstPtr& aValue) const
8991{
9092 double aDouble = NE::NumberValue::ToDouble (aValue);
93+ if (!IsValidInput (aDouble)) {
94+ return nullptr ;
95+ }
9196 double result = DoOperation (aDouble);
9297 if (std::isnan (result) || std::isinf (result)) {
9398 return nullptr ;
9499 }
95100 return NE::ValuePtr (new NE::DoubleValue (result));
96101}
97102
98- AbsoluteNode::AbsoluteNode () :
103+ bool UnaryOperationNode::IsValidInput (double ) const
104+ {
105+ return true ;
106+ }
107+
108+ AbsNode::AbsNode () :
99109 UnaryOperationNode ()
100110{
101111
102112}
103113
104- AbsoluteNode::AbsoluteNode (const NE::LocString& name, const NUIE::Point& position) :
114+ AbsNode::AbsNode (const NE::LocString& name, const NUIE::Point& position) :
105115 UnaryOperationNode (name, position)
106116{
107117
108118}
109119
110- AbsoluteNode ::~AbsoluteNode ()
120+ AbsNode ::~AbsNode ()
111121{
112122
113123}
114124
115- double AbsoluteNode ::DoOperation (double a) const
125+ double AbsNode ::DoOperation (double a) const
116126{
117127 return std::abs (a);
118128}
@@ -161,4 +171,53 @@ double CeilNode::DoOperation (double a) const
161171 return std::ceil (a);
162172}
163173
174+ NegativeNode::NegativeNode () :
175+ UnaryOperationNode ()
176+ {
177+
178+ }
179+
180+ NegativeNode::NegativeNode (const NE::LocString& name, const NUIE::Point& position) :
181+ UnaryOperationNode (name, position)
182+ {
183+
184+ }
185+
186+ NegativeNode::~NegativeNode ()
187+ {
188+
189+ }
190+
191+ double NegativeNode::DoOperation (double a) const
192+ {
193+ return a * -1.0 ;
194+ }
195+
196+ SqrtNode::SqrtNode () :
197+ UnaryOperationNode ()
198+ {
199+
200+ }
201+
202+ SqrtNode::SqrtNode (const NE::LocString& name, const NUIE::Point& position) :
203+ UnaryOperationNode (name, position)
204+ {
205+
206+ }
207+
208+ SqrtNode::~SqrtNode ()
209+ {
210+
211+ }
212+
213+ bool SqrtNode::IsValidInput (double a) const
214+ {
215+ return a >= 0.0 ;
216+ }
217+
218+ double SqrtNode::DoOperation (double a) const
219+ {
220+ return sqrt (a);
221+ }
222+
164223}
0 commit comments