sc_event_and/or_list

From: <john.aynsley@doulos.com>
Date: Thu Oct 07 2010 - 01:57:34 PDT

(This message seems to have got lost first-time-around)

Philipp, All,

Using Philipp's prototype we can do some cool stuff with event lists, for
example:

  sc_event_or_list all_events() const
  {
    sc_event_or_list or_list;
    for (int i = 0; i < p.size(); i++)
      or_list = or_list | p[i]->default_event();
    return or_list;
  }
  ...
  wait( all_events() );
  ...
  sc_event_and_list list1 = e1 & e2;
  wait( list1 );
 
  sc_event_and_list list2;
  list2 & e1;
  list2 & e2;
  wait( list2);
 
  sc_event_and_list list3 = list2 & e2; // Caveat - modifies list2
  wait( list3 );

  sc_event_and_list list4;
  list4 = list3 & e2; // Caveat - modifies list3
  wait( list4 );

 
However, because the ctor sc_event_and_list(const sc_event&) is protected,
we cannot do

  sc_event_and_list list5 = e3;
 
I think it would be nice to be able to initialize a list with a single
event, so I propose we make this ctor public (but without putting the
auto_delete argument in the LRM)

Also, we cannot do

  sc_event_and_list list6 = list3 & list4;
 
because we have no sc_event_and_list& operator & ( const
sc_event_and_list& );
I propose we add this operator

Finally, note that

  list2 = list2 & e1;
 
is equivalent to

  list2 & e1;
 
the latter being permitted because operator& works through a side-effect.
Would this be a reason for introducing a separate class for
user-instantiated event lists?

Opinions?

Thanks,

John A

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Oct 7 01:57:57 2010

This archive was generated by hypermail 2.1.8 : Thu Oct 07 2010 - 01:57:59 PDT