wxMaxima
Loading...
Searching...
No Matches
Public Member Functions
CellListBuilder< T > Class Template Reference

Manages building a list of cells, keeping the head and tail of the list. More...

#include <CellList.h>

Inheritance diagram for CellListBuilder< T >:
[legend]
Collaboration diagram for CellListBuilder< T >:
[legend]

Public Member Functions

 operator bool () const
 Returns true if the tree is non-empty.
 
 operator std::unique_ptr< T > () &&
 Passes on the ownership of the list head.
 
T * ReleaseHead ()
 Releases the ownership of the list head of the list to the caller.
 
std::unique_ptr< T > TakeHead ()
 Passes on the ownership of the list head.
 
T * GetTail () const
 Provides the last cell in the list (if any).
 
T * GetLastAppended () const
 Provides the most cell passed to the most recent Append call.
 
T * Append (T *cells)
 Appends one or more cells.
 
T * DynamicAppend (Cell *cells)
 Appends one or more cells if they are all of the correct type, otherwise deletes them.
 
T * DynamicAppend (std::unique_ptr< Cell > &&cells)
 Appends one or more cells if they are all of the correct type, otherwise deletes them.
 
T * Append (std::unique_ptr< T > &&cells)
 Appends one or more cells.
 
void ClearLastAppended ()
 Clears the pointer to the last appended cell. Useful when tree building.
 

Detailed Description

template<typename T = Cell>
class CellListBuilder< T >

Manages building a list of cells, keeping the head and tail of the list.

Member Function Documentation

◆ DynamicAppend() [1/2]

template<typename T = Cell>
T * CellListBuilder< T >::DynamicAppend ( Cell cells)
inline

Appends one or more cells if they are all of the correct type, otherwise deletes them.

Returns
the appended cells, or null if they weren't appended.
Todo:
CPPCheck warns here about returning a pointer to an already-invalid object. As far as I can see the thing is that std::unique_ptr<Cell>(cells) deletes the cells when the pointer stops to exist. Then we no more mention that pointer and CPPCheck doesn't know that base_DynamicAppend moves the pointer to a list, which means the pointer lives on even if this function exits.

◆ DynamicAppend() [2/2]

template<typename T = Cell>
T * CellListBuilder< T >::DynamicAppend ( std::unique_ptr< Cell > &&  cells)
inline

Appends one or more cells if they are all of the correct type, otherwise deletes them.

Returns
the appended cells, or null if they weren't appended.

◆ ReleaseHead()

template<typename T = Cell>
T * CellListBuilder< T >::ReleaseHead ( )
inline

Releases the ownership of the list head of the list to the caller.

Todo:
This function is deprecated. It is provided temporarily to support porting to unique_ptr-based Cell ownership. It should be removed after the porting is done.

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