MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / GetDataPtr

Method GetDataPtr

src/persistence/dbaccess.h:736–756  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

734 dbk::PrefixType GetPrefixType() const { return PREFIX_TYPE; }
735
736 std::shared_ptr<ValueType> GetDataPtr() const {
737
738 if (ptrData) {
739 return ptrData;
740 } else if (pBase != nullptr){
741 auto ptr = pBase->GetDataPtr();
742 if (ptr) {
743 ptrData = std::make_shared<ValueType>(*ptr);
744 return ptrData;
745 }
746 } else if (pDbAccess != NULL) {
747 auto ptrDbData = db_util::MakeEmptyValue<ValueType>();
748
749 if (pDbAccess->GetData(PREFIX_TYPE, *ptrDbData)) {
750 assert(!db_util::IsEmpty(*ptrDbData));
751 ptrData = ptrDbData;
752 return ptrData;
753 }
754 }
755 return nullptr;
756 }
757
758private:
759 inline void AddOpLog(const ValueType &oldValue, const ValueType *pNewValue) {

Callers 1

DbCacheToStringFunction · 0.80

Calls 2

IsEmptyFunction · 0.85
GetDataMethod · 0.45

Tested by

no test coverage detected