Browse Source

* Add GetMulticastObserver

Michaël Van Canneyt 1 year ago
parent
commit
094f8a7be7
2 changed files with 15 additions and 0 deletions
  1. 2 0
      rtl/objpas/classes/classesh.inc
  2. 13 0
      rtl/objpas/classes/observer.inc

+ 2 - 0
rtl/objpas/classes/classesh.inc

@@ -195,6 +195,7 @@ Type
 
   TComponent = Class;
   TStringList = Class;
+  IInterfaceList = Interface;
 
   EObserver = Class(Exception);
 
@@ -370,6 +371,7 @@ Type
     function TryIsObserving(const aID: Integer; out aIntf: IInterface): Boolean; virtual;
     function GetSingleCastObserver(const aID: Integer): IInterface; virtual;
     function GetMultiCastObserverArray(const aID: Integer) : TIInterfaceArray; virtual;
+    function GetMultiCastObserver(const aID: Integer) : IInterfaceList; virtual;
   end;
 
   { TLinkObservers }

+ 13 - 0
rtl/objpas/classes/observer.inc

@@ -138,6 +138,19 @@ begin
     raise EObserverException.CreateFmt(SerrObserverNoMulticastFound, [aID]);
 end;
 
+function TObservers.GetMultiCastObserver(const aID: Integer): IInterfaceList;
+
+Var
+  IntfArray : TIInterfaceArray;
+  Intf : IInterface;
+
+begin
+  Result:=TInterfaceList.Create;
+  IntfArray:=GetMultiCastObserverArray(aId);
+  For Intf in IntfArray do
+    Result.Add(Intf);
+end;
+
 { TObservers.TIDArray }
 
 procedure TObservers.TIDArray.Add(const aInterface: IInterface);