[CONNECT C++] ElementAgenda, IElementSet

ElementAgenda.BuildFromElementSet (IElementSetP elementSet, ModifyElementSource source) accepts an IElementSet.

The documentation for IElementSet reveals only ways to enumerate its contents, not ways to built the set.  How does one create an ElementSet?  IElementSet and ElementAgenda appear to serve the same purpose: what are the pros and cons of one over the other?

Parents
  • > IElementSet and ElementAgenda appear to serve the same purpose

    They don't.
    ElementAgenda gives you EditElementHandles; IElementSet gives you ElementHandles.
    IElementSet is purposely opaque (user need neither know nor care how the elements are supplied); ElementAgenda is not.
    In fact ElementAgenda's *iterator* is an implementation of IElementSet.
    You build an IElementSet by implementing the interface on some collection of element(s).

    Answer Verified By: Jon Summers 

  • Unknown said:
    Build an IElementSet by implementing the interface on some collection of element(s)

    Something like this?

    struct MyCollection : IElementSet
    {
       size_t index;
       bvector<MyClassInheritsFromElementHandle> data;
       MyCollection () : index (0) {}
       virtual bool GetFirst (ElementHandleR eh) override { index= 0; eh = data [index]; }
       virtual bool GetNext  (ElementHandleR eh) override { eh = data [++index]; }
    };

     
    Regards, Jon Summers
    LA Solutions

Reply
  • Unknown said:
    Build an IElementSet by implementing the interface on some collection of element(s)

    Something like this?

    struct MyCollection : IElementSet
    {
       size_t index;
       bvector<MyClassInheritsFromElementHandle> data;
       MyCollection () : index (0) {}
       virtual bool GetFirst (ElementHandleR eh) override { index= 0; eh = data [index]; }
       virtual bool GetNext  (ElementHandleR eh) override { eh = data [++index]; }
    };

     
    Regards, Jon Summers
    LA Solutions

Children