How do I use the API to code a delayed replication?

Created by Yves Pelletier on
Keywords:
coding example

The following link shows how to do it in C:

http://bazaar.launchpad.net/~libecbufr-dev/libecbufr/trunk/view/head:/Examples/encode_delayed_repl.c

And this one how to do it in Perl:

http://bazaar.launchpad.net/~chris-beauregard/libecbufr/libecbufr-perl/view/head:/t/encode_delayed_template.t

Roughly speaking, the approach is:

1. create the template
2. create the dataset from the template
3. create a datasubset from the dataset
4. expand the datasubset (if necessary, such as the replication descriptor being buried in a Table C)
5. find the delayed replication descriptor in the datasubset
6. set the value of the replication descriptor to your replication $count
7. expand the datasubset (again). Note that if you didn't mess with anything else, the result of the previous
find will still be valid, and now there will be $count blank and expanded replicated elements just after that
position.
8. set the values for the replicated descriptors.

Thanks to Chris Beauregard for providing the source material