Miscellaneous Utilities


Functions

void irplib_reset (void)
 Reset IRPLIB state.
int irplib_compare_tags (cpl_frame *frame1, cpl_frame *frame2)
 Comparison function to identify different input frames.
const char * irplib_frameset_find_file (const cpl_frameset *self, const char *tag)
 Find the filename with the given tag in a frame set.
cpl_frame * irplib_frameset_get_first_from_group (const cpl_frameset *self, cpl_frame_group group)
 Find the first frame belonging to the given group.
cpl_error_code irplib_apertures_find_max_flux (const cpl_apertures *self, int *ind, int nfind)
 Find the aperture(s) with the greatest flux.
char * irplib_vsprintf_macro (const char *format, va_list arglist, va_list argcopy)
 Create a string and fill it using vsnprintf().
char * irplib_sprintf (const char *format,...)
 Create a new string by concatenation.
cpl_type_bpp irplib_bpp_find (int minval, int maxval)
 Find the smallest BITPIX usable for the given integer range.

Function Documentation

cpl_error_code irplib_apertures_find_max_flux const cpl_apertures *  self,
int *  ind,
int  nfind
 

Find the aperture(s) with the greatest flux.

Parameters:
self The aperture object
ind The aperture-indices in order of decreasing flux
nfind Number of indices to find
Returns:
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
nfind must be at least 1 and at most the size of the aperture object.

The ind array must be able to hold (at least) nfind integers. On success the first nfind elements of ind point to indices of the aperture object.

To find the single ind of the aperture with the maximum flux use simply: int ind; irplib_apertures_find_max_flux(self, &ind, 1);

Definition at line 189 of file irplib_utils.c.

cpl_type_bpp irplib_bpp_find int  minval,
int  maxval
 

Find the smallest BITPIX usable for the given integer range.

Parameters:
minval The minimum pixel value in the integer image
maxval The maximum pixel value in the integer image
Returns:
The smallest CPL BITPIX value usable with the given range
Note:
If minval exceeds maxval a CPL error is set and the result in undefined

When possible, CPL_BPP_16_SIGNED is preferred over CPL_BPP_16_UNSIGNED

See also:
cpl_image_save()

Definition at line 367 of file irplib_utils.c.

int irplib_compare_tags cpl_frame *  frame1,
cpl_frame *  frame2
 

Comparison function to identify different input frames.

Parameters:
frame1 first frame
frame2 second frame
Returns:
0 if frame1!=frame2, 1 if frame1==frame2, -1 in error case

Definition at line 80 of file irplib_utils.c.

const char* irplib_frameset_find_file const cpl_frameset *  self,
const char *  tag
 

Find the filename with the given tag in a frame set.

Parameters:
self A frame set.
tag The frame tag to search for.
Returns:
The filename or NULL if none found and on error.
See also:
cpl_frameset_find
Note:
If called with a CPL error code, the location will be updated and NULL returned.
NULL is returned and no error code set if the tag is not found.

If the file is not unique, the name of the first one is returned and with a warning.

Definition at line 116 of file irplib_utils.c.

cpl_frame* irplib_frameset_get_first_from_group const cpl_frameset *  self,
cpl_frame_group  group
 

Find the first frame belonging to the given group.

Parameters:
self The frameset
group The group attribute
Returns:
The first frame belonging to the given group, or NULL if no such frame was found. The function returns NULL if an error occurs and sets the appropriate error code.

Definition at line 146 of file irplib_utils.c.

void irplib_reset void   ) 
 

Reset IRPLIB state.

This function resets all static memory used by IRPLIB to a well-defined, initial state.

The function should be called (during initialization) by any application using static memory facilities in IRPLIB.

Currently, this function resets the IRPLIB error state, including the cpl_error_code.

Definition at line 66 of file irplib_utils.c.

References irplib_error_reset().

char* irplib_sprintf const char *  format,
  ...
 

Create a new string by concatenation.

Parameters:
format The format string
... Variable argument list for format
Returns:
The allocated string with the concatenation or NULL on error
Note:
The returned string must be deallocated with cpl_free()
See also:
irplib_vsprintf()
Example of usage:
       int error;

       char * cp_cmd = irplib_sprintf("cp %s %s/%s", long_file, new_dir,
                                                     new_file);
       assert( cp_cmd != NULL);

       error = system(cp_cmd);

       assert(!error);

       cpl_free(cp_cmd);

Possible CPL error codes set in this function:

  • CPL_ERROR_NULL_INPUT if the format string is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the format string has an invalid format

Definition at line 332 of file irplib_utils.c.

References irplib_vsprintf_macro().

char* irplib_vsprintf_macro const char *  format,
va_list  arglist,
va_list  argcopy
 

Create a string and fill it using vsnprintf().

Parameters:
format The format string
arglist The argument list for the format
argcopy The argument list for the format - again
Returns:
The created string or NULL on error
Note:
The created string must be deallocated with cpl_free()

This function may only be called via irplib_vsprintf()

See also:
vsnprintf()
Possible CPL error codes set in this function:
  • CPL_ERROR_NULL_INPUT if the format string is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the format string has an invalid format

Definition at line 245 of file irplib_utils.c.

Referenced by irplib_sprintf().


Generated on Wed Jan 17 08:33:45 2007 for SINFONI Pipeline Reference Manual by  doxygen 1.4.4