Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryExpressionInfo.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 BlueBerry Platform
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "berryExpressionInfo.h"
18 
19 #include <QString>
20 
21 namespace berry {
22 
24  : fHasDefaultVariableAccess(false)
25  , fHasSystemPropertyAccess(false)
26 {
27 }
28 
29 bool
31 {
32  return fHasDefaultVariableAccess;
33  }
34 
35 void
37 {
38  fHasDefaultVariableAccess= true;
39  }
40 
41 bool
43 {
44  return fHasSystemPropertyAccess;
45  }
46 
47 void
49 {
50  fHasSystemPropertyAccess= true;
51  }
52 
54 {
55  return fAccessedVariableNames;
56 }
57 
58 void
60 {
61  fAccessedVariableNames.insert(name);
62 }
63 
64 QSet<QString>
66 {
67  return fAccessedPropertyNames;
68 }
69 
70 void
72 {
73  fAccessedPropertyNames.insert(name);
74 }
75 
77 {
78  return fMisbehavingExpressionTypes;
79 }
80 
81 void
83 {
84  fMisbehavingExpressionTypes.insert(QString(clazz.name()));
85 }
86 
87 void
89 {
90  this->MergeDefaultVariableAccess(other);
91  this->MergeSystemPropertyAccess(other);
92 
93  this->MergeAccessedVariableNames(other);
94  this->MergeAccessedPropertyNames(other);
95  this->MergeMisbehavingExpressionTypes(other);
96 }
97 
98 void
100 {
101  this->MergeSystemPropertyAccess(other);
102 
103  this->MergeAccessedVariableNames(other);
104  this->MergeAccessedPropertyNames(other);
105  this->MergeMisbehavingExpressionTypes(other);
106 }
107 
108 void
109 ExpressionInfo::MergeDefaultVariableAccess(ExpressionInfo* other)
110 {
111  fHasDefaultVariableAccess= fHasDefaultVariableAccess || other->fHasDefaultVariableAccess;
112 }
113 
114 void
115 ExpressionInfo::MergeSystemPropertyAccess(ExpressionInfo* other)
116 {
117  fHasSystemPropertyAccess= fHasSystemPropertyAccess || other->fHasSystemPropertyAccess;
118 }
119 
120 void
121 ExpressionInfo::MergeAccessedVariableNames(ExpressionInfo* other)
122 {
123  if (fAccessedVariableNames.size() == 0) {
124  fAccessedVariableNames= other->fAccessedVariableNames;
125  }
126  else
127  {
128  fAccessedVariableNames.unite(other->fAccessedVariableNames);
129  }
130 }
131 
132 void
133 ExpressionInfo::MergeAccessedPropertyNames(ExpressionInfo* other)
134 {
135  if (fAccessedPropertyNames.size() == 0)
136  {
137  fAccessedPropertyNames = other->fAccessedPropertyNames;
138  }
139  else
140  {
141  fAccessedPropertyNames.unite(other->fAccessedPropertyNames);
142  }
143 }
144 
145 void
146 ExpressionInfo::MergeMisbehavingExpressionTypes(ExpressionInfo* other)
147 {
148  if (fMisbehavingExpressionTypes.size() == 0)
149  {
150  fMisbehavingExpressionTypes= other->fMisbehavingExpressionTypes;
151  }
152  else
153  {
154  fMisbehavingExpressionTypes.unite(other->fMisbehavingExpressionTypes);
155  }
156 }
157 
158 } // namespace berry
void AddAccessedPropertyName(const QString &name)
QSet< QString > GetMisbehavingExpressionTypes() const
QSet< QString > GetAccessedPropertyNames() const
bool HasDefaultVariableAccess() const
void Merge(ExpressionInfo *other)
void AddVariableNameAccess(const QString &name)
void AddMisBehavingExpressionType(const std::type_info &clazz)
bool HasSystemPropertyAccess() const
QSet< QString > GetAccessedVariableNames() const
void MergeExceptDefaultVariable(ExpressionInfo *other)