Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CVS update:


  • To: pooma-cvs@xxxxxxxxxxxxxxxxxxxxxx
  • Subject: CVS update:
  • From: crotinger@xxxxxxxxxxxxxxxxxxxxxxx
  • Date: 12 Apr 2001 16:07:52 -0000

Date:	Thursday April 12, 2001 @ 10:07
Author:	crotinger

Update of /home/pooma/Repository/r2/src/DynamicArray
In directory merlin.codesourcery.com:/tmp/cvs-serv18775

Modified Files:
	DynamicArray.h 
Log Message:
Added destroy methods that take a pair of iterators instead of a domain. 
There are some restrictions:

  o The destroy operations that take a patch ID only work with
    iterators that can be assigned to "const int *" iterators. The
    reason for this is that, for MultiPatch engines, the array
    delegates the destroy to the engine, which then delegates to the
    underlying layout, which then notifies all of its observers that
    they must delete the specific set of elements.  (These observers
    are the MultiPatch engines that share the same layout.  These, in
    turn, invoke the destroy operation on their individual patches.)
    This notification is via a virtual function call.  Thus notify is
    not templated, and so the various event types must be
    enumerated. I've chosen to implement "const int*" since the
    iterators must be random access (required by the underlying
    destroy algorithms) and they always enumerate sets of ints.

    I have written the code so that it is templated on an iterator
    type and then it initializes an IteratorPairDomain<const int*>
    with these iterators, which requires that one can initialize a
    "const int*" with the iterator. 

    I'm not completely happy with this implementation. I suspect that
    the most common iterator that people will attempt to use is
    vector::iterator. This will work most of the time, but it is not
    illegal to implement vector::iterator as a class, in which case
    it may not be possible to assign it to "const int *", and then
    the code will not compile. The "obvious" thing to do is to also
    supply specializations for vector<int>::const_iterator.
    Unfortunately, when vector's const_iterator is a typedef to const
    int *, this causes a compile error. Arrgh! Is there a clean way to
    write portable code that is guaranteed to work with both vector's
    const_iterator and const int *???

    Also, note that this will not work directly with
    RefCountedBlockPtr.  One would probably get such a block pointer
    from an Array, but if you have an Array you can just pass it as a
    domain and I believe an IndirectionList will automatically be
    constructed. If not, you can construct it yourself since and Array
    is a valid initializer for an IndirectionList. 

  o Global destroy ops are unrestricted. These currently make copies
    of the local subdomains of the killList in an IndirectionList and
    then invoke the destroy with an IndirectionList. This seems
    inefficient - one ought to be able to use traits to determine
    the correct type of subdomain and use domain operations to get
    the intersections with the local patches. But this may cause a 
    proliferation of event types (more on this below). (A corallary to
    this is that global destroy ops don't even require a random-access
    iterator since the domain is copied and not actually used in the
    underlying algorithm, but that could change in the future.)

  o Operations on DynamicArray with a DynamicEngine are similarly
    unrestricted. These are forwarded directly to the DynamicEngine,
    which does not have a shared layout, and thus there is no virtual
    function call and the iterators are passed directly through to the
    underlying destroy operation.