void ekccnt_c ( ConstSpiceChar * table,
SpiceInt * ccount )
Return the number of distinct columns in a specified, currently
loaded table
EK
EK
FILES
UTILITY
Variable I/O Description
-------- --- --------------------------------------------------
table I Name of table.
ccount O Count of distinct, currently loaded columns.
table is the name of a currently loaded table. Case
is not significant in the table name.
ccount is the number of distinct columns in table.
Columns that have the same name but belong to
different segments that are considered to be
portions of the same column, if the segments
containing those columns belong to table.
None.
1) If the specified table is not loaded, the error
SPICE(TABLENOTLOADED) is signaled.
2) If the input string pointer is null, the error
SPICE(NULLPOINTER) will be signaled.
3) If the input string has length zero, the error
SPICE(EMPTYSTRING) will be signaled.
This routine reads binary "sequence component" EK files.
In order for a binary EK file to be accessible to this routine,
the file must be loaded via a call to furnsh_c or the low-level
EK loader eklef_c.
This routine is a utility intended for use in conjunction with
the entry point ekcii_c. These routines can be used to find the
names and attributes of the columns that are currently loaded.
1) Dump the names and attributes of the columns in each loaded
table. ekccnt_c is used to obtain column counts.
#include "SpiceUsr.h"
#include "SpiceEK.h"
#define FILEN 256
SpiceChar colnam [ SPICE_EK_CSTRLN ];
SpiceChar ek [ FILEN ];
SpiceChar tabnam [ SPICE_EK_TSTRLN ];
SpiceChar * typstrs [ 4 ] =
{
"CHR", "DP", "INT", "TIME"
};
SpiceEKAttDsc attdsc;
SpiceInt i;
SpiceInt ncols;
SpiceInt ntab;
SpiceInt tab;
prompt_c ( "Enter name of EK to examine > ", FILEN, ek );
furnsh_c ( ek );
/.
Get the number of loaded tables.
./
ekntab_c ( &ntab );
for ( tab = 0; tab < ntab; tab++ )
{
/.
Get the name of the current table, and look up
the column count for this table.
./
ektnam_c ( tab, SPICE_EK_TSTRLN, tabnam );
ekccnt_c ( tabnam, &ncols );
printf ( "Table = %s\n\n", tabnam );
/.
For each column in the current table, look up the
column's attributes. The attribute block
index parameters are defined in the include file
ekattdsc.inc.
./
for ( i = 0; i < ncols; i++ )
{
ekcii_c ( tabnam, i, SPICE_EK_CSTRLN, colnam, &attdsc );
printf ( "Column = %s\n", colnam );
/.
Write out the current column's data type.
./
printf ( "Type = %s\n", typstrs[(int)attdsc.dtype] );
if ( attdsc.dtype == SPICE_CHR )
{
if ( attdsc.strlen == SPICE_EK_VARSIZ )
{
printf ( "String length = VARIABLE\n" );
}
else
{
printf ( "String length = %d\n",
(int) attdsc.strlen );
}
}
/.
Write out the current column's entry size.
./
printf ( "Size = %d\n", (int)attdsc.size );
/.
Indicate whether the current column is indexed.
./
if ( attdsc.indexd == SPICETRUE )
{
printf ( "Indexed.\n" );
}
else
{
printf ( "Not indexed.\n" );
}
/.
Indicate whether the current column allows
null values.
./
if ( attdsc.nullok == SPICETRUE )
{
printf ( "Null values allowed.\n" );
}
else
{
printf ( "Null values not allowed.\n" );
}
}
/.
We're done with the current column.
./
}
/.
We're done with the current table.
./
None.
None.
N.J. Bachman (JPL)
-CSPICE Version 1.0.1, 12-JUL-2016 (EDW)
Edit to example program to use "%d" with explicit casts
to int for printing SpiceInts with printf.
-CSPICE Version 1.0.0, 14-OCT-2001 (NJB)
return the number of loaded EK columns
return the count of loaded EK columns
Link to routine ekccnt_c source file ekccnt_c.c
|