@@ -105,10 +105,15 @@ package JSON is
105105
106106 function jsonGetBoolean(JSONContext : T_JSON; Path : STRING ) return BOOLEAN ;
107107 function jsonGetString(JSONContext : T_JSON; Path : STRING ) return STRING ;
108+
109+ function jsonGetBooleanArray(JSONContext : T_JSON; Path : string ) return boolean_vector ;
110+ function jsonGetBooleanArray(JSONContext : T_JSON; Path : string ; Len : positive ) return boolean_vector ;
108111 function jsonGetIntegerArray(JSONContext : T_JSON; Path : string ) return integer_vector ;
109112 function jsonGetIntegerArray(JSONContext : T_JSON; Path : string ; Len : positive ) return integer_vector ;
110- -- function jsonGetRealArray(JSONContext : T_JSON; Path : string) return real_vector;
113+ function jsonGetRealArray(JSONContext : T_JSON; Path : string ) return real_vector ;
114+ function jsonGetRealArray(JSONContext : T_JSON; Path : string ; Len : positive ) return real_vector ;
111115
116+ function jsonGetNumberArrayLength(JSONContext : T_JSON; Path : string ) return natural ;
112117 function jsonIsBoolean(JSONContext : T_JSON; Path : STRING ) return BOOLEAN ;
113118 function jsonIsNull(JSONContext : T_JSON; Path : STRING ) return BOOLEAN ;
114119 function jsonIsString(JSONContext : T_JSON; Path : STRING ) return BOOLEAN ;
@@ -1639,14 +1644,31 @@ package body JSON is
16391644 return (Element.ElementType = ELEM_TRUE);
16401645 end function ;
16411646
1642- -- function to get a integer_vector from the compressed content extracted from a JSON input
1643- function jsonGetIntegerArray (JSONContext : T_JSON; Path : string ) return integer_vector is
1644- variable len: natural := 0 ;
1647+ -- function to get a boolean_vector from the compressed content extracted from a JSON input
1648+ function jsonGetBooleanArray (JSONContext : T_JSON; Path : string ) return boolean_vector is
1649+ variable len: natural := 0 ;
16451650 begin
1646- while jsonIsNumber (JSONContext, Path & " /" & to_string(len)) loop
1651+ while jsonIsBoolean (JSONContext, Path & " /" & to_string(len)) loop
16471652 len := len+ 1 ;
16481653 end loop ;
1649- return jsonGetIntegerArray(JSONContext, Path, len);
1654+ return jsonGetBooleanArray(JSONContext, Path, len);
1655+ end function ;
1656+
1657+ -- function to get a boolean_vector of a fixed length from the compressed content extracted from a JSON input
1658+ function jsonGetBooleanArray(JSONContext : T_JSON; Path : string ; Len : positive ) return boolean_vector is
1659+ variable return_value : boolean_vector (Len- 1 downto 0 );
1660+ begin
1661+ for i in 0 to Len- 1 loop
1662+ return_value(i) := boolean 'value (jsonGetString(JSONContext, Path & " /" & to_string(i)));
1663+ end loop ;
1664+ return return_value;
1665+ end function ;
1666+
1667+ -- function to get a integer_vector from the compressed content extracted from a JSON input
1668+ function jsonGetIntegerArray(JSONContext : T_JSON; Path : string ) return integer_vector is
1669+ variable len: natural := 0 ;
1670+ begin
1671+ return jsonGetIntegerArray(JSONContext, Path, jsonGetNumberArrayLength(JSONContext, Path));
16501672 end function ;
16511673
16521674 -- function to get a integer_vector of a fixed length from the compressed content extracted from a JSON input
@@ -1659,6 +1681,32 @@ package body JSON is
16591681 return return_value;
16601682 end function ;
16611683
1684+ -- function to get a real_vector from the compressed content extracted from a JSON input
1685+ function jsonGetRealArray(JSONContext : T_JSON; Path : string ) return real_vector is
1686+ variable len: natural := 0 ;
1687+ begin
1688+ return jsonGetRealArray(JSONContext, Path, jsonGetNumberArrayLength(JSONContext, Path));
1689+ end function ;
1690+
1691+ -- function to get a real_vector of a fixed length from the compressed content extracted from a JSON input
1692+ function jsonGetRealArray(JSONContext : T_JSON; Path : string ; Len : positive ) return real_vector is
1693+ variable return_value : real_vector (Len- 1 downto 0 );
1694+ begin
1695+ for i in 0 to Len- 1 loop
1696+ return_value(i) := real 'value (jsonGetString(JSONContext, Path & " /" & to_string(i)));
1697+ end loop ;
1698+ return return_value;
1699+ end function ;
1700+
1701+ function jsonGetNumberArrayLength(JSONContext : T_JSON; Path : string ) return natural is
1702+ variable len: natural := 0 ;
1703+ begin
1704+ while jsonIsNumber(JSONContext, Path & " /" & to_string(len)) loop
1705+ len := len+ 1 ;
1706+ end loop ;
1707+ return len;
1708+ end function ;
1709+
16621710 function jsonIsBoolean(JSONContext : T_JSON; Path : STRING ) return BOOLEAN is
16631711 constant ElementIndex : T_UINT16 := jsonGetElementIndex(JSONContext, Path);
16641712 constant Element : T_JSON_INDEX_ELEMENT := JSONContext.Index (ElementIndex);
0 commit comments