data
Data management.
A data is a piece of information that isn't code.
Data
Base class for data.
All data have at least a type and a value. They are referenced inside the program by and to other data and code.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
proto_index |
Index
|
Index in the protobuf |
required |
data |
'quokka.pb.Quokka.Data'
|
Protobuf value of the data. |
required |
program |
Program
|
Program backref |
required |
Attributes:
Name | Type | Description |
---|---|---|
proto_index |
Index
|
Index in the protobuf |
address |
AddressT
|
Data address |
type |
'DataType'
|
Data type |
program |
Program
|
Reference to the Program |
is_initialized |
bool
|
Is the data initialized? |
size |
Optional[int]
|
Data size (depends on the type usually) |
name |
Optional[str]
|
Data name (if any) |
Source code in quokka/data.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
code_references: List[quokka.Reference]
property
Returns code referencing this Data
data_references: List[quokka.Reference]
property
Returns data references to/from this Data
references: List[quokka.Reference]
property
References to/from this data
value: Any
property
Data value.
The value is read in the program binary file.
__eq__(other)
Check equality between two Data instances
Source code in quokka/data.py
84 85 86 |
|
__init__(proto_index, data, program)
Constructor
Source code in quokka/data.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|
DataHolder
Bases: Mapping
Data bucket
All the data of the program are referenced in this bucket and allow to store them only once.
Attributes:
Name | Type | Description |
---|---|---|
proto_data |
The protobuf data themselves |
|
program |
Program
|
A reference to the Program |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
proto |
The protobuf data |
required | |
program |
Program
|
The program |
required |
TODO
Type hinting for proto parameter (RepeatedCompositeFieldContainer)
Source code in quokka/data.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
|
__delitem__(value)
Remove a data from the bucket
Source code in quokka/data.py
168 169 170 |
|
__getitem__(key)
Get a data from the bucket.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
Index
|
Data Index |
required |
Returns:
Type | Description |
---|---|
Data
|
A Data |
Source code in quokka/data.py
172 173 174 175 176 177 178 179 180 181 |
|
__init__(proto, program)
Init method
Parameters:
Name | Type | Description | Default |
---|---|---|---|
proto |
List of data in the protobuf |
required | |
program |
Program
|
Backref to the program |
required |
Source code in quokka/data.py
154 155 156 157 158 159 160 161 162 |
|
__iter__()
Do not allow the iteration over the data
Source code in quokka/data.py
209 210 211 |
|
__len__()
Number of data in the program
Source code in quokka/data.py
205 206 207 |
|
__setitem__(key, value)
Set a data
Source code in quokka/data.py
164 165 166 |
|
get_data(address)
Find a data by address
Iterates over the data to find the one at a specified offset
Parameters:
Name | Type | Description | Default |
---|---|---|---|
address |
AddressT
|
Offset to query |
required |
Returns:
Type | Description |
---|---|
Data
|
A Data |
Raises:
Type | Description |
---|---|
ValueError
|
if no data is found |
Source code in quokka/data.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
|