builtin.hpp 954 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
    friend std::ostream & operator<<(std::ostream & os, const literal & op)
    {
        os << op.name();
        return os;
    }
Paul's avatar
Paul committed
21
22
23
24
25
};

struct param
{
    std::string parameter;
Paul's avatar
Paul committed
26
    std::string name() const { return "@param:" + parameter; }
Paul's avatar
Paul committed
27
28
    shape compute_shape(std::vector<shape>) const { RTG_THROW("builtin"); }
    argument compute(std::vector<argument>) const { RTG_THROW("builtin"); }
Paul's avatar
Paul committed
29
30
31
32
33
    friend std::ostream & operator<<(std::ostream & os, const param & op)
    {
        os << op.name();
        return os;
    }
Paul's avatar
Paul committed
34
};
Paul's avatar
Paul committed
35

Paul's avatar
Paul committed
36
} // namespace builtin
Paul's avatar
Paul committed
37
38
39
40

} // namespace rtg

#endif