aGrUM  0.14.2
gum::Link< T > Class Template Reference

Link of a chain list allocated using the SmallObjectAllocator. More...

#include <agrum/multidim/FunctionGraphUtilities/link.h>

Public Member Functions

Constructors and Destructors
 Link (const T &elem)
 Constructor. More...
 
 Link (const T &elem, Link< T > *nextLink)
 Constructor that insert link before the given link. More...
 
 ~Link ()
 Destructor. More...
 
void * operator new (size_t s)
 Operator new overload to use the SmallObjectAllocator. More...
 
void operator delete (void *p)
 Operator delete overload to use the SmallObjectAllocator. More...
 
Getters and setters
const T & element () const
 Returns the element stored in this link. More...
 
T & element ()
 Returns the element stored in this link. More...
 
const Link< T > * nextLink () const
 Returns next link. More...
 
Link< T > * nextLink ()
 Returns next link. More...
 
void setNextLink (Link< T > *newLink)
 Sets the next link. More...
 

Detailed Description

template<typename T>
class gum::Link< T >

Link of a chain list allocated using the SmallObjectAllocator.

Template Parameters
TThe type stored by the chain list.

Definition at line 48 of file link.h.

Constructor & Destructor Documentation

◆ Link() [1/2]

template<typename T>
INLINE gum::Link< T >::Link ( const T &  elem)
explicit

Constructor.

Definition at line 35 of file link_tpl.h.

35  : __element(elem) {
36  GUM_CONSTRUCTOR(Link);
37  }

◆ Link() [2/2]

template<typename T>
INLINE gum::Link< T >::Link ( const T &  elem,
Link< T > *  nextLink 
)

Constructor that insert link before the given link.

Definition at line 41 of file link_tpl.h.

41  :
42  __element(elem), __nextLink(nextLink) {
43  GUM_CONSTRUCTOR(Link);
44  }

◆ ~Link()

template<typename T >
INLINE gum::Link< T >::~Link ( )

Destructor.

Definition at line 48 of file link_tpl.h.

48  {
49  GUM_DESTRUCTOR(Link);
50  }

Member Function Documentation

◆ element() [1/2]

◆ element() [2/2]

template<typename T >
INLINE T & gum::Link< T >::element ( )

Returns the element stored in this link.

Definition at line 68 of file link_tpl.h.

68  {
69  return __element;
70  }

◆ nextLink() [1/2]

template<typename T >
INLINE const Link< T > * gum::Link< T >::nextLink ( ) const

◆ nextLink() [2/2]

template<typename T >
INLINE Link< T > * gum::Link< T >::nextLink ( )

Returns next link.

Definition at line 78 of file link_tpl.h.

78  {
79  return __nextLink;
80  }

◆ operator delete()

template<typename T >
INLINE void gum::Link< T >::operator delete ( void *  p)

Operator delete overload to use the SmallObjectAllocator.

Definition at line 58 of file link_tpl.h.

58  {
59  SmallObjectAllocator::instance().deallocate(p, sizeof(Link< T >));
60  }
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.
static SmallObjectAllocator & instance()

◆ operator new()

template<typename T >
INLINE void * gum::Link< T >::operator new ( size_t  s)

Operator new overload to use the SmallObjectAllocator.

Definition at line 53 of file link_tpl.h.

53  {
55  }
void * allocate(const size_t &objectSize)
Allocates a block.
static SmallObjectAllocator & instance()
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45

◆ setNextLink()

template<typename T>
INLINE void gum::Link< T >::setNextLink ( Link< T > *  newLink)

Sets the next link.

Definition at line 83 of file link_tpl.h.

Referenced by gum::LinkedList< gum::Parent >::searchAndRemoveLink().

83  {
84  __nextLink = newLink;
85  }
+ Here is the caller graph for this function:

Member Data Documentation

◆ __element

template<typename T>
T gum::Link< T >::__element
private

The element embedded in this link.

Definition at line 115 of file link.h.

◆ __nextLink

template<typename T>
Link< T >* gum::Link< T >::__nextLink
private

The next link in the list.

Definition at line 118 of file link.h.


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