KiCad PCB EDA Suite
|
Class for managing static and dynamic contexts used in reading and writing compressed data. More...
#include <context_manager.h>
Public Member Functions | |
CONTEXT_MANAGER () | |
void | AddSymbol (uint32_t aContext, uint32_t aSymbol) |
Add an occurrence of the symbol to the specified context. | |
uint32_t | GetSymbolFrequency (uint32_t aContext, uint32_t aSymbol) |
Get the number of occurrences of the given symbol in the context. | |
uint32_t | GetCumulativeSymbolFrequency (uint32_t aContext, uint32_t aSymbol) |
Get the total number of occurrences for all symbols less than the given symbol in the context. | |
uint32_t | GetTotalSymbolFrequency (uint32_t aContext) |
Get the total occurrences of all the symbols in this context. | |
uint32_t | GetSymbolFromFrequency (uint32_t aContext, uint32_t symbolFrequency) |
Find the symbol in a histogram that has the specified cumulative frequency. | |
Private Attributes | |
std::vector< std::vector< std::uint32_t > > | m_symbolCount |
std::vector< std::vector< std::uint32_t > > | m_cumulativeCount |
const uint32_t | m_elephant |
Elephant determines the number of symbol occurences that are stored in each histogram. | |
const uint32_t | m_maximumSymbolInHistogram |
the maximum value that is stored in a histogram | |
const uint32_t | m_arraySizeIncr |
the ammount to increase the size of an array when reallocating an array. | |
Class for managing static and dynamic contexts used in reading and writing compressed data.
Definition at line 47 of file context_manager.h.
CONTEXT_MANAGER::CONTEXT_MANAGER | ( | ) |
Definition at line 26 of file context_manager.cpp.
References m_arraySizeIncr, m_cumulativeCount, m_elephant, m_maximumSymbolInHistogram, and m_symbolCount.
void CONTEXT_MANAGER::AddSymbol | ( | uint32_t | aContext, |
uint32_t | aSymbol ) |
Add an occurrence of the symbol to the specified context.
aContext | Add the occurrence to this context's histogram. |
aSymbol | Add an occurrence of this symbol to the histogram. |
Definition at line 36 of file context_manager.cpp.
References U3D::CONSTANTS::Context8, m_arraySizeIncr, m_cumulativeCount, m_elephant, m_maximumSymbolInHistogram, m_symbolCount, and U3D::CONSTANTS::StaticFull.
uint32_t CONTEXT_MANAGER::GetCumulativeSymbolFrequency | ( | uint32_t | aContext, |
uint32_t | aSymbol ) |
Get the total number of occurrences for all symbols less than the given symbol in the context.
aContext | Use this context's histogram. |
aSymbol | Use this symbol. |
Definition at line 110 of file context_manager.cpp.
References U3D::CONSTANTS::Context8, empty(), m_cumulativeCount, and U3D::CONSTANTS::StaticFull.
Referenced by GetSymbolFromFrequency().
uint32_t CONTEXT_MANAGER::GetSymbolFrequency | ( | uint32_t | aContext, |
uint32_t | aSymbol ) |
Get the number of occurrences of the given symbol in the context.
Definition at line 91 of file context_manager.cpp.
References U3D::CONSTANTS::Context8, empty(), m_symbolCount, and U3D::CONSTANTS::StaticFull.
uint32_t CONTEXT_MANAGER::GetSymbolFromFrequency | ( | uint32_t | aContext, |
uint32_t | symbolFrequency ) |
Find the symbol in a histogram that has the specified cumulative frequency.
aContext | Use this context's histogram. |
symbolFrequency | Use this frequency. |
Definition at line 153 of file context_manager.cpp.
References U3D::CONSTANTS::Context8, empty(), GetCumulativeSymbolFrequency(), m_cumulativeCount, and U3D::CONSTANTS::StaticFull.
uint32_t CONTEXT_MANAGER::GetTotalSymbolFrequency | ( | uint32_t | aContext | ) |
Get the total occurrences of all the symbols in this context.
aContext | Use this context's histogram. |
Definition at line 132 of file context_manager.cpp.
References U3D::CONSTANTS::Context8, empty(), m_cumulativeCount, and U3D::CONSTANTS::StaticFull.
|
private |
the ammount to increase the size of an array when reallocating an array.
Definition at line 102 of file context_manager.h.
Referenced by AddSymbol(), and CONTEXT_MANAGER().
|
private |
Definition at line 89 of file context_manager.h.
Referenced by AddSymbol(), CONTEXT_MANAGER(), GetCumulativeSymbolFrequency(), GetSymbolFromFrequency(), and GetTotalSymbolFrequency().
|
private |
Elephant determines the number of symbol occurences that are stored in each histogram.
Definition at line 94 of file context_manager.h.
Referenced by AddSymbol(), and CONTEXT_MANAGER().
|
private |
the maximum value that is stored in a histogram
Definition at line 98 of file context_manager.h.
Referenced by AddSymbol(), and CONTEXT_MANAGER().
|
private |
Definition at line 88 of file context_manager.h.
Referenced by AddSymbol(), CONTEXT_MANAGER(), and GetSymbolFrequency().