Changeset 8892 for trunk/MagicSoft/Mars/mdata
- Timestamp:
- 05/19/08 15:04:36 (17 years ago)
- Location:
- trunk/MagicSoft/Mars/mdata
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mdata/MDataMember.cc
r8720 r8892 93 93 // -------------------------------------------------------------------------- 94 94 // 95 // Check if accessing fCall is safe 96 // 97 Bool_t MDataMember::CheckGet() const 98 { 99 if (!fObject) 100 { 101 *fLog << err << "ERROR - MDataMember::Get: fObject not initialized "; 102 *fLog << "(not PreProcessed)... returning 0." << endl; 103 return kFALSE; 104 } 105 106 if (!fCall) 107 { 108 *fLog << err << "ERROR - MDataMemberGet: No TMethodCall for " << fDataMember << " of "; 109 *fLog << fObject->GetName() << " available... returning 0." << endl; 110 return kFALSE; 111 } 112 113 return kTRUE; 114 } 115 116 // -------------------------------------------------------------------------- 117 // 95 118 // Returns the value you requested 96 119 // 97 120 Double_t MDataMember::GetValue() const 98 121 { 99 if (!fObject) 100 { 101 *fLog << err << "ERROR - MDataMember::GetValue: fObject not initialized "; 102 *fLog << "(not PreProcessed)... returning 0." << endl; 122 if (!CheckGet()) 103 123 return 0; 104 }105 106 if (!fCall)107 {108 *fLog << err << "No TMethodCall for " << fDataMember << " of ";109 *fLog << fObject->GetName() << " available... returning 0." << endl;110 return 0;111 }112 124 113 125 switch (fCall->ReturnType()) … … 127 139 *fLog << fObject->GetName() << " neither int nor float... returning 0." << endl; 128 140 return 0; 141 } 142 } 143 144 // -------------------------------------------------------------------------- 145 // 146 // Returns the string you requested 147 // 148 const char *MDataMember::GetString() const 149 { 150 if (!CheckGet()) 151 return NULL; 152 153 switch (fCall->ReturnType()) 154 { 155 case TMethodCall::kString: 156 { 157 char *c=NULL; 158 fCall->Execute(fObject, &c); 159 return c; 160 } 161 162 default: 163 *fLog << err << "DataMember " << fDataMember << " of "; 164 *fLog << fObject->GetName() << " not a char*... returning NULL." << endl; 165 return NULL; 129 166 } 130 167 } -
trunk/MagicSoft/Mars/mdata/MDataMember.h
r3572 r8892 22 22 enum { kIsInt = BIT(14) }; 23 23 24 Bool_t CheckGet() const; 25 24 26 public: 25 27 MDataMember(const char *member=NULL) : fObject(NULL), fCall(NULL) … … 32 34 33 35 Double_t GetValue() const; 36 const char *GetString() const; 34 37 Bool_t PreProcess(const MParList *plist); 35 38
Note:
See TracChangeset
for help on using the changeset viewer.