#include <NavKey.h>
Public Types | |
| enum | ETag { kInt, kFloat, kString } |
| enum | { kMaxStringSize = 8 } |
Public Member Functions | |
| NavKey (bool i) | |
| NavKey (unsigned char i) | |
| NavKey (Int_t i=0) | |
| NavKey (UInt_t i) | |
| NavKey (Long_t i) | |
| NavKey (Double_t f) | |
| NavKey (const NavKey &k) | |
| NavKey (const char *s) | |
| virtual | ~NavKey () |
| Int_t | CompareValue (NavKey that) const |
| Bool_t | CompareType (NavKey that) const |
| Long_t | ForceLong_t () |
| std::string | GetType () const |
| std::string | GetValue () const |
Private Attributes | |
| ETag | fTag |
| Double_t | fFloat |
| Long_t | fInt |
| char | fString [kMaxStringSize] |
Static Private Attributes | |
| char | fValueStr [15] |
|
|
Definition at line 36 of file NavKey.h. 00036 { kMaxStringSize = 8 };
|
|
|
Definition at line 35 of file NavKey.h. 00035 { kInt, kFloat, kString };
|
|
|
Definition at line 39 of file NavKey.h.
|
|
|
Definition at line 40 of file NavKey.h.
|
|
|
Definition at line 42 of file NavKey.h.
|
|
|
Definition at line 43 of file NavKey.h.
|
|
|
Definition at line 44 of file NavKey.h.
|
|
|
Definition at line 45 of file NavKey.h.
|
|
|
Definition at line 46 of file NavKey.h. 00046 { LEA_CTOR; *this = k; }
|
|
|
Definition at line 165 of file NavKey.cxx. References fString, fTag, kMaxStringSize, LEA_CTOR, and MSG. 00165 {
00166 //
00167 //
00168 // Purpose: Constructor for character string value.
00169 //
00170 // Arguments:
00171 // string in Initialising char string
00172 //
00173 // Return: n/a
00174 //
00175 // Contact: N. West
00176 //
00177 // Specification:-
00178 // =============
00179 //
00180 // o Construct NavKey from character string value. If string too
00181 // long truncate it.
00182
00183 // Program Notes:-
00184 // =============
00185
00186 // None.
00187
00188 LEA_CTOR //Leak Checking
00189
00190 strncpy( fString, string, kMaxStringSize );
00191 fString[kMaxStringSize-1] = '\0';
00192 fTag = kString;
00193
00194 if ( strlen( string ) >= kMaxStringSize ) {
00195 MSG("Nav", Msg::kError) << "String " << string
00196 << " too long, truncated to " << fString << endl;
00197 }
00198 }
|
|
|
Definition at line 48 of file NavKey.h. 00048 { LEA_DTOR; }
|
|
|
Definition at line 52 of file NavKey.h. References fTag.
|
|
|
Definition at line 45 of file NavKey.cxx. References MSG. Referenced by NavSet::DoSelectSlice(), NavSet::GetZone(), AlgStripSRList::MakeXtalkMap(), NavValidate::Test_6(), NavSet::Update(), and NavSet::XLessThanY(). 00045 {
00046 //
00047 //
00048 // Purpose: Compare this NavKey with that NavKey
00049 //
00050 // Arguments:
00051 // that in The NavKey to be compared with.
00052 //
00053 // Return: this - that:-
00054 // = 1 this > that
00055 // = 0 this = that
00056 // = -1 this < that
00057 // = 999 that NavKey is not of same type.
00058 //
00059 // Contact: N. West
00060 //
00061 // Specification:-
00062 // =============
00063 //
00064 // o Compare two NavKeys.
00065
00066 // Program Notes:-
00067 // =============
00068
00069 // None.
00070
00071 if ( ! CompareType(that) ) {
00072
00073 MSG("Nav", Msg::kWarning) << "Cannot compare NavKeys:-" << endl
00074 << " this:" << GetType() << " " << GetValue() << endl
00075 << " that:" << that.GetType() << " " << that.GetValue() << endl;
00076
00077 return 999;
00078 }
00079
00080 switch (fTag) {
00081 case kInt:
00082 return ( fInt > that.fInt ) ? 1 : ( fInt < that.fInt ) ? -1 : 0;
00083 case kFloat:
00084 return ( fFloat > that.fFloat ) ? 1 :
00085 ( fFloat < that.fFloat) ? -1 : 0;
00086 default:
00087 Int_t test = strcmp(fString, that.fString);
00088 return ( test > 0 ) ? 1 : ( test < 0 ) ? -1 : 0;
00089 }
00090
00091 }
|
|
|
Definition at line 53 of file NavKey.h. Referenced by NavGenLattice::Rebuild(). 00053 { return fInt; } // Regardless of fTag
|
|
|
Definition at line 95 of file NavKey.cxx. 00095 {
00096 //
00097 //
00098 // Purpose: Return NavKey type as string.
00099 //
00100 // Arguments: None.
00101 //
00102 // Return: NavKey type as string.
00103 //
00104 // Contact: N. West
00105 //
00106 // Specification:-
00107 // =============
00108 //
00109 // o Return NavKey type as string.
00110
00111 // Program Notes:-
00112 // =============
00113
00114 // None.
00115
00116 switch (fTag) {
00117 case kInt: return "Int";
00118 case kFloat: return "Float";
00119 default: return "String";
00120 }
00121
00122 }
|
|
|
Definition at line 126 of file NavKey.cxx. References fFloat, fInt, fString, fValueStr, kFloat, and kInt. Referenced by NavValidate::Test_6(). 00126 {
00127 //
00128 //
00129 // Purpose: Return NavKey value as string.
00130 //
00131 // Arguments: None.
00132 //
00133 // Return: NavKey value as string.
00134 //
00135 // Contact: N. West
00136 //
00137 // Specification:-
00138 // =============
00139 //
00140 // o Return NavKey value as string.
00141
00142 // Program Notes:-
00143 // =============
00144
00145 // None.
00146
00147 switch (fTag) {
00148 case kInt:
00149 sprintf( fValueStr, "%ld", fInt);
00150 break;
00151 case kFloat:
00152 sprintf( fValueStr, "%g", fFloat );
00153 break;
00154 default:
00155 sprintf( fValueStr, "%s", fString);
00156 break;
00157 }
00158
00159 return fValueStr;
00160
00161 }
|
|
|
Definition at line 65 of file NavKey.h. Referenced by GetValue(). |
|
|
Definition at line 66 of file NavKey.h. Referenced by GetValue(). |
|
|
Definition at line 67 of file NavKey.h. Referenced by GetValue(), and NavKey(). |
|
|
Definition at line 63 of file NavKey.h. Referenced by CompareType(), and NavKey(). |
|
|
Definition at line 37 of file NavKey.cxx. Referenced by GetValue(). |
1.3.9.1