objectcomputing / mFAST

A FAST (FIX Adapted for STreaming) encoder/decoder
http://objectcomputing.github.io/mFAST
BSD 3-Clause "New" or "Revised" License
220 stars 114 forks source link

Why ::the_id is not generated for _cref classes? #25

Closed gampx closed 10 years ago

gampx commented 10 years ago

When I generate header and source files with fast_type_gen I have no nested enum constants "the_id" inside "_cref" classes, but do have them in "value" classes. But according to readme "_cref" classes should contain this field. Template can be taken from here: ftp://ftp.moex.ru/pub/FAST/ASTS/template/FIX50SP2-ALL.xml

X_OLR_FOND contains the_id, X_OLR_FOND_cref does not. Is it by design and readme is misleading or it is a bug of fast_type_gen?

huangminghuang commented 10 years ago

It's a documentation issue. the_id should only be available for value types, not for the ref types.

The reason the ref types do not have the_id is because the generated ref classes can be used for static templateRef which won't be bound to a specific value. For example,

  <template name="Foo" id="1"> ... </template>

  <template name="Bar" id="2">
     <group name="f1" id="3">
     <templateRef name="Foo">
    </group>
  </template>

In above case, Foo_cref may be used for f1 which has the id of 3.