# RSL_new_...

### Synopsis

#include "rsl.h"
Ray *RSL_new_ray(int max_bins);
Sweep *RSL_new_sweep(int max_rays);
Volume *RSL_new_volume(int max_sweeps);
Radar *RSL_new_radar(int nvolumes);

###

Description

RSL_new_radar allocates memory for a Radar. It allocates space for it's header and space for nvolumes pointers to Volume, it does not assign anything to the new header. It does not allocate any volumes, just the pointers. You have to perform the allocation of volumes yourself. Do this by looping on nvolumes and calling RSL_new_volume.

nvolumes does not represent the number of volumes in the radar structure. It represents the number of volume index slots or the maximum volume index. Reserved values DZ_INDEX, VR_INDEX, SW_INDEX, CZ_INDEX, ZT_INDEX, DR_INDEX, and LR_INDEX are the numbers 0 through 6. They are volume indexes. If you have 2 volumes (non NULL pointers) that are SW_INDEX and ZT_INDEX, you must be sure that nvolumes is, at least, ZT_INDEX+1. All the other volume pointers are NULL. It is perfectly valid to have NULL volume pointers.

RSL_new_volume allocates memory for a Volume. It allocates space for it's header and space for nsweep pointers to Sweep, it does not assign anything to the new header. It does not allocate any sweeps, just the pointers. You have to perform the allocation of sweeps yourself. Do this by looping on nsweeps and calling RSL_new_sweep.

nsweeps does not represent the number of non NULL sweep pointers. It is the number of index slots or the maximum sweep index. It is valid to have NULL sweep pointers.

RSL_new_sweep allocates memory for a Sweep. It allocates space for it's header and space for nrays pointers to Ray. It does not allocate any rays, just the pointers, nor does it assign any values to the new header. You have to perform the allocation of rays yourself. Do this by looping on nrays and calling RSL_new_ray.

nrays does not represent the number of non NULL ray pointers. It is the number of index slots or the maximum ray index. It is valid to have NULL ray pointers.

RSL_new_ray allocates memory for a Ray. It allocates space for it's header and space for a Range array of size nbins. It does not assign any values to the header. Since, the Range type is not a pointer, this function allocates an array of Range of size nbins. Currently, Range is just an alias for unsigned char.

### Return value

Upon successful completion, a pointer to the appropriate structure is returned. Otherwise, a NULL pointer is returned and errno is set.

### See also

RSL_free_volume, RSL_free_sweep, RSL_free_ray
RSL_copy_volume, RSL_copy_sweep, RSL_copy_ray

Author: John H. Merritt