From c3c32dbc07f6a8d806caab854cedd33ea80205d1 Mon Sep 17 00:00:00 2001 From: Gregg Date: Fri, 21 Jun 2024 21:36:55 -0500 Subject: [PATCH] Changed SpanServices::getLinks() to template function Allows return of Linked Services to be cast into a pointer to any Service type. Default template if not specified is --- src/HomeSpan.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/HomeSpan.h b/src/HomeSpan.h index a75423d..3ba8555 100644 --- a/src/HomeSpan.h +++ b/src/HomeSpan.h @@ -460,7 +460,13 @@ class SpanService{ SpanService *setPrimary(); // sets the Service Type to be primary and returns pointer to self SpanService *setHidden(); // sets the Service Type to be hidden and returns pointer to self SpanService *addLink(SpanService *svc); // adds svc as a Linked Service and returns pointer to self - vector> getLinks(){return(linkedServices);} // returns linkedServices vector for use as range in "for-each" loops + + template vector> getLinks(){ // returns linkedServices vector, mapped to , for use as range in "for-each" loops + vector> v; + for(auto svc : linkedServices) + v.push_back(static_cast(svc)); + return(v); + } uint32_t getIID(){return(iid);} // returns IID of Service