| cnmfrm_c |
|
Table of contents
Procedure
cnmfrm_c ( Center name to associated frame )
void cnmfrm_c ( ConstSpiceChar * cname,
SpiceInt frnlen,
SpiceInt * frcode,
SpiceChar * frname,
SpiceBoolean * found )
AbstractRetrieve frame ID code and name to associate with an object. Required_ReadingNone. KeywordsFRAMES Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- cname I Name of the object to find a frame for. frnlen I Maximum length available for frame name. frcode O The ID code of the frame associated with cname. frname O The name of the frame with ID frcode. found O SPICETRUE if the requested information is available. Detailed_Input
cname is the name for object for which there is a
preferred reference frame.
frnlen is the amount of space available, counting the
space required for the terminating null character,
in the output string `frname'. Normally `frnlen' is
the declared length of `frname'.
Detailed_Output
frcode is the frame ID code to associate with a the object
specified by `cname'.
frname is the name of the frame that should be associated
with the object specified by `cname'. `frname' should be
declared as SpiceChar[33] to ensure that it can
contain the full name of the frame. If `frname' does
not have enough room to hold the full name of the
frame, the name will be truncated on the right.
found is SPICETRUE if the appropriate frame ID code and frame
name can be determined. Otherwise `found' is returned
with the value SPICEFALSE.
ParametersNone. Exceptions
1) If `frname' does not have enough room to contain the frame name,
the name will be truncated on the right. (Declaring `frname' to
be SpiceChar[33] will ensure that the name will not be truncated).
2) If the `cname' input string pointer is null, the error
SPICE(NULLPOINTER) is signaled.
3) If the `cname' input string has zero length, the error
SPICE(EMPTYSTRING) is signaled.
4) If the `frname' output string pointer is null, the error
SPICE(NULLPOINTER) is signaled.
5) If the `frname' output string has length less than two
characters, the error SPICE(STRINGTOOSHORT) is signaled, since
the output string is too short to contain one character of
output data plus a null terminator.
FilesNone. Particulars
This routine allows the caller to determine the frame that should
be associated with a particular object. For example, if you
need the frame to associate with the Io, you can call cnmfrm_c
to determine the frame name and id-code for the bodyfixed frame
of Io.
The preferred frame to use with an object is specified via one
of the kernel pool variables:
OBJECT_<cname>_FRAME
where <cname> is the non-blank portion of the string CNAME.
For those PCK objects that have "built-in" frame names this
routine returns the corresponding "IAU" frame and frame ID code.
Examples
The numerical results shown for this example may differ across
platforms. The results depend on the SPICE kernels used as
input, the compiler and supporting libraries, and the machine
specific arithmetic implementation.
1) Retrieve the ID code and name of the preferred frame
associated with a set of body names.
Example code begins here.
/.
Program cnmfrm_ex1
./
#include <stdio.h>
#include "SpiceUsr.h"
int main( )
{
/.
Local constants.
./
#define FRNMLN 33
/.
Local variables.
./
SpiceBoolean found;
SpiceChar frname [ FRNMLN ];
SpiceInt frcode;
SpiceInt i;
/.
Assign an array of body names. Not all the listed names
have a frame associated to them.
./
SpiceChar * body[] = { "IO", "EARTH",
"MOON", "HALO_DELTA" };
/.
Loop over the `body' array, call cnmfrm_c for each
element of `body'.
./
printf( " Body Frame ID Frame name\n" );
printf( "---------- -------- ----------\n" );
for (i = 0; i < 4; i++ )
{
cnmfrm_c ( body[i], FRNMLN, &frcode, frname, &found );
if ( found )
{
printf( "%10s %9d %s\n", body[i], (int)frcode, frname );
}
else
{
printf( "%10s No frame associated with body\n", body[i] );
}
}
return ( 0 );
}
When this program was executed on a Mac/Intel/cc/64-bit
platform, the output was:
Body Frame ID Frame name
---------- -------- ----------
IO 10023 IAU_IO
EARTH 10013 IAU_EARTH
MOON 10020 IAU_MOON
HALO_DELTA No frame associated with body
RestrictionsNone. Literature_ReferencesNone. Author_and_InstitutionN.J. Bachman (JPL) J. Diaz del Rio (ODC Space) W.L. Taber (JPL) Version
-CSPICE Version 1.1.0, 02-AUG-2021 (JDR)
Changed the input argument name "lenout" to "frnlen" for
consistency with other routines.
Edited the header to comply with NAIF standard. Added
complete code example.
Updated -Detailed_Output and -Exceptions to indicate the
required minimum length for the output frame character
string to not be truncated.
-CSPICE Version 1.0.0, 25-JUN-1999 (NJB) (WLT)
Index_EntriesFetch reference frame attributes Link to routine cnmfrm_c source file cnmfrm_c.c |
Fri Dec 31 18:41:03 2021