Skip to content

Commit

Permalink
Add override properly in extended operators.
Browse files Browse the repository at this point in the history
  • Loading branch information
sletz committed Aug 29, 2023
1 parent 428eee1 commit 33103ef
Show file tree
Hide file tree
Showing 22 changed files with 181 additions and 181 deletions.
16 changes: 8 additions & 8 deletions compiler/extended/absprim.hh
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,25 @@ class AbsPrim : public xtended {
public:
AbsPrim() : xtended("abs") {}

virtual unsigned int arity() { return 1; }
virtual unsigned int arity() override { return 1; }

virtual bool needCache() { return true; }
virtual bool needCache() override { return true; }

virtual ::Type inferSigType(ConstTypes args)
virtual ::Type inferSigType(ConstTypes args) override
{
faustassert(args.size() == arity());
Type t = args[0];
interval i = t->getInterval();
return castInterval(t, gAlgebra.Abs(i));
}

virtual int inferSigOrder(const std::vector<int>& args)
virtual int inferSigOrder(const std::vector<int>& args) override
{
faustassert(args.size() == arity());
return args[0];
}

virtual Tree computeSigOutput(const std::vector<Tree>& args)
virtual Tree computeSigOutput(const std::vector<Tree>& args) override
{
double f;
int i;
Expand All @@ -71,7 +71,7 @@ class AbsPrim : public xtended {
}
}

virtual ValueInst* generateCode(CodeContainer* container, Values& args, ::Type result, ConstTypes types)
virtual ValueInst* generateCode(CodeContainer* container, Values& args, ::Type result, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());
Expand Down Expand Up @@ -103,7 +103,7 @@ class AbsPrim : public xtended {
return generateFun(container, fun_name, args, result, types);
}

virtual std::string generateCode(Klass* klass, const std::vector<std::string>& args, ConstTypes types)
virtual std::string generateCode(Klass* klass, const std::vector<std::string>& args, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());
Expand All @@ -116,7 +116,7 @@ class AbsPrim : public xtended {
}
}

virtual std::string generateLateq(Lateq* lateq, const std::vector<std::string>& args, ConstTypes types)
virtual std::string generateLateq(Lateq* lateq, const std::vector<std::string>& args, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());
Expand Down
18 changes: 9 additions & 9 deletions compiler/extended/acosprim.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ class AcosPrim : public xtended {
public:
AcosPrim() : xtended("acos") {}

virtual unsigned int arity() { return 1; }
virtual unsigned int arity() override { return 1; }

virtual bool needCache() { return true; }

virtual ::Type inferSigType(ConstTypes args)
virtual bool needCache() override { return true; }
virtual ::Type inferSigType(ConstTypes args) override
{
faustassert(args.size() == 1);
Type t = args[0];
Expand All @@ -46,9 +46,9 @@ class AcosPrim : public xtended {
return castInterval(floatCast(t), gAlgebra.Acos(i));
}

virtual int inferSigOrder(const std::vector<int>& args) { return args[0]; }
virtual int inferSigOrder(const std::vector<int>& args) override { return args[0]; }

virtual Tree computeSigOutput(const std::vector<Tree>& args)
virtual Tree computeSigOutput(const std::vector<Tree>& args) override
{
num n;
if (isNum(args[0], n)) {
Expand All @@ -64,23 +64,23 @@ class AcosPrim : public xtended {
}
}

virtual ValueInst* generateCode(CodeContainer* container, Values& args, ::Type result, ConstTypes types)
virtual ValueInst* generateCode(CodeContainer* container, Values& args, ::Type result, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());

return generateFun(container, subst("acos$0", isuffix()), args, result, types);
}

virtual std::string generateCode(Klass* klass, const std::vector<std::string>& args, ConstTypes types)
virtual std::string generateCode(Klass* klass, const std::vector<std::string>& args, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());

return subst("acos$1($0)", args[0], isuffix());
}

virtual std::string generateLateq(Lateq* lateq, const std::vector<std::string>& args, ConstTypes types)
virtual std::string generateLateq(Lateq* lateq, const std::vector<std::string>& args, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());
Expand Down
16 changes: 8 additions & 8 deletions compiler/extended/asinprim.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ class AsinPrim : public xtended {
public:
AsinPrim() : xtended("asin") {}

virtual unsigned int arity() { return 1; }
virtual unsigned int arity() override { return 1; }

virtual bool needCache() { return true; }
virtual bool needCache() override { return true; }

virtual ::Type inferSigType(ConstTypes args)
virtual ::Type inferSigType(ConstTypes args) override
{
faustassert(args.size() == 1);
Type t = args[0];
Expand All @@ -46,9 +46,9 @@ class AsinPrim : public xtended {
return castInterval(t, gAlgebra.Asin(i));
}

virtual int inferSigOrder(const std::vector<int>& args) { return args[0]; }
virtual int inferSigOrder(const std::vector<int>& args) override { return args[0]; }

virtual Tree computeSigOutput(const std::vector<Tree>& args)
virtual Tree computeSigOutput(const std::vector<Tree>& args) override
{
num n;
if (isNum(args[0], n)) {
Expand All @@ -64,23 +64,23 @@ class AsinPrim : public xtended {
}
}

virtual ValueInst* generateCode(CodeContainer* container, Values& args, ::Type result, ConstTypes types)
virtual ValueInst* generateCode(CodeContainer* container, Values& args, ::Type result, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());

return generateFun(container, subst("asin$0", isuffix()), args, result, types);
}

virtual std::string generateCode(Klass* klass, const std::vector<std::string>& args, ConstTypes types)
virtual std::string generateCode(Klass* klass, const std::vector<std::string>& args, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());

return subst("asin$1($0)", args[0], isuffix());
}

virtual std::string generateLateq(Lateq* lateq, const std::vector<std::string>& args, ConstTypes types)
virtual std::string generateLateq(Lateq* lateq, const std::vector<std::string>& args, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());
Expand Down
16 changes: 8 additions & 8 deletions compiler/extended/atan2prim.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ class Atan2Prim : public xtended {
public:
Atan2Prim() : xtended("atan2") {}

virtual unsigned int arity() { return 2; }
virtual unsigned int arity() override { return 2; }

virtual bool needCache() { return true; }
virtual bool needCache() override { return true; }

virtual ::Type inferSigType(ConstTypes args)
virtual ::Type inferSigType(ConstTypes args) override
{
faustassert(args.size() == 2);
Type t = args[0];
Expand All @@ -43,9 +43,9 @@ class Atan2Prim : public xtended {
return castInterval(floatCast(t | u), gAlgebra.Atan2(i, j));
}

virtual int inferSigOrder(const std::vector<int>& args) { return std::max(args[0], args[1]); }
virtual int inferSigOrder(const std::vector<int>& args) override { return std::max(args[0], args[1]); }

virtual Tree computeSigOutput(const std::vector<Tree>& args)
virtual Tree computeSigOutput(const std::vector<Tree>& args) override
{
faustassert(args.size() == 2);
num n, m;
Expand All @@ -56,23 +56,23 @@ class Atan2Prim : public xtended {
}
}

virtual ValueInst* generateCode(CodeContainer* container, Values& args, ::Type result, ConstTypes types)
virtual ValueInst* generateCode(CodeContainer* container, Values& args, ::Type result, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());

return generateFun(container, subst("atan2$0", isuffix()), args, result, types);
}

virtual std::string generateCode(Klass* klass, const std::vector<std::string>& args, ConstTypes types)
virtual std::string generateCode(Klass* klass, const std::vector<std::string>& args, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());

return subst("atan2$2($0,$1)", args[0], args[1], isuffix());
}

virtual std::string generateLateq(Lateq* lateq, const std::vector<std::string>& args, ConstTypes types)
virtual std::string generateLateq(Lateq* lateq, const std::vector<std::string>& args, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());
Expand Down
16 changes: 8 additions & 8 deletions compiler/extended/atanprim.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ class AtanPrim : public xtended {
public:
AtanPrim() : xtended("atan") {}

virtual unsigned int arity() { return 1; }
virtual unsigned int arity() override { return 1; }

virtual bool needCache() { return true; }
virtual bool needCache() override { return true; }

virtual ::Type inferSigType(ConstTypes args)
virtual ::Type inferSigType(ConstTypes args) override
{
faustassert(args.size() == 1);
Type t = args[0];
interval i = t->getInterval();
return castInterval(floatCast(t), gAlgebra.Atan(i));
}

virtual int inferSigOrder(const std::vector<int>& args) { return args[0]; }
virtual int inferSigOrder(const std::vector<int>& args) override { return args[0]; }

virtual Tree computeSigOutput(const std::vector<Tree>& args)
virtual Tree computeSigOutput(const std::vector<Tree>& args) override
{
num n;
if (isNum(args[0], n)) {
Expand All @@ -53,23 +53,23 @@ class AtanPrim : public xtended {
}
}

virtual ValueInst* generateCode(CodeContainer* container, Values& args, ::Type result, ConstTypes types)
virtual ValueInst* generateCode(CodeContainer* container, Values& args, ::Type result, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());

return generateFun(container, subst("atan$0", isuffix()), args, result, types);
}

virtual std::string generateCode(Klass* klass, const std::vector<std::string>& args, ConstTypes types)
virtual std::string generateCode(Klass* klass, const std::vector<std::string>& args, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());

return subst("atan$1($0)", args[0], isuffix());
}

virtual std::string generateLateq(Lateq* lateq, const std::vector<std::string>& args, ConstTypes types)
virtual std::string generateLateq(Lateq* lateq, const std::vector<std::string>& args, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());
Expand Down
16 changes: 8 additions & 8 deletions compiler/extended/ceilprim.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@ class CeilPrim : public xtended {
public:
CeilPrim() : xtended("ceil") {}

virtual unsigned int arity() { return 1; }
virtual unsigned int arity() override { return 1; }

virtual bool needCache() { return true; }
virtual bool needCache() override { return true; }

virtual ::Type inferSigType(ConstTypes args)
virtual ::Type inferSigType(ConstTypes args) override
{
faustassert(args.size() == arity());
Type t = args[0];
interval i = t->getInterval();
return castInterval(floatCast(t), gAlgebra.Ceil(i));
}

virtual int inferSigOrder(const std::vector<int>& args)
virtual int inferSigOrder(const std::vector<int>& args) override
{
faustassert(args.size() == arity());
return args[0];
}

virtual Tree computeSigOutput(const std::vector<Tree>& args)
virtual Tree computeSigOutput(const std::vector<Tree>& args) override
{
num n;
faustassert(args.size() == arity());
Expand All @@ -64,23 +64,23 @@ class CeilPrim : public xtended {
}
}

virtual ValueInst* generateCode(CodeContainer* container, Values& args, ::Type result, std::vector< ::Type> const& types)
virtual ValueInst* generateCode(CodeContainer* container, Values& args, ::Type result, std::vector< ::Type> const& types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());

return generateFun(container, subst("ceil$0", isuffix()), args, result, types);
}

virtual std::string generateCode(Klass* klass, const std::vector<std::string>& args, ConstTypes types)
virtual std::string generateCode(Klass* klass, const std::vector<std::string>& args, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());

return subst("ceil$1($0)", args[0], isuffix());
}

virtual std::string generateLateq(Lateq* lateq, const std::vector<std::string>& args, ConstTypes types)
virtual std::string generateLateq(Lateq* lateq, const std::vector<std::string>& args, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());
Expand Down
18 changes: 9 additions & 9 deletions compiler/extended/cosprim.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ class CosPrim : public xtended {
public:
CosPrim() : xtended("cos") {}

virtual unsigned int arity() { return 1; }
virtual unsigned int arity() override { return 1; }

virtual bool needCache() { return true; }
virtual bool needCache() override { return true; }

virtual ::Type inferSigType(ConstTypes args)
virtual ::Type inferSigType(ConstTypes args) override
{
faustassert(args.size() == 1);
Type t = args[0];
interval i = t->getInterval();
return castInterval(floatCast(t), gAlgebra.Cos(i)); // todo change once the intervals library is updated
}

virtual int inferSigOrder(const std::vector<int>& args) { return args[0]; }
virtual int inferSigOrder(const std::vector<int>& args) override { return args[0]; }

virtual Tree computeSigOutput(const std::vector<Tree>& args)
virtual Tree computeSigOutput(const std::vector<Tree>& args) override
{
num n;
if (isNum(args[0], n)) {
Expand All @@ -67,31 +67,31 @@ class CosPrim : public xtended {
}
}

virtual ValueInst* generateCode(CodeContainer* container, Values& args, ::Type result, ConstTypes types)
virtual ValueInst* generateCode(CodeContainer* container, Values& args, ::Type result, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());

return generateFun(container, subst("cos$0", isuffix()), args, result, types);
}

virtual std::string generateCode(Klass* klass, const std::vector<std::string>& args, ConstTypes types)
virtual std::string generateCode(Klass* klass, const std::vector<std::string>& args, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());

return subst("cos$1($0)", args[0], isuffix());
}

virtual std::string generateLateq(Lateq* lateq, const std::vector<std::string>& args, ConstTypes types)
virtual std::string generateLateq(Lateq* lateq, const std::vector<std::string>& args, ConstTypes types) override
{
faustassert(args.size() == arity());
faustassert(types.size() == arity());

return subst("\\cos\\left($0\\right)", args[0]);
}

virtual Tree diff(const std::vector<Tree>& args)
virtual Tree diff(const std::vector<Tree>& args) override
{
// cos(x)' = -sin(x)
return sigMul(sigReal(-1.0), sigSin(args[0]));
Expand Down
Loading

0 comments on commit 33103ef

Please sign in to comment.