builtin.hpp 829 Bytes
Newer Older
Paul's avatar
Paul committed
1
2
3
#ifndef RTG_GUARD_BUILTIN_HPP
#define RTG_GUARD_BUILTIN_HPP

Paul's avatar
Paul committed
4
#include <rtg/operation.hpp>
Paul's avatar
Paul committed
5
#include <rtg/errors.hpp>
Paul's avatar
Paul committed
6

Paul's avatar
Paul committed
7
8
9
10
namespace rtg {

namespace builtin {

Paul's avatar
Paul committed
11
12
struct literal
{
Paul's avatar
Paul committed
13
    std::string name() const { return "@literal"; }
Paul's avatar
Paul committed
14
15
    shape compute_shape(std::vector<shape>) const { RTG_THROW("builtin"); }
    argument compute(std::vector<argument>) const { RTG_THROW("builtin"); }
Paul's avatar
Paul committed
16
17
18
19
20
};

struct param
{
    std::string parameter;
Paul's avatar
Paul committed
21
    std::string name() const { return "@param"; }
Paul's avatar
Paul committed
22
23
    shape compute_shape(std::vector<shape>) const { RTG_THROW("builtin"); }
    argument compute(std::vector<argument>) const { RTG_THROW("builtin"); }
Paul's avatar
Paul committed
24
    friend std::ostream& operator<<(std::ostream& os, const param& op)
Paul's avatar
Paul committed
25
    {
Paul's avatar
Paul committed
26
        os << op.name() << ":" << op.parameter;
Paul's avatar
Paul committed
27
28
        return os;
    }
Paul's avatar
Paul committed
29
};
Paul's avatar
Paul committed
30

Paul's avatar
Paul committed
31
} // namespace builtin
Paul's avatar
Paul committed
32
33
34
35

} // namespace rtg

#endif