38#ifndef INST_MULT_BY_CONST_H
39#define INST_MULT_BY_CONST_H
45#include "data/constantHandler.h"
46#include "data/untypedSharedPtr.h"
47#include "instructions/instruction.h"
57 static_assert(std::is_fundamental<T>::value,
58 "Template class MultByConstParam<> can only be used for "
72#ifndef CODE_GENERATION
81 const std::vector<Data::UntypedSharedPtr>& args)
const override;
101#ifndef CODE_GENERATION
109 const std::vector<Data::UntypedSharedPtr>& args)
const
117 return *(args.at(0).getSharedPointer<
const T>()) *
118 (double)constantValue;
123 this->operandTypes.push_back(
typeid(T));
This abstract class is the base class for any instruction to be used in a Program.
Definition: instruction.h:59
virtual double execute(const std::vector< Data::UntypedSharedPtr > &args) const =0
Execute the Instruction for the given arguments.
Definition: instruction.cpp:81
std::string printTemplate
Definition: instruction.h:110
Template class for multiplying a unique argument of type T by a constant parameter.
Definition: multByConstant.h:56
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:93
double execute(const std::vector< Data::UntypedSharedPtr > &args) const override
Inherited from Instruction.
Definition: multByConstant.h:108
Definition: addPrimitiveType.h:48
Data type used in Program::Program to define constant values, accessible to Instructions,...
Definition: constant.h:48