SeExpr

ExprSpecType.h
Go to the documentation of this file.
1 /*
2 * Copyright Disney Enterprises, Inc. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License
6 * and the following modification to it: Section 6 Trademarks.
7 * deleted and replaced with:
8 *
9 * 6. Trademarks. This License does not grant permission to use the
10 * trade names, trademarks, service marks, or product names of the
11 * Licensor and its affiliates, except as required for reproducing
12 * the content of the NOTICE file.
13 *
14 * You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
16 */
17 #ifndef _ExprSpecType_h_
18 #define _ExprSpecType_h_
19
20 #include <SeExpr2/Vec.h>
21 #include <vector>
22 #include <sstream>
23 #include <SeExpr2/Curve.h>
24 #include <cstdio>
25
27 struct ExprSpecNode {
28 int startPos, endPos;
29
30 ExprSpecNode(int startPos, int endPos) : startPos(startPos), endPos(endPos) {}
31
32 virtual ~ExprSpecNode() {}
33 };
34
35 struct ExprSpecScalarNode : public ExprSpecNode {
36 double v;
37
38 ExprSpecScalarNode(int startPos, int endPos, double scalar) : ExprSpecNode(startPos, endPos), v(scalar) {}
39 };
40
41 struct ExprSpecVectorNode : public ExprSpecNode {
42 SeExpr2::Vec3d v;
43 ExprSpecVectorNode(int startPos, int endPos, ExprSpecNode* x, ExprSpecNode* y, ExprSpecNode* z)
44 : ExprSpecNode(startPos, endPos) {
45 v = SeExpr2::Vec3d(static_cast<ExprSpecScalarNode*>(x)->v,
46 static_cast<ExprSpecScalarNode*>(y)->v,
47 static_cast<ExprSpecScalarNode*>(z)->v);
48 }
49 };
50
51 struct ExprSpecListNode : public ExprSpecNode {
52 std::vector<ExprSpecNode*> nodes;
53 ExprSpecListNode(int startPos, int endPos) : ExprSpecNode(startPos, endPos) {}
54
55 void add(ExprSpecNode* node) {
56 startPos = std::min(node->startPos, startPos);
57 endPos = std::max(node->endPos, endPos);
58 nodes.push_back(node);
59 }
60 };
61
62 struct ExprSpecStringNode : public ExprSpecNode {
63 std::string v;
64 ExprSpecStringNode(int startPos, int endPos, const char* s) : ExprSpecNode(startPos, endPos), v(s) {}
65 };
66
67 struct ExprSpecCurveNode : public ExprSpecNode {
68 ExprSpecNode* args;
69 ExprSpecCurveNode(ExprSpecNode* args) : ExprSpecNode(args->startPos, args->endPos), args(args) {}
70 };
71
72 struct ExprSpecCCurveNode : public ExprSpecNode {
73 ExprSpecNode* args;
74 ExprSpecCCurveNode(ExprSpecNode* args) : ExprSpecNode(args->startPos, args->endPos), args(args) {}
75 };
76
77 struct ExprSpecAnimCurveNode : public ExprSpecNode {
78 ExprSpecNode* args;
79 ExprSpecAnimCurveNode(ExprSpecNode* args) : ExprSpecNode(args->startPos, args->endPos), args(args) {}
80 };
81
82 struct ExprSpecColorSwatchNode : public ExprSpecNode {
83 ExprSpecNode* args;
84 ExprSpecColorSwatchNode(ExprSpecNode* args) : ExprSpecNode(args->startPos, args->endPos), args(args) {}
85 };
86
87 struct ExprSpecDeepWaterNode : public ExprSpecNode {
88 ExprSpecNode* args;
89 ExprSpecDeepWaterNode(ExprSpecNode* args) : ExprSpecNode(args->startPos, args->endPos), args(args) {}
90 };
91
92 #endif
ExprSpecCurveNode::args
ExprSpecNode * args
Definition: ExprSpecType.h:68
ExprSpecAnimCurveNode
Definition: ExprSpecType.h:77
ExprSpecDeepWaterNode
Definition: ExprSpecType.h:87
ExprSpecNode::endPos
int endPos
Definition: ExprSpecType.h:28
ExprSpecColorSwatchNode
Definition: ExprSpecType.h:82
ExprSpecDeepWaterNode::ExprSpecDeepWaterNode
ExprSpecDeepWaterNode(ExprSpecNode *args)
Definition: ExprSpecType.h:89
SeExpr2::Vec< double, 3, false >
ExprSpecScalarNode
Definition: ExprSpecType.h:35
ExprSpecListNode::add
void add(ExprSpecNode *node)
Definition: ExprSpecType.h:55
ExprSpecVectorNode
Definition: ExprSpecType.h:41
ExprSpecCCurveNode::ExprSpecCCurveNode
ExprSpecCCurveNode(ExprSpecNode *args)
Definition: ExprSpecType.h:74
ExprSpecListNode
Definition: ExprSpecType.h:51
ExprSpecScalarNode::ExprSpecScalarNode
ExprSpecScalarNode(int startPos, int endPos, double scalar)
Definition: ExprSpecType.h:38
ExprSpecStringNode::ExprSpecStringNode
ExprSpecStringNode(int startPos, int endPos, const char *s)
Definition: ExprSpecType.h:64
ExprSpecVectorNode::ExprSpecVectorNode
ExprSpecVectorNode(int startPos, int endPos, ExprSpecNode *x, ExprSpecNode *y, ExprSpecNode *z)
Definition: ExprSpecType.h:43
ExprSpecScalarNode::v
double v
Definition: ExprSpecType.h:36
y
This is the same as the prman cellnoise function< br ></div >< br > float< b > float y< br > float< b > float y
Definition: userdoc.txt:218
ExprSpecListNode::ExprSpecListNode
ExprSpecListNode(int startPos, int endPos)
Definition: ExprSpecType.h:53
ExprSpecListNode::nodes
std::vector< ExprSpecNode * > nodes
Definition: ExprSpecType.h:52
ExprSpecVectorNode::v
SeExpr2::Vec3d v
Definition: ExprSpecType.h:42
ExprSpecStringNode::v
std::string v
Definition: ExprSpecType.h:63
ExprSpecNode::startPos
int startPos
Definition: ExprSpecType.h:28
Vec.h
SeExpr2::min
double min(double x, double y)
Definition: ExprBuiltins.h:43
ExprSpecColorSwatchNode::ExprSpecColorSwatchNode
ExprSpecColorSwatchNode(ExprSpecNode *args)
Definition: ExprSpecType.h:84
ExprSpecNode::ExprSpecNode
ExprSpecNode(int startPos, int endPos)
Definition: ExprSpecType.h:30
ExprSpecCurveNode
Definition: ExprSpecType.h:67
SeExpr2::max
double max(double x, double y)
Definition: ExprBuiltins.h:42
ExprSpecAnimCurveNode::ExprSpecAnimCurveNode
ExprSpecAnimCurveNode(ExprSpecNode *args)
Definition: ExprSpecType.h:79
ExprSpecNode::~ExprSpecNode
virtual ~ExprSpecNode()
Definition: ExprSpecType.h:32
ExprSpecCCurveNode
Definition: ExprSpecType.h:72
ExprSpecCCurveNode::args
ExprSpecNode * args
Definition: ExprSpecType.h:73
SeExpr2::Vec3d
Vec< double, 3, false > Vec3d
Definition: Vec.h:384
ExprSpecCurveNode::ExprSpecCurveNode
ExprSpecCurveNode(ExprSpecNode *args)
Definition: ExprSpecType.h:69
ExprSpecNode
Mini parse tree node... Only represents literals, and lists of literals.
Definition: ExprSpecType.h:27
ExprSpecStringNode
Definition: ExprSpecType.h:62
Curve.h
ExprSpecAnimCurveNode::args
ExprSpecNode * args
Definition: ExprSpecType.h:78
ExprSpecDeepWaterNode::args
ExprSpecNode * args
Definition: ExprSpecType.h:88
z
This is the same as the prman cellnoise function< br ></div >< br > float< b > float y< br > float< b > float float z
Definition: userdoc.txt:218
x
</pre >< h3 > A simple variable reference</h3 > This is not a very interesting subclass of expression until we add some additional variables Variables on some applications may be very dynamic In this we only need x
Definition: tutorial.txt:108
ExprSpecColorSwatchNode::args
ExprSpecNode * args
Definition: ExprSpecType.h:83