def deepConvertConfdHKeyPathToPyKeyPath (confdHKeyPathPtr, pyKeyPath): """ This function performs a deep convertion of a confd_hkeypath object to a python KeyPath object. It reallocates all data memory, making the python KeyPath object its owner. pyKeyPath must be pre-constructed """ for logFunc in pyconfdlib._log("deep-convert-confd-hkeypath-to-pykeypath").debug4Func(): logFunc("deepConvertConfdHKeyPathToPyKeyPath called. confdHKeyPathPtr=%s, pyKeyPath=%s", ConfdHKeyPathLow.ConfdHKeyPathToStr(confdHKeyPathPtr), pyKeyPath) if not pyKeyPath or not confdHKeyPathPtr: for logFunc in pyconfdlib._log("deep-convert-confd-value-to-pyvalue-invalid-args").errorFunc(): logFunc("deepConvertConfdValueToPyValue invalid args: confdHKeyPathPtr=%s, pyKeyPath=%s", ConfdHKeyPathLow.ConfdHKeyPathToStr(confdHKeyPathPtr), pyKeyPath) return ReturnCodes.kGeneralError confdKeyPathLen = pyconfdlib.dll.py_getHkeypathLen(confdHKeyPathPtr) for logFunc in pyconfdlib._log("deep-convert-confd-hkeypath-to-pykeypath-len").debug4Func(): logFunc("deepConvertConfdHKeyPathToPyKeyPath: confdKetPathLen=%d, confdHKeyPathPtr=%s, pyKeyPath=%s", confdKeyPathLen, ConfdHKeyPathLow.ConfdHKeyPathToStr(confdHKeyPathPtr), pyKeyPath) for i in range(confdKeyPathLen): level = [] for j in range(pyconfdlib.MAXKEYLEN): confdValPtr = pyconfdlib.dll.py_getHkeypathValue(confdHKeyPathPtr, confdKeyPathLen-1-i, j, False) pyValue = Value() rc = ConfdValueLow.deepConvertConfdValueToPyValue(confdValPtr, pyValue) if rc != ReturnCodes.kOk: for logFunc in pyconfdlib._log("deep-convert-confd-hkeypath-to-pykeypath-convert-keypath-failed").errorFunc(): logFunc("deepConvertConfdHKeyPathToPyKeyPath: deepConvertConfdValueToPyValue "\ "failed: i=%d, j=%d, confdHKeyPathPtr=%s, pyKeyPath=%s, rc=%s", i, j, ConfdHKeyPathLow.ConfdHKeyPathToStr(confdHKeyPathPtr), pyKeyPath, str(rc)) return ReturnCodes.kGeneralError if pyValue.getType() == Value.kEmpty: break level.append(pyValue) if level: #for logFunc in pyconfdlib._log("deep-convert-confd-hkeypath-to-pykeypath-appending").debug4Func(): logFunc("deepConvertConfdHKeyPathToPyKeyPath: appending level=%s", level) pyKeyPath._key.append(level) for logFunc in pyconfdlib._log("deep-convert-confd-hkeypath-to-pykeypath-done").debug4Func(): logFunc("deepConvertConfdHKeyPathToPyKeyPath done. confdHKeyPathPtr=%s, pyKeyPath=%s", ConfdHKeyPathLow.ConfdHKeyPathToStr(confdHKeyPathPtr), pyKeyPath) return ReturnCodes.kOk