-
Notifications
You must be signed in to change notification settings - Fork 7
/
Eq.cpp
executable file
·48 lines (35 loc) · 1.14 KB
/
Eq.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/***************************************************************************
* (c) 2008-2011 Aleksandar Topuzović *
* <aleksandar.topuzovic@fer.hr>, <aleksandar.topuzovic@gmail.com> *
***************************************************************************/
#include "beagle/GP.hpp"
#include "Eq.hpp"
#include <cmath>
#include <fstream>
using namespace Beagle;
// Ime EQ
Eq::Eq() :
Beagle::GP::Primitive(2, "EQ")
{ }
#ifdef BEAGLE_HAVE_RTTI
// Argumenti tipa Double
const std::type_info* Eq::getArgType(unsigned int inN, Beagle::GP::Context& ioContext) const
{
Beagle_AssertM(inN < 2);
return &typeid(Double);
}
// Povratna vrjednost boolean
const std::type_info* Eq::getReturnType(Beagle::GP::Context& ioContext) const
{
return &typeid(Bool);
}
#endif // BEAGLE_HAVE_RTTI
// Usporeduje 2 Double vrijednosti (jednako)
// Vraca boolean vrjednost
void Eq::execute(GP::Datum& outDatum, GP::Context& ioContext)
{
Bool& lResult = castObjectT<Bool&>(outDatum);
Double lArgs[2];
getArguments(lArgs, sizeof(Double), ioContext);
lResult = lArgs[0].getWrappedValue() == lArgs[1].getWrappedValue();
}