alavrik/piqi-rpc — pull request #3 by yfyf (2014-02-04 11:57:53+00:00)
Title: Add function field serialisation / default helpers

This adds helper functions for (de)serialisations and default
generation of function input/output/error fields to `$MOD_piqi_rpc.erl`.

The rationale is that, unlike types, the actual function (in particular, its
name) is something which exists only in `$MOD_piqi_rpc.erl`, so it makes sense to
provide these helpers and abstract from the actual type definitions the
function fields.

This also allows to slightly simplify some of the other generated code.

By now `piqic_erlang_rpc.erl` could do with some refactoring in general, but did not tackle it in this issue.

NOTE: I'm not entirely sure generating a function for each of these is such a great idea,
perhaps instead I should generate single functions with clauses, like:

```erlang
parse(IOType, FunctionName, Data) ->
....

gen(IOType, FunctionName, Data) ->
....

% alternatively / additionally provide wrappers
parse_input(FunctioName, Data) ->
....
```

I implemented it this way to match how it's done elsewhere, but from the user's perspective it's probably easier to call `foobar_piqi_rpc:parse_input(Method, Data)` rather than construct the function name by string manipulation and allows to write generic code more easily.

What do you think?