Changeset 23594 for branches/cnb_branches/cnb_branch_20090301/psModules/src/concepts/pmConceptsStandard.c
- Timestamp:
- Mar 29, 2009, 6:15:31 PM (17 years ago)
- Location:
- branches/cnb_branches/cnb_branch_20090301
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090301
-
branches/cnb_branches/cnb_branch_20090301/psModules
- Property svn:mergeinfo changed
/trunk/psModules merged: 23354,23358,23370,23374,23378,23404-23405,23428,23432,23447,23450-23452,23476,23487,23498,23535,23574,23576-23577,23587
- Property svn:mergeinfo changed
-
branches/cnb_branches/cnb_branch_20090301/psModules/src/concepts/pmConceptsStandard.c
r23351 r23594 606 606 } 607 607 608 // Get the current value of a concept 609 static psMetadataItem *conceptGet(const pmFPA *fpa, // FPA of interest 610 const pmChip *chip, // Chip of interest, or NULL 611 const pmCell *cell, // Cell of interest, or NULL 612 const char *name // Concept name 613 ) 614 { 615 psMetadataItem *item = NULL; // Item with time system 616 if (cell) { 617 item = psMetadataLookup(cell->concepts, name); 618 } 619 if (!item && chip) { 620 item = psMetadataLookup(chip->concepts, name); 621 } 622 if (!item && fpa) { 623 item = psMetadataLookup(fpa->concepts, name); 624 } 625 if (!item) { 626 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find %s in concepts", name); 627 return NULL; 628 } 629 return item; 630 } 631 632 // Determine the corresponding TIMESYS for one of the TIME concepts 633 static psTimeType conceptGetTimesysForTime(const char *name, // Concept name ("CELL.TIME" or "FPA.TIME") 634 const pmFPA *fpa, // FPA of interest 635 const pmChip *chip, // Chip of interest, or NULL 636 const pmCell *cell // Cell of interest, or NULL 637 ) 638 { 639 assert(name); 640 641 psString timesysName = psStringCopy(name); // e.g., "CELL.TIME" --> "CELL.TIMESYS" 642 psStringSubstitute(×ysName, "TIMESYS", "TIME"); 643 psMetadataItem *item = conceptGet(fpa, chip, cell, timesysName); // Time system 644 psFree(timesysName); 645 646 if (!item || item->type != PS_TYPE_S32) { 647 psWarning("Unable to find %s --- assuming UTC", timesysName); 648 return PS_TIME_UTC; 649 } 650 return item->data.S32; 651 } 652 653 // Set the corresponding TIMESYS for one of the TIME concepts 654 static bool conceptSetTimesysForTime(const char *name, // Concept name ("CELL.TIME" or "FPA.TIME") 655 const pmFPA *fpa, // FPA of interest 656 const pmChip *chip, // Chip of interest, or NULL 657 const pmCell *cell, // Cell of interest, or NULL 658 psTimeType timeSys // The time system value 659 ) 660 { 661 assert(name); 662 663 psString timesysName = psStringCopy(name); // e.g., "CELL.TIME" --> "CELL.TIMESYS" 664 psStringSubstitute(×ysName, "TIMESYS", "TIME"); 665 psMetadataItem *item = conceptGet(fpa, chip, cell, timesysName); // Time system 666 psFree(timesysName); 667 668 if (!item) { 669 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find %s in concepts when setting %s\n", 670 timesysName, name); 671 return false; 672 } 673 674 if (item->data.S32 != -1 && item->data.S32 != timeSys) { 675 psWarning("Time system is set to %x; but should be %x", item->data.S32, timeSys); 676 } 677 678 item->data.S32 = timeSys; 679 680 return true; 681 } 608 682 609 683 psMetadataItem *p_pmConceptParse_TIMESYS(const psMetadataItem *concept, … … 622 696 if (concept->type != PS_DATA_STRING || strlen(sys) <= 0) { 623 697 // XXX is this too low verbosity? 624 ps LogMsg ("psModules.concepts", PS_LOG_DETAIL, "Can't interpret %s --- assuming UTC.\n", pattern->name);698 psWarning("Can't interpret %s --- assuming UTC.", pattern->name); 625 699 } else if (strcasecmp(sys, "TAI") == 0) { 626 700 timeSys = PS_TIME_TAI; … … 633 707 } else { 634 708 // XXX is this too low verbosity? 635 psLogMsg ("psModules.concepts", PS_LOG_DETAIL, "Can't interpret %s --- assuming UTC.\n", pattern->name); 709 psWarning("Can't interpret %s --- assuming UTC.", pattern->name); 710 } 711 712 psMetadataItem *old = conceptGet(fpa, chip, cell, pattern->name); // Old value 713 if (old && old->data.S32 != -1 && old->data.S32 != timeSys) { 714 psWarning("%s is already set (%x) and not consistent with new value (%x)", 715 pattern->name, old->data.S32, timeSys); 636 716 } 637 717 … … 639 719 } 640 720 641 // Determine the corresponding TIMESYS for one of the TIME concepts 642 static psTimeType conceptGetTimesysForTime(const char *name, // Concept name ("CELL.TIME" or "FPA.TIME") 643 const pmFPA *fpa, // FPA of interest 644 const pmChip *chip, // Chip of interest, or NULL 645 const pmCell *cell // Cell of interest, or NULL 646 ) 647 { 648 assert(name); 649 650 psString timesysName = psStringCopy(name); // e.g., "CELL.TIME" --> "CELL.TIMESYS" 651 psStringSubstitute(×ysName, "TIMESYS", "TIME"); 652 bool mdok = false; // Result of MD lookup 653 psTimeType timeSys = 0xFFFFFFFF; // The time system 654 if (cell) { 655 timeSys = psMetadataLookupS32(&mdok, cell->concepts, timesysName); 656 } 657 if (!mdok && chip) { 658 timeSys = psMetadataLookupS32(&mdok, chip->concepts, timesysName); 659 } 660 if (!mdok && fpa) { 661 timeSys = psMetadataLookupS32(&mdok, fpa->concepts, timesysName); 662 } 663 if (!mdok || (timeSys == 0xFFFFFFFF)) { 664 psWarning("Unable to find %s in concepts when parsing %s --- assuming UTC.\n", 665 timesysName, name); 666 timeSys = PS_TIME_UTC; 667 } 668 psFree(timesysName); 669 670 return timeSys; 671 } 721 672 722 673 723 psMetadataItem *p_pmConceptParse_TIME(const psMetadataItem *concept, … … 896 946 } 897 947 898 time->type = timeSys; 948 if (jdTime || mjdTime) { 949 conceptSetTimesysForTime(pattern->name, fpa, chip, cell, PS_TIME_TAI); 950 } else { 951 time->type = timeSys; 952 } 899 953 900 954 psMetadataItem *item = psMetadataItemAllocPtr(pattern->name, PS_DATA_TIME, pattern->comment, time);
Note:
See TracChangeset
for help on using the changeset viewer.
