This class is a StringTree containing FInfo elements. Usually the tree is filled using function ScanFiles .
Public base class monomem::StringTree provides all interfaces necessary to create and delete entries, iterate and recursively walk the file tree. Please consult its documentation for further information.
The class fulfills weak monotonic allocation requirements, which is achieved by recycling not only the nodes (what base type StringTree does by default) but also any extended node information. This is implemented with maintainer type detail::FTreeNodeMaintainer on the one hand, and on the other hand with the implementation of method AllocateExtendedInfo, which has to be exclusively used to attach information structs on FInfo elements.
In respect to the file names, hence the key types of base class StringTree, class detail::FTreeNodeMaintainer uses an internal buffer of size 100
. This leads to quite some monotonic allocation overhead when file names are short, but limits the percentage of exceeding file names quite well. Exceeding filenames have not been further optimized, but are simply allocated on the heap (and of-course free with the deletion of an entry).
In summary, this allows an indefinite sequence of file-scan and result filtering (deletions) with using more memory than the highest resulting fill state in such sequence requires.
#include <ftree.hpp>
Inner Type Index: | |
struct | LinkedEIDir |
struct | LinkedEISL |
struct | LinkedEISLDir |
Public Type Index: | |
using | TTree = StringTree<FInfo, detail::FTreeNodeMaintainer> |
Public Type Index: inherited from StringTree< T, TNodeMaintainer, TRecycling > | |
using | CharacterType = typename TNodeMaintainer::CharacterType |
using | ConstCursor = TCursor<true> |
using | ConstRecursiveIterator = TRecursiveIterator<true> |
using | Cursor = TCursor<false> |
using | NameType = typename strings::TString<CharacterType> |
using | RecursiveIterator = TRecursiveIterator<false> |
using | SubstringType = typename strings::TSubstring<CharacterType> |
using | TSharedRecycler = typename basetree::TSharedRecycler |
Public Static Method Index: | |
static ALIB_API void | FixSums (Cursor directoryNode) |
Public Method Index: | |
ALIB_API | FTree (monomem::MonoAllocator *allocator) |
~FTree () | |
ALIB_API void | AllocateExtendedInfo (Cursor &node, String &symLinkDest, String &symLinkRealPath) |
ALIB_API integer | CountRecyclables (FInfo::Types type) |
Public Method Index: inherited from StringTree< T, TNodeMaintainer, TRecycling > | |
StringTree (MonoAllocator *allocator, CharacterType pathSeparator) | |
StringTree (MonoAllocator *allocator, CharacterType pathSeparator, TSharedRecycler &pRecycler) | |
~StringTree () | |
void | Clear () |
template<typename... TArgs> | |
void | ConstructRootValue (TArgs &&... args) |
void | DeleteRootValue () |
MonoAllocator * | GetAllocator () |
bool | IsEmpty () const |
auto & | NodeTable () |
const auto & | NodeTable () const |
integer | RecyclablesCount () const |
void | ReserveRecyclables (integer expected, lang::ValueReference reference) |
void | Reset () |
Cursor | Root () |
const ConstCursor | Root () const |
void | SetAllocatorPostConstruction (MonoAllocator *pAllocator) |
integer | Size () const |
|
friend |
using TTree = StringTree<FInfo, detail::FTreeNodeMaintainer> |
|
protected |
|
protected |
|
protected |
FTree | ( | monomem::MonoAllocator * | allocator | ) |
Constructor.
allocator | The allocator to use. Passed to the constructor of base class StringTree . |
Definition at line 29 of file ftree.cpp.
|
inline |
Allocates (or recycles) an appropriate information object fitting to the type of this entry. This method must only be applied to entries of types
node | The node add extended information to. |
symLinkDest | In case of symbolic link types, the symbolic link target. |
symLinkRealPath | In case of symbolic link types, the symbolic link target as real path. |
Definition at line 61 of file ftree.cpp.
integer CountRecyclables | ( | FInfo::Types | type | ) |
Returns the number of currently available recycled objects of derived type of ExtendedEntryInfo . This method is rather for testing or debugging.
type | Must be one of the types Types::DIRECTORY , Types::SYMBOLIC_LINK or Types::SYMBOLIC_LINK_DIR . |
|
static |
Recalculates the sums of the given node. This is not done recursively. The fix is needed when scanning an existent directory with potentially more greedy scan parameters.
directoryNode | The node to re-calculate the sums for. |
Definition at line 42 of file ftree.cpp.