38#ifndef INSTRUCTION_ADD_H
39#define INSTRUCTION_ADD_H
45#include "data/untypedSharedPtr.h"
46#include "instructions/instruction.h"
56 static_assert(std::is_fundamental<T>::value,
57 "Template class AddPrimitiveType<T> can only be used for "
73#ifndef CODE_GENERATION
80 virtual double execute(
81 const std::vector<Data::UntypedSharedPtr>& args)
const override;
90#ifndef CODE_GENERATION
98 const std::vector<Data::UntypedSharedPtr>& args)
const
107 return *(args.at(0).getSharedPointer<
const T>()) +
108 (double)*(args.at(1).getSharedPointer<
const T>());
111#ifdef CODE_GENERATION
122 this->operandTypes.push_back(
typeid(T));
123 this->operandTypes.push_back(
typeid(T));
Template class for add instruction on all types of data: double, int, ...
Definition: addPrimitiveType.h:55
virtual double execute(const std::vector< Data::UntypedSharedPtr > &args) const override
Inherited from Instruction.
Definition: addPrimitiveType.h:97
AddPrimitiveType(const std::string &printTemplate="")
Constructor for the AddPrimitiveType class, so it can be use during the code gen.
Definition: addPrimitiveType.h:113
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
Definition: addPrimitiveType.h:48