FIDAL - Financial Data Access Library

  Home | Documentation | Download
 

 

NAME
   FD_CategoryTableAlloc - C Function


SYNOPSIS
   #include "fidal.h"

   FD_RetCode FD_CategoryTableAlloc( FD_UDBase *unifiedDatabase,
                                     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 categories actually contained in the unified database.

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 ("NASDAQ", "AMEX", "MY STOCK LIST", "TECH GROUP").

There is ALWAYS at least one existing category. It is called the "ZZ.OTHER.OTHER" category and it is used when a symbol was added without specifying a category with FD_AddDataSource.

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

The whole table can be freed by calling FD_CategoryTableFree.

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


RETURN VALUE

FD_SUCCESSOperation is successful
FD_ALLOC_ERRCannot 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_CategoryTableFree , FD_SymbolTableAlloc , FD_Initialize , FD_AddDataSource


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

void showAllCategory( FD_UDBase *udBase )
{
   FD_StringTable *table;
   FD_RetCode retCode;
   int i;

   printf( "This unified database contains the\n" );
   printf( "following categories:\n" );

   retCode = FD_CategoryTableAlloc( udBase, &table );

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

      FD_CategoryTableFree( table );
   }   
}

Google  SourceForge Logo
  Web FidalSoft.org
 

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