39#ifndef INSTRUCTION_ADD_H
40#define INSTRUCTION_ADD_H
46#include "data/untypedSharedPtr.h"
47#include "instructions/instruction.h"
57 static_assert(std::is_fundamental<T>::value,
58 "Template class AddPrimitiveType<T> can only be used for "
74#ifndef CODE_GENERATION
81 virtual double execute(
82 const std::vector<Data::UntypedSharedPtr>& args)
const override;
91#ifndef CODE_GENERATION
99 const std::vector<Data::UntypedSharedPtr>& args)
const
108 return *(args.at(0).getSharedPointer<
const T>()) +
109 (double)*(args.at(1).getSharedPointer<
const T>());
112#ifdef CODE_GENERATION
123 this->operandTypes.push_back(
typeid(T));
124 this->operandTypes.push_back(
typeid(T));
Template class for add instruction on all types of data: double, int, ...
Definition addPrimitiveType.h:56
virtual double execute(const std::vector< Data::UntypedSharedPtr > &args) const override
Inherited from Instruction.
Definition addPrimitiveType.h:98
AddPrimitiveType(const std::string &printTemplate="")
Constructor for the AddPrimitiveType class, so it can be use during the code gen.
Definition addPrimitiveType.h:114
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
Definition addPrimitiveType.h:49