A logging variable
| 104 | |
| 105 | |
| 106 | class LogVariable(): |
| 107 | """A logging variable""" |
| 108 | |
| 109 | TOC_TYPE = 0 |
| 110 | MEM_TYPE = 1 |
| 111 | |
| 112 | def __init__(self, name='', fetchAs='uint8_t', varType=TOC_TYPE, |
| 113 | storedAs='', address=0): |
| 114 | self.name = name |
| 115 | self.fetch_as = LogTocElement.get_id_from_cstring(fetchAs) |
| 116 | if (len(storedAs) == 0): |
| 117 | self.stored_as = self.fetch_as |
| 118 | else: |
| 119 | self.stored_as = LogTocElement.get_id_from_cstring(storedAs) |
| 120 | self.address = address |
| 121 | self.type = varType |
| 122 | self.stored_as_string = storedAs |
| 123 | self.fetch_as_string = fetchAs |
| 124 | |
| 125 | def is_toc_variable(self): |
| 126 | """ |
| 127 | Return true if the variable should be in the TOC, false if raw memory |
| 128 | variable |
| 129 | """ |
| 130 | return self.type == LogVariable.TOC_TYPE |
| 131 | |
| 132 | def get_storage_and_fetch_byte(self): |
| 133 | """Return what the variable is stored as and fetched as""" |
| 134 | return (self.fetch_as | (self.stored_as << 4)) |
| 135 | |
| 136 | def __str__(self): |
| 137 | return ('LogVariable: name=%s, store=%s, fetch=%s' % |
| 138 | (self.name, LogTocElement.get_cstring_from_id(self.stored_as), |
| 139 | LogTocElement.get_cstring_from_id(self.fetch_as))) |
| 140 | |
| 141 | |
| 142 | class LogConfig(object): |
no outgoing calls
no test coverage detected