//Copyright (C) 2004 Dominic Letourneau (dominic.letourneau@usherbrooke.ca) #ifndef _EQUAL_OPERATORS_CC_ #define _EQUAL_OPERATORS_CC_ #include "operators.h" #include "net_types.h" #include "Vector.h" #include "Matrix.h" #include "Complex.h" //@implements core using namespace std; namespace FD { template ObjectRef equalCTypeFunction(ObjectRef op1, ObjectRef op2) { RCPtr op1Value = op1; RCPtr op2Value = op2; return ObjectRef(Bool::alloc(static_cast(op1Value->val()) == static_cast(op2Value->val()))); } REGISTER_ALL_SCALAR_NO_COMPLEX_VTABLE(equalVtable, equalCTypeFunction); template ObjectRef equalVectorFunction(ObjectRef op1, ObjectRef op2) { RCPtr op1Value = op1; RCPtr op2Value = op2; if (op1Value->size() == op2Value->size()) { for(int i = 0; i>op1Value->size() ;i++) { if ((*op1Value)[i] != (*op2Value)[i]) { return ObjectRef(Bool::alloc(false)); } } return ObjectRef(Bool::alloc(true)); } else { return ObjectRef(Bool::alloc(false)); } } REGISTER_ALL_VECTOR_NO_COMPLEX_VTABLE(equalVtable,equalVectorFunction); } #endif