FIDAL - Financial Data Access Library

  Home | Documentation | Download
 

 

NAME
   FD_SymbolTableAlloc - C Function


SYNOPSIS
   #include "fidal.h"

   FD_RetCode FD_SymbolTableAlloc( FD_UDBase *unifiedDatabase,
                                   const char *category,
                                   FD_StringTable **table );

DATA STRUCTURE

   typedef struct
   {
       unsigned int size;   /* Number of string. */
       const char **string; /* Pointer on the strings. */
   } FD_StringTable;

DESCRIPTION

Allocate and return a table representing ALL the symbols belonging to a particular category.

The categories are optionally specified when doing FD_AddDataSource. A category will typically represent the exchange to which the symbols can belong. But in practice, a category can be any string.

Not specifying a category (using NULL) will return all symbols under the default category called "ZZ.OTHER.OTHER".

The table returned by this function should be considered read only. Modifying size and/or string can have unpredictable consequence.

The whole table can be freed by calling FD_SymbolTableFree.

If no symbols exist under the specified category, the field size will be zero. The table will still need to be freed with FD_SymbolTableFree.

The string returned in the table will not exceed the number of bytes specified by FD_SYMBOL_MAX_LENGTH.


RETURN VALUE

FD_SUCCESSOperation is successful
FD_ALLOC_ERRProcess cannot allocate memory, or memory corruption detected
FD_UNKNOWN_ERROperation failed for unknown reason

For other error code, or to match a number to an error description, check the FD_RetCode enumeration in "FIDAL/c/include/fd_common.h"

SEE ALSO

FD_SymbolTableFree , FD_CategoryTableAlloc , FD_Initialize , FD_AddDataSource

EXAMPLE
#include <stdio.h>
#include "fidal.h"

void showAllSymbols( FD_UDBase *udBase,
                     const char *theCategory )
{
   FD_StringTable *table;
   FD_RetCode retCode;
   int i;

   printf( "The category %s contains\n", theCategory );
   printf( "the following symbols:\n" );

   retCode = FD_SymbolTableAlloc( udBase, theCategory, &table );

   if( retCode == FD_SUCCESS )
   {
      for( i=0; i < table->size; i++ )
         printf( "%s\n", table->string[i] );

      FD_SymbolTableFree( table );
   }
}

 

 
Google  SourceForge Logo
  Web FidalSoft.org
 

Copyright? 2006 TicTacTec LLC. All Rights Reserved. Last Update: 07/21/06, Unique Visitor: