- Timestamp:
- Dec 9, 2006, 12:56:11 AM (18 years ago)
- Location:
- trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/cee/RpLibraryCInterface.h
r511 r554 13 13 14 14 15 #ifndef _RpLIBRARY_C_H 16 #define _RpLIBRARY_C_H 17 15 18 #ifdef __cplusplus 16 extern "C" {17 #endif 19 extern "C" { 20 #endif // ifdef __cplusplus 18 21 19 22 typedef struct RpLibrary RpLibrary; … … 80 83 81 84 #ifdef __cplusplus 82 } 83 #endif 85 } 86 #endif // ifdef __cplusplus 87 88 #endif // ifndef _RpLIBRARY_C_H -
trunk/src/cee/RpUnitsCInterface.h
r511 r554 12 12 */ 13 13 14 #ifndef _RpUNITS_C_H 15 #define _RpUNITS_C_H 16 14 17 #ifdef __cplusplus 15 extern "C" {16 #endif 18 extern "C" { 19 #endif // ifdef __cplusplus 17 20 18 21 typedef struct RpUnits RpUnits; … … 71 74 72 75 #ifdef __cplusplus 73 } 74 #endif 76 } 77 #endif // ifdef __cplusplus 78 79 #endif // ifndef _RpUNITS_C_H -
trunk/src/core/RpLibrary.cc
r543 r554 1205 1205 } 1206 1206 1207 if (translateFlag == TRANSLATE) {1207 if (translateFlag == RPLIB_TRANSLATE) { 1208 1208 // translatedContents = new char[strlen(retCStr)+1]; 1209 1209 len = strlen(retCStr); … … 1356 1356 if (retNode) { 1357 1357 1358 if (append ) {1358 if (append == RPLIB_APPEND) { 1359 1359 if ( (contents = scew_element_contents(retNode)) ) { 1360 1360 tmpVal = std::string(contents); … … 1363 1363 } 1364 1364 1365 if (translateFlag == TRANSLATE) {1365 if (translateFlag == RPLIB_TRANSLATE) { 1366 1366 _translateIn(value,translatedContents); 1367 1367 scew_element_set_contents(retNode,translatedContents.c_str()); … … 1429 1429 // old_elem = _find(path+"."+nodeName,NO_CREATE_PATH); 1430 1430 1431 if ( !append) {1431 if (append == RPLIB_OVERWRITE) { 1432 1432 retNode = _find(path,NO_CREATE_PATH); 1433 1433 if (retNode) { … … 1621 1621 std::string xmlText = ""; 1622 1622 time_t t = 0; 1623 struct tm* timeinfo = NULL; 1624 std::string timestamp = ""; 1623 1625 1624 1626 if (this->root) { … … 1629 1631 put("tool.repository.rappture.revision","$Rev$"); 1630 1632 put("tool.repository.rappture.url","$URL$"); 1633 1634 // generate a timestamp for the run file 1635 timeinfo = localtime(&t); 1636 timestamp = std::string(ctime(&t)); 1637 // erase the 24th character because it is a newline 1638 timestamp.erase(24); 1639 // concatinate the timezone 1640 timestamp.append(" "); 1641 timestamp.append(timeinfo->tm_zone); 1642 1643 // add the timestamp to the run file 1644 put("output.time", timestamp); 1631 1645 1632 1646 if ( file.is_open() ) { -
trunk/src/core/RpLibrary.h
r511 r554 12 12 */ 13 13 14 #ifndef _RpLIBRARY_H 15 #define _RpLIBRARY_H 16 17 enum RP_LIBRARY_CONSTS { 18 RPLIB_OVERWRITE = 0, 19 RPLIB_APPEND = 1, 20 RPLIB_NO_TRANSLATE = 0, 21 RPLIB_TRANSLATE = 1, 22 }; 23 24 25 #ifdef __cplusplus 26 14 27 #include "scew/scew.h" 15 28 #include "scew_extras.h" … … 27 40 28 41 /* indentation size (in whitespaces) */ 42 29 43 #define INDENT_SIZE 4 30 44 #define CREATE_PATH 1 … … 35 49 #define NO_TRANSLATE 0 36 50 37 #ifndef _RpLIBRARY_H38 #define _RpLIBRARY_H39 40 41 51 class RpLibrary 42 52 { … … 71 81 72 82 std::string get ( std::string path = "", 73 int translateFlag = TRANSLATE);83 int translateFlag = RPLIB_TRANSLATE); 74 84 std::string getString ( std::string path = "", 75 int translateFlag = TRANSLATE);85 int translateFlag = RPLIB_TRANSLATE); 76 86 77 87 double getDouble ( std::string path = ""); … … 83 93 RpLibrary& get ( std::string path = "", 84 94 std::string retVal = "", 85 int translateFlag = TRANSLATE);95 int translateFlag = RPLIB_TRANSLATE); 86 96 87 97 RpLibrary& get ( std::string path = "", 88 98 double retVal = 0.0, 89 int translateFlag = TRANSLATE);99 int translateFlag = RPLIB_TRANSLATE); 90 100 91 101 RpLibrary& get ( std::string path = "", 92 102 int retVal = 0, 93 int translateFlag = TRANSLATE);103 int translateFlag = RPLIB_TRANSLATE); 94 104 95 105 RpLibrary& get ( std::string path = "", 96 106 bool retVal = false, 97 int translateFlag = TRANSLATE);107 int translateFlag = RPLIB_TRANSLATE); 98 108 */ 99 109 … … 101 111 std::string value, 102 112 std::string id = "", 103 int append = 0,104 int translateFlag = TRANSLATE);113 int append = RPLIB_OVERWRITE, 114 int translateFlag = RPLIB_TRANSLATE ); 105 115 106 116 RpLibrary& put ( std::string path, 107 117 double value, 108 118 std::string id = "", 109 int append = 0);119 int append = RPLIB_OVERWRITE ); 110 120 111 121 RpLibrary& put ( std::string path, 112 122 RpLibrary* value, 113 123 std::string id = "", 114 int append = 0);124 int append = RPLIB_OVERWRITE ); 115 125 116 126 RpLibrary* remove (std::string path = ""); … … 443 453 /*--------------------------------------------------------------------------*/ 444 454 445 #endif 455 #endif // ifdef __cplusplus 456 457 #endif // ifndef _RpLIBRARY_H -
trunk/src/core/RpUnits.cc
r544 r554 19 19 // set the dictionary to be case insensitive for seaches and storage 20 20 RpDict<std::string,RpUnits*,RpUnits::_key_compare>* RpUnits::dict = 21 new RpDict<std::string,RpUnits*,RpUnits::_key_compare>(true); 21 new RpDict<std::string,RpUnits*,RpUnits::_key_compare>( 22 RPUNITS_CASE_INSENSITIVE); 22 23 23 24 // install predefined units 24 25 static RpUnitsPreset loader; 25 26 // convert function flags27 const int RpUnits::UNITS_OFF = 0;28 const int RpUnits::UNITS_ON = 1;29 26 30 27 /**********************************************************************/ … … 646 643 647 644 name = "m" + basisName; 648 RpUnits * milli = RpUnits::define(name, basis, basis->type,!RPUNITS_CI); 645 RpUnits * milli = RpUnits::define(name, basis, basis->type, 646 !RPUNITS_CASE_INSENSITIVE); 649 647 RpUnits::define(milli, basis, milli2base, base2milli); 650 648 … … 658 656 659 657 name = "p" + basisName; 660 RpUnits * pico = RpUnits::define(name, basis, basis->type,!RPUNITS_CI); 658 RpUnits * pico = RpUnits::define(name, basis, basis->type, 659 !RPUNITS_CASE_INSENSITIVE); 661 660 RpUnits::define(pico, basis, pico2base, base2pico); 662 661 … … 682 681 683 682 name = "M" + basisName; 684 RpUnits * mega = RpUnits::define(name, basis, basis->type,!RPUNITS_CI); 683 RpUnits * mega = RpUnits::define(name, basis, basis->type, 684 !RPUNITS_CASE_INSENSITIVE); 685 685 RpUnits::define(mega, basis, mega2base, base2mega); 686 686 … … 694 694 695 695 name = "P" + basisName; 696 RpUnits * peta = RpUnits::define(name, basis, basis->type,!RPUNITS_CI); 696 RpUnits * peta = RpUnits::define(name, basis, basis->type, 697 !RPUNITS_CASE_INSENSITIVE); 697 698 RpUnits::define(peta, basis, peta2base, base2peta); 698 699 … … 1201 1202 } 1202 1203 1203 if (showUnits ) {1204 if (showUnits == RPUNITS_UNITS_ON) { 1204 1205 outVal << numVal << fromUnitsName; 1205 1206 } … … 1223 1224 } 1224 1225 1225 if (showUnits ) {1226 if (showUnits == RPUNITS_UNITS_ON) { 1226 1227 outVal << numVal << toUnitsName; 1227 1228 } … … 1395 1396 // outVal.flags(std::ios::fixed); 1396 1397 // outVal.precision(10); 1397 if (showUnits ) {1398 if (showUnits == RPUNITS_UNITS_ON) { 1398 1399 outVal << numVal << toUnitsName; 1399 1400 } … … 1434 1435 1435 1436 1436 if (showUnits ) {1437 if (showUnits == RPUNITS_UNITS_ON) { 1437 1438 unitText << retVal << toUnits->getUnitsName(); 1438 1439 } -
trunk/src/core/RpUnits.h
r544 r554 13 13 * ====================================================================== 14 14 */ 15 #include <iostream>16 #include <string>17 #include <list>18 #include <sstream>19 #include <stdlib.h>20 #include <errno.h>21 #include <math.h>22 23 #include "RpDict.h"24 #include "RpUnitsStd.h"25 15 26 16 #ifndef _RpUNITS_H 27 17 #define _RpUNITS_H 28 18 29 #define LIST_TEMPLATE RpUnitsListEntry 19 enum RP_UNITS_CONSTS { 20 RPUNITS_UNITS_OFF = 0, 21 RPUNITS_UNITS_ON = 1 22 }; 30 23 31 24 // RpUnits Case Insensitivity define 32 #define RPUNITS_C Itrue33 25 #define RPUNITS_CASE_INSENSITIVE true 26 // 34 27 //define our different types of units 35 28 #define RP_TYPE_ENERGY "energy" … … 44 37 #define RP_TYPE_MISC "misc" 45 38 46 // should the define function: 47 // 1. compare portions of inStr to unit names that have previously 48 // been defined (you must parse in order for this option to work) 49 #define COMPARE_MASK 1 50 // 2. create a unit if no unit by the name exists. 51 #define CREATE_MASK 2 52 // 3. parse the unit name to try to find previously defined units. 53 #define PARSE_MASK 4 39 40 #ifdef __cplusplus 41 42 #include <iostream> 43 #include <string> 44 #include <list> 45 #include <sstream> 46 #include <stdlib.h> 47 #include <errno.h> 48 #include <math.h> 49 50 #include "RpDict.h" 51 #include "RpUnitsStd.h" 52 53 #define LIST_TEMPLATE RpUnitsListEntry 54 54 55 55 class RpUnits; … … 329 329 public: 330 330 331 // constant static class variables332 // flags to tell how convert should return the value333 static const int UNITS_OFF;334 static const int UNITS_ON;335 336 331 // users member fxns 337 332 std::string getUnits() const; … … 364 359 std::string convert ( const RpUnits* toUnits, 365 360 double val, 366 int showUnits = 0,361 int showUnits = RPUNITS_UNITS_OFF, 367 362 int* result = NULL ) const; 368 369 static std::string convert1 ( std::string val,370 std::string toUnits,371 int showUnits,372 int* result = NULL );373 363 374 364 static std::string convert ( std::string val, 375 365 std::string toUnits, 376 int showUnits ,366 int showUnits = RPUNITS_UNITS_OFF, 377 367 int* result = NULL ); 378 379 /*380 static std::string convert ( std::string val,381 std::string toUnits,382 int showUnits,383 int* result = NULL );384 */385 368 386 369 // turn the current unit to the metric system … … 414 397 const RpUnits* basis=NULL, 415 398 const std::string type="", 416 bool caseInsensitive=RPUNITS_C I);399 bool caseInsensitive=RPUNITS_CASE_INSENSITIVE); 417 400 418 401 // add relation rule … … 713 696 /*--------------------------------------------------------------------------*/ 714 697 715 #endif 698 #endif // ifdef __cplusplus 699 700 #endif // ifndef _RpUNITS_H -
trunk/src/fortran/RpLibraryFInterface.h
r511 r554 12 12 */ 13 13 14 #include "RpLibrary.h" 15 #include <string.h> 16 #include <fstream> 17 #include "RpFortranCommon.h" 18 #include "RpLibraryFStubs.h" 14 #ifndef _RpLIBRARY_F_H 15 #define _RpLIBRARY_F_H 19 16 20 17 #ifdef __cplusplus 18 #include "RpLibrary.h" 19 #include <string.h> 20 #include <fstream> 21 #include "RpFortranCommon.h" 22 #include "RpLibraryFStubs.h" 23 21 24 extern "C" { 22 #endif 25 #endif // ifdef __cplusplus 23 26 24 27 int rp_lib ( const char* filePath, int filePath_len ); … … 154 157 #ifdef __cplusplus 155 158 } 156 #endif 159 #endif // ifdef __cplusplus 160 161 #endif // ifndef _RpLIBRARY_F_H -
trunk/src/fortran/RpUnitsFInterface.h
r511 r554 15 15 #define _RpUNITS_F_H 16 16 17 #include "RpFortranCommon.h" 18 #include "RpUnitsFStubs.h" 17 #ifdef __cplusplus 18 #include "RpFortranCommon.h" 19 #include "RpUnitsFStubs.h" 19 20 20 #ifdef __cplusplus 21 extern "C" { 21 extern "C" { 22 22 #endif 23 23 … … 50 50 51 51 #ifdef __cplusplus 52 }53 #endif 52 } 53 #endif // ifdef __cplusplus 54 54 55 #endif 55 #endif // ifndef _RpUNITS_F_H
Note: See TracChangeset
for help on using the changeset viewer.