ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
FTree Class Reference

Description:


This class is a StringTree containing FInfo elements. Usually the tree is filled using function ScanFiles .

StringTree Interface

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.

Note
As documented with function ScanFiles , entities of this module ALib Files exclusively store entries along their "Real Path", hence always resolving symbolic links. A user of this library may deviate from this "data contract".

Monotonic Behaviour

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.

Definition at line 143 of file ftree.hpp.

#include <ftree.hpp>

Inheritance diagram for FTree:
[legend]
Collaboration diagram for FTree:
[legend]

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 ()
 
MonoAllocatorGetAllocator ()
 
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
 

Friends And Related Entity Details:

◆ detail::FTreeNodeMaintainer

friend struct detail::FTreeNodeMaintainer
friend

The node maintainer is friend, as it needs access to the recyclers of this class.

Definition at line 151 of file ftree.hpp.

Type Definition Details:

◆ TTree

Type alias of this classes' base class.

Definition at line 147 of file ftree.hpp.

Field Details:

◆ recyclerEIDir

LinkedEIDir* recyclerEIDir = nullptr
protected

Linked list hook for recycling information elements of disposed nodes.

Definition at line 178 of file ftree.hpp.

◆ recyclerEISL

LinkedEISL* recyclerEISL = nullptr
protected

Linked list hook for recycling information elements of disposed nodes.

Definition at line 179 of file ftree.hpp.

◆ recyclerEISlDir

LinkedEISLDir* recyclerEISlDir = nullptr
protected

Linked list hook for recycling information elements of disposed nodes.

Definition at line 180 of file ftree.hpp.

Constructor(s) / Destructor Details::

◆ FTree()

FTree ( monomem::MonoAllocator * allocator)

Constructor.

Parameters
allocatorThe allocator to use. Passed to the constructor of base class StringTree .

Definition at line 29 of file ftree.cpp.

Here is the call graph for this function:

◆ ~FTree()

~FTree ( )
inline

Destructor.

Definition at line 193 of file ftree.hpp.

Here is the call graph for this function:

Method Details:

◆ AllocateExtendedInfo()

void AllocateExtendedInfo ( Cursor & node,
String & symLinkDest,
String & symLinkRealPath )

Allocates (or recycles) an appropriate information object fitting to the type of this entry. This method must only be applied to entries of types

Parameters
nodeThe node add extended information to.
symLinkDestIn case of symbolic link types, the symbolic link target.
symLinkRealPathIn case of symbolic link types, the symbolic link target as real path.

Definition at line 61 of file ftree.cpp.

Here is the call graph for this function:

◆ CountRecyclables()

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.

Parameters
typeMust be one of the types Types::DIRECTORY , Types::SYMBOLIC_LINK or Types::SYMBOLIC_LINK_DIR .
Returns
The number of

Definition at line 130 of file ftree.cpp.

◆ FixSums()

void FixSums ( Cursor directoryNode)
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.

Parameters
directoryNodeThe node to re-calculate the sums for.

Definition at line 42 of file ftree.cpp.

Here is the call graph for this function:

The documentation for this class was generated from the following files: