Changeset 107261 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Dec 9, 2024 3:09:37 PM (6 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageObjectTracker.cpp
r107241 r107261 51 51 }; 52 52 53 static void printProgressObjectInfo(const ComPtr<IProgress>& pObj); 54 static void printSessionObjectInfo(const ComPtr<ISession>& pObj); 55 static void printMediumObjectInfo(const ComPtr<IMedium>& pObj); 56 static void printMachineObjectInfo(const ComPtr<IMachine>& pObj); 57 53 58 static void makeTimeStr(char *s, int cb, int64_t millies) 54 59 { … … 96 101 }; 97 102 98 void printProgressObjectInfo(const ComPtr<IProgress>& pObj) 103 struct TrackedObjInfoShow 104 { 105 supIfaces_T m_iface; 106 Utf8Str m_id; 107 TrackedObjInfo_T m_objInfo; 108 109 TrackedObjInfoShow(Utf8Str aId, const TrackedObjInfo_T& aObjInfo, supIfaces_T aIface): 110 m_iface(aIface), 111 m_id(aId) 112 { 113 m_objInfo = aObjInfo; 114 } 115 116 TrackedObjInfoShow(supIfaces_T aIface): m_iface(aIface) {} 117 118 void setObjId(const Utf8Str& aId) 119 { 120 m_id = aId; 121 } 122 123 void setObjInfo(const TrackedObjInfo_T& aObjInfo) 124 { 125 m_objInfo = aObjInfo; 126 } 127 128 void show() const 129 { 130 RTPrintf(("\nTracked object id: %s\n"), m_id.c_str()); 131 132 Utf8Str strState = trackedObjectStateToStr(m_objInfo.enmState); 133 RTPrintf((" State %s\n"), strState.c_str()); 134 135 char szTimeValue[128]; 136 makeTimeStr(szTimeValue, sizeof(szTimeValue), m_objInfo.creationTime); 137 RTPrintf((" Creation time %s\n"), szTimeValue); 138 139 if (m_objInfo.deletionTime != 0) 140 { 141 makeTimeStr(szTimeValue, sizeof(szTimeValue), m_objInfo.deletionTime); 142 RTPrintf((" Deletion time %s\n"), szTimeValue); 143 } 144 145 switch (m_iface) 146 { 147 case kProgress: 148 { 149 if (m_objInfo.enmState != TrackedObjectState_Invalid) 150 { 151 ComPtr<IProgress> pObj; 152 m_objInfo.pIUnknown->QueryInterface(IID_IProgress, (void **)pObj.asOutParam()); 153 if (pObj.isNotNull()) 154 printProgressObjectInfo(pObj); 155 } 156 break; 157 } 158 case kSession: 159 { 160 if (m_objInfo.enmState != TrackedObjectState_Invalid) 161 { 162 ComPtr<ISession> pObj; 163 m_objInfo.pIUnknown->QueryInterface(IID_ISession, (void **)pObj.asOutParam()); 164 if (pObj.isNotNull()) 165 printSessionObjectInfo(pObj); 166 } 167 break; 168 } 169 case kMedium: 170 { 171 if (m_objInfo.enmState != TrackedObjectState_Invalid) 172 { 173 ComPtr<IMedium> pObj; 174 m_objInfo.pIUnknown->QueryInterface(IID_IMedium, (void **)pObj.asOutParam()); 175 if (pObj.isNotNull()) 176 printMediumObjectInfo(pObj); 177 } 178 break; 179 } 180 case kMachine: 181 { 182 if (m_objInfo.enmState != TrackedObjectState_Invalid) 183 { 184 ComPtr<IMachine> pObj; 185 m_objInfo.pIUnknown->QueryInterface(IID_IMachine, (void **)pObj.asOutParam()); 186 if(pObj.isNotNull()) 187 printMachineObjectInfo(pObj); 188 } 189 break; 190 } 191 /* Impossible situation but to support the default case */ 192 default: 193 RTPrintf("Interface isn't supported by object tracker at moment"); 194 } 195 } 196 }; 197 198 static void printProgressObjectInfo(const ComPtr<IProgress>& pObj) 99 199 { 100 200 if (pObj.isNotNull()) … … 117 217 } 118 218 119 void printSessionObjectInfo(const ComPtr<ISession>& pObj)219 static void printSessionObjectInfo(const ComPtr<ISession>& pObj) 120 220 { 121 221 if (pObj.isNotNull()) … … 136 236 } 137 237 138 void printMediumObjectInfo(const ComPtr<IMedium>& pObj)238 static void printMediumObjectInfo(const ComPtr<IMedium>& pObj) 139 239 { 140 240 if (pObj.isNotNull()) … … 206 306 } 207 307 208 void printMachineObjectInfo(const ComPtr<IMachine>& pObj)308 static void printMachineObjectInfo(const ComPtr<IMachine>& pObj) 209 309 { 210 310 if (pObj.isNotNull()) … … 240 340 pObj->COMGETTER(SettingsFilePath)(bStrAttr.asOutParam()); 241 341 RTPrintf((" SettingsFilePath %s\n"), Utf8Str(bStrAttr).c_str()); 242 243 pObj->COMGETTER(SettingsAuxFilePath)(bStrAttr.asOutParam());244 RTPrintf((" SettingsAuxFilePath %s\n"), Utf8Str(bStrAttr).c_str());245 342 246 343 pObj->COMGETTER(StateFilePath)(bStrAttr.asOutParam()); … … 266 363 void printTrackedObjectInfo(supIfaces_T aIface, const map < Bstr, TrackedObjInfo_T >& aObjMap) 267 364 { 268 switch (aIface) 269 { 270 case kProgress: 271 for (const pair< const Bstr, TrackedObjInfo_T >& item : aObjMap) 272 { 273 ComPtr<IProgress> pObj; 274 item.second.pIUnknown->QueryInterface(IID_IProgress, (void **)pObj.asOutParam()); 275 276 RTPrintf(("\nTracked object id: %s\n"), Utf8Str(item.first).c_str()); 277 278 Utf8Str strState = trackedObjectStateToStr(item.second.enmState); 279 RTPrintf((" State %s\n"), strState.c_str()); 280 281 char szTimeValue[128]; 282 makeTimeStr(szTimeValue, sizeof(szTimeValue), item.second.creationTime); 283 RTPrintf((" Creation time %s\n"), szTimeValue); 284 285 if (item.second.deletionTime != 0) 286 { 287 makeTimeStr(szTimeValue, sizeof(szTimeValue), item.second.deletionTime); 288 RTPrintf((" Deletion time %s\n"), szTimeValue); 289 } 290 291 if (item.second.enmState != TrackedObjectState_Invalid && pObj.isNotNull()) 292 printProgressObjectInfo(pObj); 293 } 294 295 break; 296 297 case kSession: 298 for (const pair< const Bstr, TrackedObjInfo_T >& item : aObjMap) 299 { 300 ComPtr<ISession> pObj; 301 item.second.pIUnknown->QueryInterface(IID_ISession, (void **)pObj.asOutParam()); 302 303 RTPrintf(("\nTracked object id: %s\n"), Utf8Str(item.first).c_str()); 304 305 Utf8Str strState = trackedObjectStateToStr(item.second.enmState); 306 RTPrintf((" State %s\n"), strState.c_str()); 307 308 char szTimeValue[128]; 309 makeTimeStr(szTimeValue, sizeof(szTimeValue), item.second.creationTime); 310 RTPrintf((" Creation time %s\n"), szTimeValue); 311 312 if (item.second.deletionTime != 0) 313 { 314 makeTimeStr(szTimeValue, sizeof(szTimeValue), item.second.deletionTime); 315 RTPrintf((" Deletion time %s\n"), szTimeValue); 316 } 317 318 if (item.second.enmState != TrackedObjectState_Invalid && pObj.isNotNull()) 319 printSessionObjectInfo(pObj); 320 } 321 322 break; 323 324 case kMedium: 325 for (const pair< const Bstr, TrackedObjInfo_T >& item : aObjMap) 326 { 327 ComPtr<IMedium> pObj; 328 item.second.pIUnknown->QueryInterface(IID_IMedium, (void **)pObj.asOutParam()); 329 330 RTPrintf(("\nTracked object id: %s\n"), Utf8Str(item.first).c_str()); 331 332 Utf8Str strState = trackedObjectStateToStr(item.second.enmState); 333 RTPrintf((" State %s\n"), strState.c_str()); 334 335 char szTimeValue[128]; 336 makeTimeStr(szTimeValue, sizeof(szTimeValue), item.second.creationTime); 337 RTPrintf((" Creation time %s\n"), szTimeValue); 338 339 if (item.second.deletionTime != 0) 340 { 341 makeTimeStr(szTimeValue, sizeof(szTimeValue), item.second.deletionTime); 342 RTPrintf((" Deletion time %s\n"), szTimeValue); 343 } 344 345 if (item.second.enmState != TrackedObjectState_Invalid && pObj.isNotNull()) 346 printMediumObjectInfo(pObj); 347 } 348 349 break; 350 351 case kMachine: 352 for (const pair< const Bstr, TrackedObjInfo_T >& item : aObjMap) 353 { 354 ComPtr<IMachine> pObj; 355 item.second.pIUnknown->QueryInterface(IID_IMachine, (void **)pObj.asOutParam()); 356 357 RTPrintf(("\nTracked object id: %s\n"), Utf8Str(item.first).c_str()); 358 359 Utf8Str strState = trackedObjectStateToStr(item.second.enmState); 360 RTPrintf((" State %s\n"), strState.c_str()); 361 362 char szTimeValue[128]; 363 makeTimeStr(szTimeValue, sizeof(szTimeValue), item.second.creationTime); 364 RTPrintf((" Creation time %s\n"), szTimeValue); 365 366 if (item.second.deletionTime != 0) 367 { 368 makeTimeStr(szTimeValue, sizeof(szTimeValue), item.second.deletionTime); 369 RTPrintf((" Deletion time %s\n"), szTimeValue); 370 } 371 372 if (item.second.enmState != TrackedObjectState_Invalid && pObj.isNotNull()) 373 printMachineObjectInfo(pObj); 374 } 375 376 break; 377 378 default: 379 RTPrintf("Interface isn't supported by object tracker at moment"); 380 break; 381 } 365 TrackedObjInfoShow trackedObjInfoShow(aIface); 366 for (const pair< const Bstr, TrackedObjInfo_T >& item : aObjMap) 367 { 368 trackedObjInfoShow.setObjId(Utf8Str(item.first)); 369 trackedObjInfoShow.setObjInfo(item.second); 370 trackedObjInfoShow.show(); 371 } 372 382 373 } 383 374
Note:
See TracChangeset
for help on using the changeset viewer.