HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
PDG_Conditional.h
Go to the documentation of this file.
1
/*
2
* PROPRIETARY INFORMATION. This software is proprietary to
3
* Side Effects Software Inc., and is not to be reproduced,
4
* transmitted, or disclosed in any way without written permission.
5
*
6
* COMMENTS:
7
*/
8
9
#ifndef __PDG_CONDITIONAL_H__
10
#define __PDG_CONDITIONAL_H__
11
12
#include "
PDG_API.h
"
13
14
#include "
PDG_BasePattern.h
"
15
16
#include <
UT/UT_Array.h
>
17
#include <
UT/UT_NonCopyable.h
>
18
#include <
UT/UT_StringHolder.h
>
19
#include <
UT/UT_UniquePtr.h
>
20
21
class
PDG_NodeInterface
;
22
class
PDG_Port
;
23
24
/*
25
* Conditional expression for PDG node templates
26
*/
27
class
PDG_API
PDG_Conditional
:
public
PDG_BasePattern
,
UT_NonCopyable
28
{
29
public
:
30
/// Constructs a new conditional expression from the input string
31
PDG_Conditional
(
const
UT_StringHolder
&
pattern
);
32
33
/// Checks if the condition is true or false for the specified node
34
/// interface
35
bool
match(
const
PDG_NodeInterface
* interface,
36
bool
expression_default=
true
)
const
;
37
38
/// Resets the condition to the specified pattern
39
bool
reset
(
const
UT_StringHolder
& pattern);
40
41
private
:
42
enum
Operation
43
{
44
eEQ,
45
eNE,
46
eLT,
47
eLE,
48
eGT,
49
eGE,
50
};
51
52
enum
ConjunctionState
53
{
54
eBegin,
55
eName,
56
eOperator
,
57
eValue
58
};
59
60
struct
Condition
61
{
62
UT_StringHolder
myPortName;
63
64
UT_StringHolder
myString;
65
fpreal
myFloat;
66
exint
myInteger;
67
68
Operation myOperation;
69
bool
myHasFloat;
70
bool
myHasInteger;
71
};
72
73
using
Conjunction
=
UT_Array<Condition>
;
74
using
Disjunction
=
UT_Array<UT_UniquePtr<Conjunction>
>;
75
76
private
:
77
template
<
typename
T>
78
static
bool
compare
(
const
T
&
left
,
const
T
&
right
, Operation op)
79
{
80
switch
(op)
81
{
82
case
eEQ:
83
return
(left == right);
84
case
eLT:
85
return
(left < right);
86
case
eLE:
87
return
(left <= right);
88
case
eGT:
89
return
(left > right);
90
case
eGE:
91
return
(left >= right);
92
case
eNE:
93
return
(left != right);
94
default
:
95
return
false
;
96
}
97
}
98
99
bool
parse(
const
UT_StringHolder
& pattern);
100
bool
matchPort(
const
Condition& condition,
101
const
PDG_Port
* port)
const
;
102
103
bool
parseConjunction(
Conjunction
& conjunction,
104
const
UT_StringView
&
view
,
105
int
&
index
);
106
bool
addCondition(
Conjunction
& conjunction,
107
const
UT_WorkBuffer
&
name
,
108
const
UT_WorkBuffer
& op,
109
const
UT_WorkBuffer
&
value
);
110
private
:
111
Disjunction
myConditions;
112
};
113
114
#endif
UT_WorkBuffer
Definition:
UT_WorkBuffer.h:74
left
GLint left
Definition:
glcorearb.h:2005
PDG_Port
Definition:
PDG_Port.h:39
PDG_API
#define PDG_API
Definition:
PDG_API.h:23
right
GLdouble right
Definition:
glad.h:2817
PDG_BasePattern::reset
void reset(const UT_StringHolder &pattern)
Resets the pattern.
Definition:
PDG_BasePattern.h:48
exint
int64 exint
Definition:
SYS_Types.h:125
UT_Array.h
UT_Array
Definition:
BV_KDOPTree.h:18
PDG_BasePattern
Definition:
PDG_BasePattern.h:20
UT_StringHolder
Definition:
UT_StringHolder.h:999
ImageBufAlgo::compare
CompareResults OIIO_API compare(const ImageBuf &A, const ImageBuf &B, float failthresh, float warnthresh, ROI roi={}, int nthreads=0)
UT_StringView
A utility class to do read-only operations on a subset of an existing string.
Definition:
UT_StringView.h:39
PDG_BasePattern.h
name
GLuint const GLchar * name
Definition:
glcorearb.h:786
pattern
GLushort pattern
Definition:
glad.h:2583
OBJ_MatchTransform::T
UT_NonCopyable.h
PDG_PortDisplayType::eOperator
Operator path display.
PDG_NodeInterface
Definition:
PDG_NodeInterface.h:41
PDG_API.h
UT_UniquePtr.h
UT_StringHolder.h
fpreal
fpreal64 fpreal
Definition:
SYS_Types.h:277
PDG_Conditional
Definition:
PDG_Conditional.h:27
index
GLuint index
Definition:
glcorearb.h:786
UT_NonCopyableNS::UT_NonCopyable
Definition:
UT_NonCopyable.h:17
view
Definition:
core.h:982
value
Definition:
core.h:1131
PDG
PDG_Conditional.h
Generated on Sat Dec 21 2024 02:47:28 for HDK by
1.8.6