Re: APQ

From: Dmitry A. Kazakov (mailbox_at_dmitry-kazakov.de)
Date: 12/17/04

  • Next message: Alex R. Mosteo: "Re: Efficiently setting up large quantities of constant data"
    Date: Fri, 17 Dec 2004 15:12:42 +0100
    
    

    On Fri, 17 Dec 2004 14:45:17 +1100, Brian May wrote:

    > type Root_Connection_Type is abstract new Ada.Finalization.Limited_Controlled with private;

    If you are going to rework it, then derive it directly from an abstract
    object used for reference counting. That would save one level of
    indirection:

      type Root_Connection_Type is abstract new Object.Entity with private;

    > procedure Connect(C : in out Root_Connection_Type) is abstract;

    This is 100% legal. Probably you have conflicting views.

    > procedure Connect(C : in out Root_Connection_Type; Same_As : Root_Connection_Type'Class) is abstract;

    Are you going to clone connections between different DBs? The above looks
    like an attempt to emulate multiple dispatch.!

    It should be:

      procedure Connect
                ( C : in out Root_Connection_Type;
                   Same_As : Root_Connection_Type -- Same types required!
                ) is abstract;

    However would be is pretty useless, when you have a class-wide object at
    hand.

    I suppose that the idea was to make a copy of a limited object. Then it
    should better be:

      function Copy (C : Root_Connection_Type)
         return Root_Connection_Ptr is abstract;

    This would allocate a copy and connect it to the same DB. Because reference
    counting is intended you will need dynamic allocation anyway. The user will
    of course do it all with handles:

       function Copy (C : Handle) return Handle is
          Clone_Ptr : Root_Connection_Type_Ptr := Copy (Ptr (C).all);
             -- This clones the object pointed by the handle, the reference
             -- count of the copy is initially 0
       begin
          return Ref (Clone_Ptr);
             -- Result is a handle, and the reference count is 1, now
       end Copy;

    -- 
    Regards,
    Dmitry A. Kazakov
    http://www.dmitry-kazakov.de
    

  • Next message: Alex R. Mosteo: "Re: Efficiently setting up large quantities of constant data"