timemory 3.3.0
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
tim::graph< T, AllocatorT >::sibling_iterator Class Reference

Iterator which traverses only the nodes which are siblings of each other. More...

#include "timemory/storage/graph.hpp"

+ Collaboration diagram for tim::graph< T, AllocatorT >::sibling_iterator:

Public Types

typedef T value_type
 
typedef T * pointer
 
typedef T & reference
 
typedef size_t size_type
 
typedef ptrdiff_t difference_type
 
typedef std::bidirectional_iterator_tag iterator_category
 

Public Member Functions

 sibling_iterator ()
 
 sibling_iterator (graph_node *)
 
 sibling_iterator (const iterator_base &)
 
 sibling_iterator (const sibling_iterator &)=default
 
 sibling_iterator (sibling_iterator &&) noexcept=default
 
sibling_iteratoroperator= (const sibling_iterator &)=default
 
sibling_iteratoroperator= (sibling_iterator &&) noexcept=default
 
bool operator== (const sibling_iterator &) const
 
bool operator!= (const sibling_iterator &) const
 
sibling_iteratoroperator++ ()
 
sibling_iteratoroperator-- ()
 
sibling_iterator operator++ (int)
 
sibling_iterator operator-- (int)
 
sibling_iteratoroperator+= (unsigned int)
 
sibling_iteratoroperator-= (unsigned int)
 
sibling_iterator operator+ (unsigned int)
 
graph_noderange_first () const
 
graph_noderange_last () const
 
 operator bool () const
 
T & operator* () const
 
T * operator-> () const
 
void skip_children ()
 When called, the next increment/decrement skips children of this node. More...
 
void skip_children (bool skip)
 
unsigned int number_of_children () const
 Number of children of the node pointed to by the iterator. More...
 
sibling_iterator begin () const
 
sibling_iterator end () const
 

Public Attributes

graph_nodem_parent
 
graph_nodenode = nullptr
 

Protected Attributes

bool m_skip_current_children = false
 

Detailed Description

template<typename T, typename AllocatorT>
class tim::graph< T, AllocatorT >::sibling_iterator

Iterator which traverses only the nodes which are siblings of each other.

Definition at line 224 of file graph.hpp.

Member Typedef Documentation

◆ difference_type

template<typename T , typename AllocatorT >
typedef ptrdiff_t tim::graph< T, AllocatorT >::iterator_base::difference_type
inherited

Definition at line 145 of file graph.hpp.

◆ iterator_category

template<typename T , typename AllocatorT >
typedef std::bidirectional_iterator_tag tim::graph< T, AllocatorT >::iterator_base::iterator_category
inherited

Definition at line 146 of file graph.hpp.

◆ pointer

template<typename T , typename AllocatorT >
typedef T* tim::graph< T, AllocatorT >::iterator_base::pointer
inherited

Definition at line 142 of file graph.hpp.

◆ reference

template<typename T , typename AllocatorT >
typedef T& tim::graph< T, AllocatorT >::iterator_base::reference
inherited

Definition at line 143 of file graph.hpp.

◆ size_type

template<typename T , typename AllocatorT >
typedef size_t tim::graph< T, AllocatorT >::iterator_base::size_type
inherited

Definition at line 144 of file graph.hpp.

◆ value_type

template<typename T , typename AllocatorT >
typedef T tim::graph< T, AllocatorT >::iterator_base::value_type
inherited

Definition at line 141 of file graph.hpp.

Constructor & Destructor Documentation

◆ sibling_iterator() [1/5]

template<typename T , typename AllocatorT >
tim::graph< T, AllocatorT >::sibling_iterator::sibling_iterator

Definition at line 2724 of file graph.hpp.

2725: iterator_base()
2726{
2727 m_set_parent();
2728}

◆ sibling_iterator() [2/5]

template<typename T , typename AllocatorT >
tim::graph< T, AllocatorT >::sibling_iterator::sibling_iterator ( graph_node tn)

Definition at line 2733 of file graph.hpp.

2734: iterator_base(tn)
2735{
2736 m_set_parent();
2737}

◆ sibling_iterator() [3/5]

template<typename T , typename AllocatorT >
tim::graph< T, AllocatorT >::sibling_iterator::sibling_iterator ( const iterator_base other)

Definition at line 2742 of file graph.hpp.

2743: iterator_base(other.node)
2744{
2745 m_set_parent();
2746}

◆ sibling_iterator() [4/5]

template<typename T , typename AllocatorT >
tim::graph< T, AllocatorT >::sibling_iterator::sibling_iterator ( const sibling_iterator )
default

◆ sibling_iterator() [5/5]

template<typename T , typename AllocatorT >
tim::graph< T, AllocatorT >::sibling_iterator::sibling_iterator ( sibling_iterator &&  )
defaultnoexcept

Member Function Documentation

◆ begin()

template<typename T , typename AllocatorT >
graph< T, AllocatorT >::sibling_iterator tim::graph< T, AllocatorT >::iterator_base::begin
inherited

Definition at line 2507 of file graph.hpp.

2508{
2509 if(node->first_child == nullptr)
2510 return end();
2511
2512 sibling_iterator ret(node->first_child);
2513 ret.m_parent = this->node;
2514 return ret;
2515}
sibling_iterator end() const
Definition: graph.hpp:2521
tgraph_node< T > * first_child
Definition: graph.hpp:79

References tim::graph< T, AllocatorT >::end(), and tim::graph< T, AllocatorT >::sibling_iterator::m_parent.

Referenced by tim::graph< T, AllocatorT >::graph(), tim::graph< T, AllocatorT >::empty(), tim::graph< T, AllocatorT >::equal_subgraph(), tim::graph< T, AllocatorT >::merge(), and tim::graph< T, AllocatorT >::serialize().

◆ end()

template<typename T , typename AllocatorT >
graph< T, AllocatorT >::sibling_iterator tim::graph< T, AllocatorT >::iterator_base::end
inherited

◆ number_of_children()

template<typename T , typename AllocatorT >
unsigned int tim::graph< T, AllocatorT >::iterator_base::number_of_children
inherited

Number of children of the node pointed to by the iterator.

Definition at line 2550 of file graph.hpp.

2551{
2553 if(pos == nullptr)
2554 return 0;
2555
2556 unsigned int ret = 1;
2557 while(pos != node->last_child)
2558 {
2559 ++ret;
2560 pos = pos->next_sibling;
2561 }
2562 return ret;
2563}
tgraph_node< T > graph_node
Definition: graph.hpp:117
tgraph_node< T > * last_child
Definition: graph.hpp:80
size_t pos
Definition: config.cpp:102

References tim::pos.

Referenced by tim::graph< T, AllocatorT >::equal(), and tim::graph< T, AllocatorT >::equal_subgraph().

◆ operator bool()

template<typename T , typename AllocatorT >
tim::graph< T, AllocatorT >::iterator_base::operator bool ( ) const
inlineinherited

Definition at line 159 of file graph.hpp.

159{ return node != nullptr; }

◆ operator!=()

template<typename T , typename AllocatorT >
bool tim::graph< T, AllocatorT >::sibling_iterator::operator!= ( const sibling_iterator other) const

Definition at line 2477 of file graph.hpp.

2478{
2479 if(other.node != this->node)
2480 {
2481 return true;
2482 }
2483 {
2484 return false;
2485 }
2486}

References tim::graph< T, AllocatorT >::iterator_base::node.

◆ operator*()

template<typename T , typename AllocatorT >
T & tim::graph< T, AllocatorT >::iterator_base::operator*
inherited

Definition at line 2428 of file graph.hpp.

2429{
2430 return node->data;
2431}

◆ operator+()

template<typename T , typename AllocatorT >
graph< T, AllocatorT >::sibling_iterator tim::graph< T, AllocatorT >::sibling_iterator::operator+ ( unsigned int  num)

Definition at line 2844 of file graph.hpp.

2845{
2846 auto itr = *this;
2847 while(num > 0)
2848 {
2849 ++itr;
2850 --num;
2851 }
2852 return itr;
2853}

◆ operator++() [1/2]

template<typename T , typename AllocatorT >
graph< T, AllocatorT >::sibling_iterator & tim::graph< T, AllocatorT >::sibling_iterator::operator++

Definition at line 2765 of file graph.hpp.

2766{
2767 if(this->node)
2768 this->node = this->node->next_sibling;
2769 return *this;
2770}
tgraph_node< T > * next_sibling
Definition: graph.hpp:82

◆ operator++() [2/2]

template<typename T , typename AllocatorT >
graph< T, AllocatorT >::sibling_iterator tim::graph< T, AllocatorT >::sibling_iterator::operator++ ( int  )

Definition at line 2794 of file graph.hpp.

2795{
2796 sibling_iterator copy = *this;
2797 ++(*this);
2798 return copy;
2799}

◆ operator+=()

template<typename T , typename AllocatorT >
graph< T, AllocatorT >::sibling_iterator & tim::graph< T, AllocatorT >::sibling_iterator::operator+= ( unsigned int  num)

Definition at line 2816 of file graph.hpp.

2817{
2818 while(num > 0)
2819 {
2820 ++(*this);
2821 --num;
2822 }
2823 return (*this);
2824}

◆ operator--() [1/2]

template<typename T , typename AllocatorT >
graph< T, AllocatorT >::sibling_iterator & tim::graph< T, AllocatorT >::sibling_iterator::operator--

Definition at line 2776 of file graph.hpp.

2777{
2778 if(this->node)
2779 {
2780 this->node = this->node->prev_sibling;
2781 }
2782 else
2783 {
2784 assert(m_parent);
2785 this->node = m_parent->last_child;
2786 }
2787 return *this;
2788}
tgraph_node< T > * prev_sibling
Definition: graph.hpp:81

◆ operator--() [2/2]

template<typename T , typename AllocatorT >
graph< T, AllocatorT >::sibling_iterator tim::graph< T, AllocatorT >::sibling_iterator::operator-- ( int  )

Definition at line 2805 of file graph.hpp.

2806{
2807 sibling_iterator copy = *this;
2808 --(*this);
2809 return copy;
2810}

◆ operator-=()

template<typename T , typename AllocatorT >
graph< T, AllocatorT >::sibling_iterator & tim::graph< T, AllocatorT >::sibling_iterator::operator-= ( unsigned int  num)

Definition at line 2830 of file graph.hpp.

2831{
2832 while(num > 0)
2833 {
2834 --(*this);
2835 --num;
2836 }
2837 return (*this);
2838}

◆ operator->()

template<typename T , typename AllocatorT >
T * tim::graph< T, AllocatorT >::iterator_base::operator->
inherited

Definition at line 2436 of file graph.hpp.

2437{
2438 return &(node->data);
2439}

◆ operator=() [1/2]

template<typename T , typename AllocatorT >
sibling_iterator & tim::graph< T, AllocatorT >::sibling_iterator::operator= ( const sibling_iterator )
default

◆ operator=() [2/2]

template<typename T , typename AllocatorT >
sibling_iterator & tim::graph< T, AllocatorT >::sibling_iterator::operator= ( sibling_iterator &&  )
defaultnoexcept

◆ operator==()

template<typename T , typename AllocatorT >
bool tim::graph< T, AllocatorT >::sibling_iterator::operator== ( const sibling_iterator other) const

Definition at line 2492 of file graph.hpp.

2493{
2494 if(other.node == this->node)
2495 {
2496 return true;
2497 }
2498 {
2499 return false;
2500 }
2501}

References tim::graph< T, AllocatorT >::iterator_base::node.

◆ range_first()

template<typename T , typename AllocatorT >
graph_node * tim::graph< T, AllocatorT >::sibling_iterator::range_first ( ) const

◆ range_last()

template<typename T , typename AllocatorT >
graph< T, AllocatorT >::graph_node * tim::graph< T, AllocatorT >::sibling_iterator::range_last

Definition at line 2859 of file graph.hpp.

2860{
2861 return (m_parent) ? m_parent->last_child : nullptr;
2862}

References tim::tgraph_node< T >::last_child.

Referenced by tim::graph< T, AllocatorT >::pre_order_iterator::pre_order_iterator().

◆ skip_children() [1/2]

template<typename T , typename AllocatorT >
void tim::graph< T, AllocatorT >::iterator_base::skip_children
inherited

When called, the next increment/decrement skips children of this node.

Definition at line 2532 of file graph.hpp.

2533{
2535}

Referenced by tim::graph< T, AllocatorT >::pre_order_iterator::pre_order_iterator().

◆ skip_children() [2/2]

template<typename T , typename AllocatorT >
void tim::graph< T, AllocatorT >::iterator_base::skip_children ( bool  skip)
inherited

Definition at line 2541 of file graph.hpp.

2542{
2544}

Member Data Documentation

◆ m_parent

◆ m_skip_current_children

template<typename T , typename AllocatorT >
bool tim::graph< T, AllocatorT >::iterator_base::m_skip_current_children = false
protectedinherited

Definition at line 182 of file graph.hpp.

◆ node


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