39#ifndef INST_MULT_BY_CONST_H
40#define INST_MULT_BY_CONST_H
46#include "data/constantHandler.h"
47#include "data/untypedSharedPtr.h"
48#include "instructions/instruction.h"
70 static_assert(std::is_fundamental<T>::value,
71 "Template class MultByConstParam<> can only be used for "
85#ifndef CODE_GENERATION
94 const std::vector<Data::UntypedSharedPtr>& args)
const override;
104#ifdef CODE_GENERATION
114#ifndef CODE_GENERATION
122 const std::vector<Data::UntypedSharedPtr>& args)
const
130 return *(args.at(0).getSharedPointer<
const T>()) *
131 (double)constantValue;
136 this->operandTypes.push_back(
typeid(T));
Templace class for making casting from Instruction to MultByConst easier. This is usefull because Mul...
Definition multByConstant.h:58
This abstract class is the base class for any instruction to be used in a Program.
Definition instruction.h:61
virtual double execute(const std::vector< Data::UntypedSharedPtr > &args) const =0
Execute the Instruction for the given arguments.
Definition instruction.cpp:82
std::string printTemplate
Definition instruction.h:112
Template class for multiplying a unique argument of type T by a constant parameter.
Definition multByConstant.h:69
MultByConstant(const std::string &printTemplate="$0 = $1 * $2;")
Constructor for the MultByConstant class so it can be use during the code gen.
Definition multByConstant.h:106
double execute(const std::vector< Data::UntypedSharedPtr > &args) const override
Inherited from Instruction.
Definition multByConstant.h:121
Definition addPrimitiveType.h:49
Data type used in Program::Program to define constant values, accessible to Instructions,...
Definition constant.h:49