Changeset 13496
- Timestamp:
- May 23, 2007, 4:38:07 PM (19 years ago)
- Location:
- trunk/psModules/src/camera
- Files:
-
- 3 edited
-
pmFPAfileDefine.c (modified) (1 diff)
-
pmFPAfileDefine.h (modified) (2 diffs)
-
pmFPAfileIO.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAfileDefine.c
r13451 r13496 84 84 // XXX ppFocus wants to override the selection with the new selection 85 85 // XXX require programs like ppFocus to remove existing files by hand 86 if (!psMetadataAddPtr (config->files, PS_LIST_TAIL, name, PS_DATA_UNKNOWN, "", file)) { 86 if (!psMetadataAddPtr (config->files, PS_LIST_TAIL, name, 87 PS_DATA_UNKNOWN | PS_META_DUPLICATE_OK, "", file)) { 87 88 psError (PS_ERR_IO, false, "could not add %s to config files", name); 88 89 return NULL; -
trunk/psModules/src/camera/pmFPAfileDefine.h
r12831 r13496 4 4 * @author EAM, IfA 5 5 * 6 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $7 * @date $Date: 2007-0 4-14 03:01:11$6 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-05-24 02:38:07 $ 8 8 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii 9 9 */ … … 18 18 // 19 19 // Note that the returned pmFPAfile is a view only, so it should not be freed by the caller --- the only 20 // reference count is held by the config->files metadata. 20 // reference count is held by the config->files metadata. Multiple file rules of the same name are permitted 21 // if multiple is true. 21 22 pmFPAfile *pmFPAfileDefineInput (const pmConfig *config, pmFPA *fpa, const char *name); 22 23 -
trunk/psModules/src/camera/pmFPAfileIO.c
r13193 r13496 5 5 #include <stdio.h> 6 6 #include <string.h> 7 #include <strings.h> /* for strn?casecmp */7 #include <strings.h> /* for strn?casecmp */ 8 8 #include <pslib.h> 9 9 … … 661 661 case PM_FPA_FILE_HEADER: 662 662 case PM_FPA_FILE_FRINGE: 663 // XXX note that for CMF and PSF, we do not know yet if there is actually any data to 664 // write out. this is because these types of output files have their data stored on the665 // readout->analysis metadata structure of another (existing) fpa663 // XXX note that for CMF and PSF, we do not know yet if there is actually any data to 664 // write out. this is because these types of output files have their data stored on the 665 // readout->analysis metadata structure of another (existing) fpa 666 666 case PM_FPA_FILE_CMF: 667 667 case PM_FPA_FILE_PSF: … … 848 848 PS_ASSERT_PTR_NON_NULL(files, false); 849 849 850 if (!name) { 851 psMetadataItem *item = NULL; 852 psMetadataIterator *iter = psMetadataIteratorAlloc (files, PS_LIST_HEAD, NULL); 853 while ((item = psMetadataGetAndIncrement (iter)) != NULL) { 854 pmFPAfile *file = item->data.V; 855 if (state) { 856 file->state &= PS_NOT_U8(PM_FPA_STATE_INACTIVE); 857 } else { 858 file->state |= PM_FPA_STATE_INACTIVE; 859 } 860 } 861 psFree (iter); 862 return true; 863 } 864 865 bool status = false; 866 pmFPAfile *file = psMetadataLookupPtr (&status, files, name); 867 if (!status) { 868 psTrace("psModules.camera", 6, "%s is not a defined IO file", name); 869 return false; 870 } 871 if (!file) { 872 psError(PS_ERR_IO, true, "file %s is NULL", name); 873 return false; 874 } 875 if (state) { 876 file->state &= PS_NOT_U8(PM_FPA_STATE_INACTIVE); 877 } else { 878 file->state |= PM_FPA_STATE_INACTIVE; 879 } 880 return true; 881 } 850 // Do this as an iteration rather than a lookup, since we may want to turn on/off multiple files at once 851 // (if there are multiple files defined with the same name). 852 853 psString regex = NULL; // Regular expression for psMetadataIteratorAlloc 854 if (name) { 855 psStringAppend(®ex, "^%s$", name); 856 } 857 858 int num = 0; // Number of files activated 859 psMetadataItem *item = NULL; // Item from iteration 860 psMetadataIterator *iter = psMetadataIteratorAlloc(files, PS_LIST_HEAD, regex); // Iterator 861 while ((item = psMetadataGetAndIncrement(iter))) { 862 pmFPAfile *file = item->data.V; // File of interest 863 if (state) { 864 file->state &= PS_NOT_U8(PM_FPA_STATE_INACTIVE); 865 } else { 866 file->state |= PM_FPA_STATE_INACTIVE; 867 } 868 num++; 869 } 870 psFree(iter); 871 psFree(regex); 872 873 if (num == 0) { 874 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unable to find any files matching %s", name); 875 return false; 876 } 877 878 return true; 879 }
Note:
See TracChangeset
for help on using the changeset viewer.
