| 348 | PyObject* result; |
| 349 | |
| 350 | void GetDesc( Tr2ALMemoryType, const Tr2DeviceResourceDescriptionAL& description ) |
| 351 | { |
| 352 | std::string key = ""; |
| 353 | auto found = description.find( "type" ); |
| 354 | if( found != end( description ) ) |
| 355 | { |
| 356 | key = found->second; |
| 357 | } |
| 358 | PyObject* list = PyDict_GetItemString( result, key.c_str() ); |
| 359 | if( !list ) |
| 360 | { |
| 361 | list = PyList_New( 0 ); |
| 362 | PyDict_SetItemString( result, key.c_str(), list ); |
| 363 | Py_DECREF( list ); |
| 364 | } |
| 365 | |
| 366 | PyObject* item = PyDict_New(); |
| 367 | if( item ) |
| 368 | { |
| 369 | for( auto it = description.begin(); it != description.end(); ++it ) |
| 370 | { |
| 371 | PyObject* value = ToPython( it->second.c_str() ); |
| 372 | PyDict_SetItemString( item, it->first.c_str(), value ); |
| 373 | Py_DECREF( value ); |
| 374 | } |
| 375 | PyList_Append( list, item ); |
| 376 | Py_DECREF( item ); |
| 377 | } |
| 378 | }; |
| 379 | |
| 380 | // -------------------------------------------------------------------------------------- |
| 381 | // Description: |