Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
berryExpressionInfo.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #include "berryExpressionInfo.h"
14 
15 #include <QString>
16 
17 namespace berry {
18 
20  : fHasDefaultVariableAccess(false)
21  , fHasSystemPropertyAccess(false)
22 {
23 }
24 
25 bool
27 {
28  return fHasDefaultVariableAccess;
29  }
30 
31 void
33 {
34  fHasDefaultVariableAccess= true;
35  }
36 
37 bool
39 {
40  return fHasSystemPropertyAccess;
41  }
42 
43 void
45 {
46  fHasSystemPropertyAccess= true;
47  }
48 
50 {
51  return fAccessedVariableNames;
52 }
53 
54 void
56 {
57  fAccessedVariableNames.insert(name);
58 }
59 
60 QSet<QString>
62 {
63  return fAccessedPropertyNames;
64 }
65 
66 void
68 {
69  fAccessedPropertyNames.insert(name);
70 }
71 
73 {
74  return fMisbehavingExpressionTypes;
75 }
76 
77 void
79 {
80  fMisbehavingExpressionTypes.insert(QString(clazz.name()));
81 }
82 
83 void
85 {
86  this->MergeDefaultVariableAccess(other);
87  this->MergeSystemPropertyAccess(other);
88 
89  this->MergeAccessedVariableNames(other);
90  this->MergeAccessedPropertyNames(other);
91  this->MergeMisbehavingExpressionTypes(other);
92 }
93 
94 void
96 {
97  this->MergeSystemPropertyAccess(other);
98 
99  this->MergeAccessedVariableNames(other);
100  this->MergeAccessedPropertyNames(other);
101  this->MergeMisbehavingExpressionTypes(other);
102 }
103 
104 void
105 ExpressionInfo::MergeDefaultVariableAccess(ExpressionInfo* other)
106 {
107  fHasDefaultVariableAccess= fHasDefaultVariableAccess || other->fHasDefaultVariableAccess;
108 }
109 
110 void
111 ExpressionInfo::MergeSystemPropertyAccess(ExpressionInfo* other)
112 {
113  fHasSystemPropertyAccess= fHasSystemPropertyAccess || other->fHasSystemPropertyAccess;
114 }
115 
116 void
117 ExpressionInfo::MergeAccessedVariableNames(ExpressionInfo* other)
118 {
119  if (fAccessedVariableNames.size() == 0) {
120  fAccessedVariableNames= other->fAccessedVariableNames;
121  }
122  else
123  {
124  fAccessedVariableNames.unite(other->fAccessedVariableNames);
125  }
126 }
127 
128 void
129 ExpressionInfo::MergeAccessedPropertyNames(ExpressionInfo* other)
130 {
131  if (fAccessedPropertyNames.size() == 0)
132  {
133  fAccessedPropertyNames = other->fAccessedPropertyNames;
134  }
135  else
136  {
137  fAccessedPropertyNames.unite(other->fAccessedPropertyNames);
138  }
139 }
140 
141 void
142 ExpressionInfo::MergeMisbehavingExpressionTypes(ExpressionInfo* other)
143 {
144  if (fMisbehavingExpressionTypes.size() == 0)
145  {
146  fMisbehavingExpressionTypes= other->fMisbehavingExpressionTypes;
147  }
148  else
149  {
150  fMisbehavingExpressionTypes.unite(other->fMisbehavingExpressionTypes);
151  }
152 }
153 
154 } // namespace berry
void AddAccessedPropertyName(const QString &name)
bool HasDefaultVariableAccess() const
QSet< QString > GetAccessedVariableNames() const
bool HasSystemPropertyAccess() const
void Merge(ExpressionInfo *other)
void AddVariableNameAccess(const QString &name)
void AddMisBehavingExpressionType(const std::type_info &clazz)
QSet< QString > GetMisbehavingExpressionTypes() const
QSet< QString > GetAccessedPropertyNames() const
void MergeExceptDefaultVariable(ExpressionInfo *other)