concurrency - Synchronous_Fifo of Objects in Ada -


i created record in ada , later created synchronous_fifo out of these records:

type basic_record record   argument_1: integer;   operator: character;   argument_2: integer;   product: integer; end record;  package tasks_fifo new synchronous_fifo(basic_record); use tasks_fifo; buffer : fifo; 

and working fine. later wanted same synchronous_fifo out of objects:

package adding_machine   protected type add_machine      entry store_record(task_record: basic_record);      entry push_button;      entry get_product(product: out integer);   private      my_record : basic_record;      my_product: integer;   end add_machine; end adding_machine;  use adding_machine;  package object_fifo new synchronous_fifo(add_machine); use object_fifo; buffer: fifo; 

and result got several errors:

multiple markers @ line - occurrence of package - actual non-limited "element_type" cannot limited type - instantiation abandoned 

in line, creating object_fifo.

how should create fifo? or maybe there wrong package adding_machine?

below shown package synchronous_fifo:

generic      type element_type private; package synchronous_fifo   protected type fifo     entry push(item : element_type);     entry pop(item : out element_type);   private     value : element_type;     is_new : boolean := false;   end fifo; end synchronous_fifo;  package body synchronous_fifo   ----------  -- fifo --  ----------   protected body fifo    ---------   -- push --   ---------    entry push (item : element_type) when not is_new   begin      value := item;      is_new := true;   end push;    ---------   -- pop --   ---------    entry pop (item : out element_type) when is_new   begin      item := value;      is_new := false;   end pop;   end fifo;  end synchronous_fifo; 

i created access adding_machine , later created fifo out of these accesses.

type adding_machine_access access adding_machine;  package adding_machines_fifo new synchronous_fifo(adding_machine_access); use tasks_fifo; adding_machines_fifo : fifo; 

it should work.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -