@@ -103,10 +103,15 @@ package JSON is
103103
104104 function jsonGetBoolean(JSONContext : T_JSON; Path : STRING ) return BOOLEAN ;
105105 function jsonGetString(JSONContext : T_JSON; Path : STRING ) return STRING ;
106+
107+ function jsonGetBooleanArray(JSONContext : T_JSON; Path : string ) return boolean_vector ;
108+ function jsonGetBooleanArray(JSONContext : T_JSON; Path : string ; Len : positive ) return boolean_vector ;
106109 function jsonGetIntegerArray(JSONContext : T_JSON; Path : string ) return integer_vector ;
107110 function jsonGetIntegerArray(JSONContext : T_JSON; Path : string ; Len : positive ) return integer_vector ;
108- -- function jsonGetRealArray(JSONContext : T_JSON; Path : string) return real_vector;
111+ function jsonGetRealArray(JSONContext : T_JSON; Path : string ) return real_vector ;
112+ function jsonGetRealArray(JSONContext : T_JSON; Path : string ; Len : positive ) return real_vector ;
109113
114+ function jsonGetNumberArrayLength(JSONContext : T_JSON; Path : string ) return natural ;
110115 function jsonIsBoolean(JSONContext : T_JSON; Path : STRING ) return BOOLEAN ;
111116 function jsonIsNull(JSONContext : T_JSON; Path : STRING ) return BOOLEAN ;
112117 function jsonIsString(JSONContext : T_JSON; Path : STRING ) return BOOLEAN ;
@@ -1622,14 +1627,31 @@ package body JSON is
16221627 return (Element.ElementType = ELEM_TRUE);
16231628 end function ;
16241629
1625- -- function to get a integer_vector from the compressed content extracted from a JSON input
1626- function jsonGetIntegerArray (JSONContext : T_JSON; Path : string ) return integer_vector is
1630+ -- function to get a boolean_vector from the compressed content extracted from a JSON input
1631+ function jsonGetBooleanArray (JSONContext : T_JSON; Path : string ) return boolean_vector is
16271632 variable len: natural := 0 ;
16281633 begin
1629- while jsonIsNumber (JSONContext, Path & " /" & to_string(len)) loop
1634+ while jsonIsBoolean (JSONContext, Path & " /" & to_string(len)) loop
16301635 len := len+ 1 ;
16311636 end loop ;
1632- return jsonGetIntegerArray(JSONContext, Path, len);
1637+ return jsonGetBooleanArray(JSONContext, Path, len);
1638+ end ;
1639+
1640+ -- function to get a boolean_vector of a fixed length from the compressed content extracted from a JSON input
1641+ function jsonGetBooleanArray(JSONContext : T_JSON; Path : string ; Len : positive ) return boolean_vector is
1642+ variable return_value : boolean_vector (Len- 1 downto 0 );
1643+ begin
1644+ for i in 0 to Len- 1 loop
1645+ return_value(i) := boolean 'value (jsonGetString(JSONContext, Path & " /" & to_string(i)));
1646+ end loop ;
1647+ return return_value;
1648+ end function ;
1649+
1650+ -- function to get a integer_vector from the compressed content extracted from a JSON input
1651+ function jsonGetIntegerArray(JSONContext : T_JSON; Path : string ) return integer_vector is
1652+ variable len: natural := 0 ;
1653+ begin
1654+ return jsonGetIntegerArray(JSONContext, Path, jsonGetNumberArrayLength(JSONContext, Path));
16331655 end ;
16341656
16351657 -- function to get a integer_vector of a fixed length from the compressed content extracted from a JSON input
@@ -1642,6 +1664,32 @@ package body JSON is
16421664 return return_value;
16431665 end function ;
16441666
1667+ -- function to get a real_vector from the compressed content extracted from a JSON input
1668+ function jsonGetRealArray(JSONContext : T_JSON; Path : string ) return real_vector is
1669+ variable len: natural := 0 ;
1670+ begin
1671+ return jsonGetRealArray(JSONContext, Path, jsonGetNumberArrayLength(JSONContext, Path));
1672+ end ;
1673+
1674+ -- function to get a real_vector of a fixed length from the compressed content extracted from a JSON input
1675+ function jsonGetRealArray(JSONContext : T_JSON; Path : string ; Len : positive ) return real_vector is
1676+ variable return_value : real_vector (Len- 1 downto 0 );
1677+ begin
1678+ for i in 0 to Len- 1 loop
1679+ return_value(i) := real 'value (jsonGetString(JSONContext, Path & " /" & to_string(i)));
1680+ end loop ;
1681+ return return_value;
1682+ end function ;
1683+
1684+ function jsonGetNumberArrayLength(JSONContext : T_JSON; Path : string ) return natural is
1685+ variable len: natural := 0 ;
1686+ begin
1687+ while jsonIsNumber(JSONContext, Path & " /" & to_string(len)) loop
1688+ len := len+ 1 ;
1689+ end loop ;
1690+ return len;
1691+ end ;
1692+
16451693 function jsonIsBoolean(JSONContext : T_JSON; Path : STRING ) return BOOLEAN is
16461694 constant ElementIndex : T_UINT16 := jsonGetElementIndex(JSONContext, Path);
16471695 constant Element : T_JSON_INDEX_ELEMENT := JSONContext.Index (ElementIndex);
0 commit comments