Package gavo :: Package grammars :: Module directgrammar :: Class FITSCodeGenerator
[frames] | no frames]

Class FITSCodeGenerator

source code

    object --+    
             |    
_CodeGenerator --+
                 |
                FITSCodeGenerator

A code generator for reading from FITS binary tables.

Instance Methods
 
__init__(self, grammar, tableDef)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
getItemParser(self, item, index)
returns code that parses item (a Column instance) at column index index.
source code
 
getPreamble(self)
returns a list of lines that make up the top of the booster.
source code
 
getPrototype(self)
returns the prototype of the getTuple function.
source code
 
getFooter(self)
returns the code for the createDumpfile method.
source code

Inherited from _CodeGenerator: getSetupCode

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  fitsTypes = {'A': ('TSTRING', 'char *'), 'B': ('TBYTE', 'char'...
  makers = {'bigint': 'MAKE_BIGINT', 'bytea': 'MAKE_BYTE', 'doub...
Properties

Inherited from object: __class__

Method Details

__init__(self, grammar, tableDef)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

getItemParser(self, item, index)

source code 

returns code that parses item (a Column instance) at column index index.

You're free to igore index.

Overrides: _CodeGenerator.getItemParser
(inherited documentation)

getPreamble(self)

source code 

returns a list of lines that make up the top of the booster.

Overrides: _CodeGenerator.getPreamble
(inherited documentation)

getPrototype(self)

source code 

returns the prototype of the getTuple function.

Overrides: _CodeGenerator.getPrototype
(inherited documentation)

getFooter(self)

source code 

returns the code for the createDumpfile method.

You want to use the C fragments above for that.

The default returns something that bombs out.

Overrides: _CodeGenerator.getFooter
(inherited documentation)

Class Variable Details

fitsTypes

Value:
{'A': ('TSTRING', 'char *'),
 'B': ('TBYTE', 'char'),
 'D': ('TDOUBLE', 'double'),
 'E': ('TFLOAT', 'float'),
 'I': ('TSHORT', 'short'),
 'J': ('TLONG', 'long'),
 'K': ('TLONGLONG', 'long long'),
 'L': ('TLOGICAL', 'unsigned char')}

makers

Value:
{'bigint': 'MAKE_BIGINT',
 'bytea': 'MAKE_BYTE',
 'double precision': 'MAKE_DOUBLE',
 'integer': 'MAKE_INT',
 'real': 'MAKE_FLOAT',
 'smallint': 'MAKE_SHORT',
 'text': 'MAKE_TEXT'}