From: <ag...@us...> - 2011-12-27 03:26:30
|
Revision: 2652 http://zoolib.svn.sourceforge.net/zoolib/?rev=2652&view=rev Author: agreen Date: 2011-12-27 03:26:23 +0000 (Tue, 27 Dec 2011) Log Message: ----------- Make field and param names more distinct. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZYadTree.cpp Modified: trunk/zoolib/source/cxx/zoolib/ZYadTree.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYadTree.cpp 2011-12-22 00:59:28 UTC (rev 2651) +++ trunk/zoolib/source/cxx/zoolib/ZYadTree.cpp 2011-12-27 03:26:23 UTC (rev 2652) @@ -42,13 +42,12 @@ Chain(const Chain& iOther); public: - Chain - (const ZRef<Chain>& iParent, const ZRef<ZYadMapRPos>& iYadMapRPos); + Chain(const ZRef<Chain>& iParent, const ZRef<ZYadMapRPos>& iYadMapRPos); ZRef<Chain> Clone(); ZRef<ZYadR> ReadInc(string& oName); - ZRef<ZYadR> ReadAt(const ZRef<CountedString>& iProto, const string& iName); + ZRef<ZYadR> ReadAt(const ZRef<CountedString>& iProtoName, const string& iName); private: ZRef<ZYadR> pReadAt(const string& iName); @@ -68,7 +67,7 @@ : public ZYadSeqRPos { public: - YadSeqRPos(const ZRef<CountedString>& iProto, + YadSeqRPos(const ZRef<CountedString>& iProtoName, const ZRef<Chain>& iChain, const ZRef<ZYadSeqRPos>& iYadSeqRPos); // From ZYadSeqR via ZYadSeqRPos @@ -85,7 +84,7 @@ virtual ZRef<ZYadR> ReadAt(uint64 iPosition); private: - const ZRef<CountedString> fProto; + const ZRef<CountedString> fProtoName; const ZRef<Chain> fChain; const ZRef<ZYadSeqRPos> fYadSeqRPos; }; @@ -98,10 +97,10 @@ : public ZYadMapRPos { public: - YadMapRPos(const ZRef<CountedString>& iProto, + YadMapRPos(const ZRef<CountedString>& iProtoName, const ZRef<Chain>& iChain, const string& iPosition); - YadMapRPos(const ZRef<CountedString>& iProto, const ZRef<ZYadMapRPos>& iYad); + YadMapRPos(const ZRef<CountedString>& iProtoName, const ZRef<ZYadMapRPos>& iYad); // From ZYadMapR via ZYadMapRPos ZRef<ZYadR> ReadInc(string& oName); @@ -114,7 +113,7 @@ virtual ZRef<ZYadR> ReadAt(const string& iName); private: - const ZRef<CountedString> fProto; + const ZRef<CountedString> fProtoName; ZRef<Chain> fChain; string fPosition; }; @@ -123,14 +122,14 @@ #pragma mark - #pragma mark * Helpers -static ZRef<ZYadR> spWrap(const ZRef<CountedString>& iProto, +static ZRef<ZYadR> spWrap(const ZRef<CountedString>& iProtoName, const ZRef<Chain>& iChain, const ZRef<ZYadR>& iYad) { if (ZRef<ZYadSeqRPos> theYadSeqRPos = iYad.DynamicCast<ZYadSeqRPos>()) - return new YadSeqRPos(iProto, iChain, theYadSeqRPos); + return new YadSeqRPos(iProtoName, iChain, theYadSeqRPos); if (ZRef<ZYadMapRPos> theYadMapRPos = iYad.DynamicCast<ZYadMapRPos>()) - return new YadMapRPos(iProto, new Chain(iChain, theYadMapRPos), string()); + return new YadMapRPos(iProtoName, new Chain(iChain, theYadMapRPos), string()); return iYad; } @@ -150,6 +149,7 @@ : fParent(iParent) , fYadMapRPos(iYadMapRPos) { + // It's an error and a problem if iYadMapRPos is a YadTree::YadMapRPos. ZAssert(not iYadMapRPos.DynamicCast<YadMapRPos>()); } @@ -162,20 +162,22 @@ ZRef<ZYadR> Chain::pReadAt(const string& iName) { return fYadMapRPos->ReadAt(iName); } -ZRef<ZYadR> Chain::ReadAt(const ZRef<CountedString>& iProto, const string& iName) +ZRef<ZYadR> Chain::ReadAt(const ZRef<CountedString>& iProtoName, const string& iName) { + using namespace ZUtil_STL; + if (ZRef<ZYadR> theYad = this->pReadAt(iName)) - return spWrap(iProto, this, theYad); + return spWrap(iProtoName, this, theYad); ZRef<Chain> theChain; - if (ZQ<ZRef<Chain> > theByNameQ = ZUtil_STL::sQGet(fCacheByName, iName)) + if (ZQ<ZRef<Chain> > theByNameQ = sQGet(fCacheByName, iName)) { theChain = *theByNameQ; } - else if (ZRef<ZYadStrimR> theProtoYad = this->pReadAt(iProto->Get()).DynamicCast<ZYadStrimR>()) + else if (ZRef<ZYadStrimR> theProtoYad = this->pReadAt(iProtoName->Get()).DynamicCast<ZYadStrimR>()) { const string theTrailString = theProtoYad->GetStrimR().ReadAll8(); - if (ZQ<ZRef<Chain> > theByTrailQ = ZUtil_STL::sQGet(fCacheByTrail, theTrailString)) + if (ZQ<ZRef<Chain> > theByTrailQ = sQGet(fCacheByTrail, theTrailString)) { theChain = *theByTrailQ; } @@ -220,17 +222,17 @@ } } } - ZUtil_STL::sInsertMustNotContain(fCacheByTrail, theTrailString, theChain); + sInsertMustNotContain(fCacheByTrail, theTrailString, theChain); } - ZUtil_STL::sInsertMustNotContain(fCacheByName, iName, theChain); + sInsertMustNotContain(fCacheByName, iName, theChain); } if (theChain) - return theChain->ReadAt(iProto, iName); + return theChain->ReadAt(iProtoName, iName); // Yay, lexical scoping, disabled for now. if (false && fParent) - return spWrap(iProto, fParent, fParent->pReadAt(iName)); + return spWrap(iProtoName, fParent, fParent->pReadAt(iName)); return null; } @@ -239,18 +241,18 @@ #pragma mark - #pragma mark * YadSeqRPos definition -YadSeqRPos::YadSeqRPos(const ZRef<CountedString>& iProto, +YadSeqRPos::YadSeqRPos(const ZRef<CountedString>& iProtoName, const ZRef<Chain>& iChain, const ZRef<ZYadSeqRPos>& iYadSeqRPos) -: fProto(iProto) +: fProtoName(iProtoName) , fChain(iChain) , fYadSeqRPos(iYadSeqRPos) {} ZRef<ZYadR> YadSeqRPos::ReadInc() - { return spWrap(fProto, fChain, fYadSeqRPos->ReadInc()); } + { return spWrap(fProtoName, fChain, fYadSeqRPos->ReadInc()); } ZRef<ZYadSeqRClone> YadSeqRPos::Clone() - { return new YadSeqRPos(fProto, fChain, fYadSeqRPos->Clone().DynamicCast<ZYadSeqRPos>()); } + { return new YadSeqRPos(fProtoName, fChain, fYadSeqRPos->Clone().DynamicCast<ZYadSeqRPos>()); } uint64 YadSeqRPos::GetPosition() { return fYadSeqRPos->GetPosition(); } @@ -262,21 +264,21 @@ { return fYadSeqRPos->GetSize(); } ZRef<ZYadR> YadSeqRPos::ReadAt(uint64 iPosition) - { return spWrap(fProto, fChain, fYadSeqRPos->ReadAt(iPosition)); } + { return spWrap(fProtoName, fChain, fYadSeqRPos->ReadAt(iPosition)); } // ================================================================================================= #pragma mark - #pragma mark * YadMapRPos definition -YadMapRPos::YadMapRPos(const ZRef<CountedString>& iProto, +YadMapRPos::YadMapRPos(const ZRef<CountedString>& iProtoName, const ZRef<Chain>& iChain, const string& iPosition) -: fProto(iProto) +: fProtoName(iProtoName) , fChain(iChain) , fPosition(iPosition) {} -YadMapRPos::YadMapRPos(const ZRef<CountedString>& iProto, const ZRef<ZYadMapRPos>& iYad) -: fProto(iProto) +YadMapRPos::YadMapRPos(const ZRef<CountedString>& iProtoName, const ZRef<ZYadMapRPos>& iYad) +: fProtoName(iProtoName) , fChain(new Chain(null, iYad)) {} @@ -289,7 +291,7 @@ return fChain->ReadInc(oName); oName = fPosition; - return fChain->ReadAt(fProto, sGetSet(fPosition, string())); + return fChain->ReadAt(fProtoName, sGetSet(fPosition, string())); } ZRef<ZYadR> YadMapRPos::ReadAt(const string& iName) @@ -297,11 +299,11 @@ if (fChain->IsShared()) fChain = fChain->Clone(); fPosition.clear(); - return fChain->ReadAt(fProto, iName); + return fChain->ReadAt(fProtoName, iName); } ZRef<ZYadMapRClone> YadMapRPos::Clone() - { return new YadMapRPos(fProto, fChain->Clone(), fPosition); } + { return new YadMapRPos(fProtoName, fChain->Clone(), fPosition); } void YadMapRPos::SetPosition(const string& iName) { fPosition = iName; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |