Subversion Repositories DevTools

Rev

Rev 2218 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2218 Rev 2224
Line 28... Line 28...
28
#pragma warn -com
28
#pragma warn -com
29
#include <LoggingMacros.h>
29
#include <LoggingMacros.h>
30
#pragma warn +com
30
#pragma warn +com
31
//## end module%4209C5FB02C3.includes
31
//## end module%4209C5FB02C3.includes
32
 
32
 
-
 
33
// TestScenario
-
 
34
#include "TestScenario.h"
-
 
35
// TransactionSpecification
-
 
36
#include "TransactionSpecification.h"
-
 
37
// EvaluationContext
-
 
38
#include "EvaluationContext.h"
33
// DefinedVariable
39
// DefinedVariable
34
#include "DefinedVariable.h"
40
#include "DefinedVariable.h"
35
// DefinedVariableTable
41
// DefinedVariableTable
36
#include "DefinedVariableTable.h"
42
#include "DefinedVariableTable.h"
37
//## begin module%4209C5FB02C3.additionalDeclarations preserve=yes
43
//## begin module%4209C5FB02C3.additionalDeclarations preserve=yes
Line 76... Line 82...
76
	}
82
	}
77
 
83
 
78
  //## end DefinedVariableTable::clear%4209C916032F.body
84
  //## end DefinedVariableTable::clear%4209C916032F.body
79
}
85
}
80
 
86
 
81
//## Operation: getDefinedVariable%4209C7770264
87
//## Operation: defineVariable%425B4483019F
82
DefinedVariable& DefinedVariableTable::getDefinedVariable (const std::string &variableName)
88
DefinedVariable& DefinedVariableTable::defineVariable (const std::string &variableName)
83
{
89
{
84
  //## begin DefinedVariableTable::getDefinedVariable%4209C7770264.body preserve=yes
90
  //## begin DefinedVariableTable::defineVariable%425B4483019F.body preserve=yes
85
 
91
 
86
	std::map< std::string, DefinedVariable * >::const_iterator
92
	std::map< std::string, DefinedVariable * >::const_iterator
87
		instance = m_variable.find( variableName );
93
		instance = m_variable.find( variableName );
88
 
94
 
89
	if ( instance != m_variable.end() )
95
	if ( instance != m_variable.end() )
Line 120... Line 126...
120
 
126
 
121
			throw;
127
			throw;
122
		}
128
		}
123
	}
129
	}
124
 
130
 
-
 
131
  //## end DefinedVariableTable::defineVariable%425B4483019F.body
-
 
132
}
-
 
133
 
-
 
134
//## Operation: defineVariable%425B461402A1
-
 
135
DefinedVariable& DefinedVariableTable::defineVariable (const std::string &variableName, TestScenario &testScenario)
-
 
136
{
-
 
137
  //## begin DefinedVariableTable::defineVariable%425B461402A1.body preserve=yes
-
 
138
 
-
 
139
	const int testScenarioNumber = testScenario.getScenarioNumber();
-
 
140
	std::map< int, TestScenario * >::const_iterator
-
 
141
		instance = m_scenario.find( testScenarioNumber );
-
 
142
 
-
 
143
	if ( instance != m_scenario.end() )
-
 
144
	{
-
 
145
		return ( testScenario.defineVariable( variableName ) );
-
 
146
	}
-
 
147
	else
-
 
148
	{
-
 
149
		if ( m_scenario.insert(
-
 
150
				std::map< int, TestScenario * >::value_type(
-
 
151
					testScenarioNumber,
-
 
152
					&testScenario ) ).second )
-
 
153
		{
-
 
154
			return ( testScenario.defineVariable( variableName ) );
-
 
155
		}
-
 
156
		else
-
 
157
		{
-
 
158
			MTHROW( std::runtime_error, \
-
 
159
				"Cannot add test scenario \"" \
-
 
160
				<< testScenarioNumber \
-
 
161
				<< "\" to defined variable table." );
-
 
162
		}
-
 
163
	}
-
 
164
 
-
 
165
  //## end DefinedVariableTable::defineVariable%425B461402A1.body
-
 
166
}
-
 
167
 
-
 
168
//## Operation: getVariable%4209C7770264
-
 
169
DefinedVariable& DefinedVariableTable::getVariable (const std::string &variableName, EvaluationContext& context)
-
 
170
{
-
 
171
  //## begin DefinedVariableTable::getVariable%4209C7770264.body preserve=yes
-
 
172
 
-
 
173
	std::map< int, TestScenario * >::const_iterator
-
 
174
		scenario = m_scenario.find(
-
 
175
			context.getTransaction().getScenario().getScenarioNumber() );
-
 
176
 
-
 
177
	if ( scenario != m_scenario.end() &&
-
 
178
		 scenario->second->isVariable( variableName ) )
-
 
179
	{
-
 
180
		return ( scenario->second->getVariable( variableName ) );
-
 
181
	}
-
 
182
 
-
 
183
	std::map< std::string, DefinedVariable * >::const_iterator
-
 
184
		instance = m_variable.find( variableName );
-
 
185
 
-
 
186
	if ( instance != m_variable.end() )
-
 
187
	{
-
 
188
		return ( *instance->second );
-
 
189
	}
-
 
190
	
-
 
191
	MTHROW( std::runtime_error, \
-
 
192
		"Variable \"" \
-
 
193
		<< variableName \
-
 
194
		<< "\" is not defined." );
-
 
195
 
125
  //## end DefinedVariableTable::getDefinedVariable%4209C7770264.body
196
  //## end DefinedVariableTable::getVariable%4209C7770264.body
126
}
197
}
127
 
198
 
128
//## Operation: isVariable%420ACFBB01CE
199
//## Operation: isVariable%420ACFBB01CE
129
const bool DefinedVariableTable::isVariable (const std::string &symbol) const
200
const bool DefinedVariableTable::isVariable (const std::string &symbol, EvaluationContext& context) const
130
{
201
{
131
  //## begin DefinedVariableTable::isVariable%420ACFBB01CE.body preserve=yes
202
  //## begin DefinedVariableTable::isVariable%420ACFBB01CE.body preserve=yes
132
 
203
 
-
 
204
	std::map< int, TestScenario * >::const_iterator
-
 
205
		instance = m_scenario.find(
-
 
206
			context.getTransaction().getScenario().getScenarioNumber() );
-
 
207
 
-
 
208
	if ( instance != m_scenario.end() &&
-
 
209
		 instance->second->isVariable( symbol ) )
-
 
210
	{
-
 
211
		return ( true );
-
 
212
	}
-
 
213
 
133
  return ( m_variable.find( symbol ) != m_variable.end() );
214
	return ( m_variable.find( symbol ) != m_variable.end() );
134
 
215
 
135
  //## end DefinedVariableTable::isVariable%420ACFBB01CE.body
216
  //## end DefinedVariableTable::isVariable%420ACFBB01CE.body
136
}
217
}
137
 
218
 
138
// Additional Declarations
219
// Additional Declarations