Changeset 3016 in Sophya for trunk/SophyaLib/BaseTools/sophyainit.cc
- Timestamp:
- Jul 17, 2006, 2:28:12 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/sophyainit.cc
r2830 r3016 20 20 #include "sversion.h" 21 21 22 #include <iostream> 23 #include <map> 24 22 25 // --- Classe d'initialisation de SOPHYA, (PPersistMgr en particulier) 23 26 int SophyaInitiator::FgInit = 0; 27 // Module version number - 2.0 , Jul 2006 28 #define MOD_VERS 2.0 29 30 // Pour garder la liste des modules et leurs numeros de version 31 map<string, double>* ModListP = NULL; 24 32 25 33 /*! … … 34 42 be a sub-class of SophyaInitiator. 35 43 */ 44 36 45 37 46 SophyaInitiator::SophyaInitiator() … … 46 55 47 56 InitFailNewHandler(); 57 ModListP = new map<string, double>; 58 48 59 49 60 #ifdef xx__mac__ … … 149 160 150 161 // si var env SOPHYA_NOPRTVER definie pas de print 151 if(!getenv("SOPHYA_NOPRTVER")) Version(true);162 if(!getenv("SOPHYA_NOPRTVER")) PrintVersion(false); 152 163 153 164 int pnice; … … 157 168 nice(pnice); 158 169 170 SophyaInitiator::RegisterModule("BaseTools", MOD_VERS); // Module name and version number registration 159 171 } 160 172 … … 171 183 } 172 184 173 double SophyaInitiator::Version(bool fgprt) 174 { 175 if (fgprt) { 185 /*! 186 \brief Return the SOPHYA version number. 187 \param svers contain the complete in addition the SOPHYA tag, the compiler name 188 and the compilation date 189 */ 190 double SophyaInitiator::GetVersion(string& svers) 191 { 176 192 char* compiler = 0; 177 193 #ifdef __GNUG__ … … 186 202 #ifdef __KCC__ 187 203 compiler = const_cast<char *>("KCC ") ; 204 #endif 205 #ifdef __IBMCPP__ 206 compiler = const_cast<char *>("IBM-xlC ") ; 207 #endif 208 #ifdef __INTEL_COMPILER 209 compiler = const_cast<char *>("Intel-icc ") ; 188 210 #endif 189 211 #ifdef __SGICC__ … … 197 219 compiler = const_cast<char *>("Codewarrior "); 198 220 #endif 199 fprintf(stderr,"SOPHYA Version %4.1f Revision %d (%s) -- %s %s %s\n", 221 222 char buff[512]; 223 sprintf(buff,"SOPHYA Version %4.1f Revision %d (%s) -- %s %s %s", 200 224 SOPHYA_VERSION, SOPHYA_REVISION, SOPHYA_TAG, 201 225 __DATE__, __TIME__, compiler); 202 } 203 return(SOPHYA_VERSION + (SOPHYA_REVISION/1000.)); 204 } 205 226 svers = buff; 227 228 return(SOPHYA_VERSION + (SOPHYA_REVISION/1000.)); 229 } 230 231 //! Print the SOPHYA version string and optionaly the list of registered modules 232 void SophyaInitiator::PrintVersion(bool fglist) 233 { 234 string svers; 235 GetVersion(svers); 236 cout << svers << endl; 237 if (fglist) ListModules(cout); 238 } 239 240 //! Should be called by sub-classes to register module name and version 241 int SophyaInitiator::RegisterModule(const char * name, double version) 242 { 243 if (ModListP == NULL) 244 throw NullPtrError("SophyaInitiator::RegisterModule() ModListP= NULL !"); 245 map<string, double>& modlist = *ModListP; 246 modlist[string(name)] = version; 247 return modlist.size(); 248 } 249 250 //! List of registered module names and version number 251 int SophyaInitiator::ListModules(ostream& os) 252 { 253 if (ModListP == NULL) 254 throw NullPtrError("SophyaInitiator::ListModules() ModListP= NULL !"); 255 os << "--- SophyaInitiator::ListModules() Name / VersionNumber --- " << endl; 256 map<string, double>& modlist = *ModListP; 257 int k = 1; 258 for(map<string, double>::iterator it = modlist.begin(); it != modlist.end(); it++, k++) 259 os << k << " : " << (*it).first << " V= " << (*it).second << endl; 260 os << " ----------------------------------------------------------- " << endl; 261 return modlist.size(); 262 } 263 264 //! Return the SOPHYA version number: VERS + REV/1000 206 265 double SOPHYA::SophyaVersion() 207 266 { … … 211 270 // On met un objet initiator en statique, pour les loaders qui savent 212 271 // appeler le constructeur des objets statiques Reza 08/98 213 #if !defined(Darwin)214 272 // La presence de l'objet statique psophyainit semble poserun probleme 215 273 // sur MacOSX 10.2 qui se plante a l'initialisation avec les shared-libs 274 // Suppression de #if !defined(Darwin) en Juil 2006 216 275 static SophyaInitiator psophyainit; 217 #endif 276
Note:
See TracChangeset
for help on using the changeset viewer.