From: jean-pierre roux Date: Mon, 25 May 2009 15:18:23 +0000 (+0000) Subject: use 'unsigned int' instead of 'int' and save a lot of runtime 'if' X-Git-Tag: CREATOOLS.2-0-3~52 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=creaBruker.git;a=commitdiff_plain;h=745d14017342932762705cad88c3d4abf42cc9e3 use 'unsigned int' instead of 'int' and save a lot of runtime 'if' --- diff --git a/lib/src1/brukerobjectvaryingproperties.cpp b/lib/src1/brukerobjectvaryingproperties.cpp index 69ddf7f..5e9b92c 100644 --- a/lib/src1/brukerobjectvaryingproperties.cpp +++ b/lib/src1/brukerobjectvaryingproperties.cpp @@ -41,8 +41,8 @@ void BrukerObjectVaryingProperties::setTE(std::map TE = BrukerHM[(std::string) "ACQ_echo_time"].GetDoubleValue(); }; -double BrukerObjectVaryingProperties::getTE(int theValue) const{ - if (theValue < TE.size() && theValue >=0) {return TE[theValue];} +double BrukerObjectVaryingProperties::getTE(unsigned int theValue) const{ + if (theValue < TE.size() ) {return TE[theValue];} else throw 0; } @@ -51,8 +51,8 @@ double BrukerObjectVaryingProperties::getTE(int theValue) const{ TE = theValue; }*/ -double BrukerObjectVaryingProperties::getPositionP(int theValue) const{ - if (theValue < PositionP.size() && theValue >=0) return PositionP[theValue]; +double BrukerObjectVaryingProperties::getPositionP(unsigned int theValue) const{ + if (theValue < PositionP.size() ) return PositionP[theValue]; else throw 0; } @@ -61,8 +61,8 @@ double BrukerObjectVaryingProperties::getPositionP(int theValue) const{ PositionP = theValue; }*/ -double BrukerObjectVaryingProperties::getPositionR(int theValue) const{ - if (theValue < PositionR.size() && theValue >=0) return PositionR[theValue]; +double BrukerObjectVaryingProperties::getPositionR(unsigned int theValue) const{ + if (theValue < PositionR.size() ) return PositionR[theValue]; else throw 0; } @@ -71,8 +71,8 @@ double BrukerObjectVaryingProperties::getPositionR(int theValue) const{ PositionP = theValue; }*/ -double BrukerObjectVaryingProperties::getPositionS(int theValue) const{ - if (theValue < PositionS.size() && theValue >=0) return PositionS[theValue]; +double BrukerObjectVaryingProperties::getPositionS(unsigned int theValue) const{ + if (theValue < PositionS.size() ) return PositionS[theValue]; else throw 0; } @@ -81,8 +81,8 @@ double BrukerObjectVaryingProperties::getPositionS(int theValue) const{ PositionP = theValue; }*/ -int BrukerObjectVaryingProperties::getAcquisitionOrder(int theValue) const{ - if (theValue =0) return AcquisitionOrder[theValue]; +int BrukerObjectVaryingProperties::getAcquisitionOrder(unsigned int theValue) const{ + if (theValue > BrukerObjectVaryingProperties::getOrientation(int theValue) const{ - if (theValue =0)return Orientation[theValue]; +std :: vector < std :: vector < double > > BrukerObjectVaryingProperties::getOrientation(unsigned int theValue) const{ + if (theValue =0) return PositionTimePerNR[theValue]; +double BrukerObjectVaryingProperties::getPositionTimePerNR(unsigned int theValue) const{ + if (theValue > getOrientation(int theValue) const; + std::vector > getOrientation(unsigned int theValue) const; bool init(std::map &BrukerHM, std::vector &LoopStruct);