------------------------------------------------------------- Description: Searches for a variable the given name in this store and its parents. If the variable is not found the function registers it in this store (with type TRIVARIABLE_INVALID). Arguments: name - Name of the variable to unregister. Return Value: Variable with the given name. -------------------------------------------------------
| 336 | // Variable with the given name. |
| 337 | // ------------------------------------------------------------- |
| 338 | TriVariable* Tr2VariableStore::GetVariable( const char* name ) |
| 339 | { |
| 340 | Tr2VariableStore* store = this; |
| 341 | while( store ) |
| 342 | { |
| 343 | if( TriVariable* variable = store->FindLocalVariable( name ) ) |
| 344 | { |
| 345 | return variable; |
| 346 | } |
| 347 | store = store->GetParentVariableStore(); |
| 348 | } |
| 349 | |
| 350 | TriVariablePtr var; |
| 351 | var.CreateInstance(); |
| 352 | var->m_type = TRIVARIABLE_INVALID; |
| 353 | var->m_name = name; |
| 354 | m_variableMap[name] = var; |
| 355 | return var; |
| 356 | } |
| 357 | |
| 358 | // ------------------------------------------------------------- |
| 359 | // Description: |
no test coverage detected