Some registered items may support extra forms of communication than the listed
notifications. In this case, we use the REG_GENERIC
notification
together with a task number and some task specific data to send a specific
task to a specific registered data. This provides a way for individual
displays to add new communicates methods to the registration scheme.
To send a REG_GENERIC
task, the reg_generic structure must first
be completed by setting job, task and data. Data will
point to another structure, which is unique for specific type of task. The
task data structure must then be initialised and sent to the appropriate
client contig, id or type.
The task number needs to be unique across all the types of generic tasks
likely to be sent to the client. For instance, a contig editor can receive
TASK_EDITOR_SETCURSOR
and TASK_EDITOR_GETCON
tasks. Obviously
the #define
s for these tasks need to be different. However they may
safely coincide with TASK_TEMPLATE_REDRAW
, which is used by the
template display, as we know that the the editor will never receive this task
(and vice versa). The assignment of task numbers is at present something which
requires further investigation. However the use of defines everywhere means
that they are trivial to change.
typedef struct { char *con; /* Allocated by the contig editor */ int lreg; /* Set lreg and rreg to 0 for all consensus */ int rreg; int con_cut; int qual_cut; } task_editor_getcon;
Allocates and calculates a consensus (stored in con) between lreg and rreg. If lreg and rreg are both zero, then all the consensus is computed. The calling function is expected to free con when finished. An example of use can be seen in the stop codon code:
reg_generic gen; task_editor_getcon tc; gen.job = REG_GENERIC; gen.task = TASK_EDITOR_GETCON; gen.data = (void *)&tc; tc.lreg = 0; tc.rreg = 0; tc.con_cut = consensus_cutoff; tc.qual_cut = quality_cutoff; if (type_contig_notify(args.io, args.contig, REG_TYPE_EDITOR, (reg_data *)&gen, 0) == -1) return TCL_OK; [...] xfree(tc.con);