Reply To: Added function "GetBinName" to CovPType
Why OSVVM™? › Forums › OSVVM › Added function "GetBinName" to CovPType › Reply To: Added function "GetBinName" to CovPType

Hi Sebastian,
I can add that capability in the next release.
I note that in your code, you never deallocate buf and as a result have a memory leak. You can fix this by simplifying your code to:
impure function GetBinName ( BinIndex : integer ) return string is
begin
if CovBinPtr(BinIndex).Name.all /= "" then
return CovBinPtr(BinIndex).Name.all) ;
else
return "Nameless Bin" ;
end if;
end function GetBinName;
To be consistent with other OSVVM implementations, I will implement something like the following:
impure function GetBinName ( BinIndex : integer; DefaultName : string := "" ) return string is
begin
if CovBinPtr(BinIndex).Name.all /= "" then
return CovBinPtr(BinIndex).Name.all) ;
else
return DefaultName ;
end if;
end function GetBinName;
Cheers,
Jim