MCPcopy Create free account
hub / github.com/Norbyte/ositools / ConstructStatus

Function ConstructStatus

OsiInterface/Functions/StatusFunctions.cpp:287–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285
286 template <class T>
287 T * ConstructStatus(esv::StatusMachine * statusMachine, char const * statusId, StatusType type)
288 {
289 auto statusIdFs = ToFixedString(statusId);
290 T * status{ nullptr };
291
292 auto createStatus = gOsirisProxy->GetLibraryManager().StatusMachineCreateStatus;
293 if (createStatus == nullptr) {
294 OsiError("esv::StatusMachine::CreateStatus not found!");
295 return nullptr;
296 }
297
298 if (statusIdFs) {
299 status = (T *)createStatus(statusMachine, statusIdFs, 0);
300 }
301
302 if (status == nullptr) {
303 OsiError("Status does not exist: " << statusId);
304 return nullptr;
305 }
306
307 if (status->GetStatusId() != type) {
308 // TODO - dangling status ptr!
309 OsiError("Status has incorrect type: " << statusId);
310 return nullptr;
311 }
312
313 return status;
314 }
315
316
317 bool ApplyActiveDefense(OsiArgumentDesc & args)

Callers

nothing calls this directly

Calls 1

ToFixedStringFunction · 0.85

Tested by

no test coverage detected