aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
gum::Link< T > Class Template Reference

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

#include <agrum/tools/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 51 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 38 of file link_tpl.h.

38  : _element_(elem) {
39  GUM_CONSTRUCTOR(Link);
40  }

◆ 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 44 of file link_tpl.h.

44  :
45  _element_(elem), _nextLink_(nextLink) {
46  GUM_CONSTRUCTOR(Link);
47  }

◆ ~Link()

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

Destructor.

Definition at line 51 of file link_tpl.h.

51  {
52  GUM_DESTRUCTOR(Link);
53  }

Member Function Documentation

◆ element() [1/2]

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

Returns the element stored in this link.

Definition at line 66 of file link_tpl.h.

66  {
67  return _element_;
68  }

◆ element() [2/2]

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

Returns the element stored in this link.

Definition at line 71 of file link_tpl.h.

71  {
72  return _element_;
73  }

◆ nextLink() [1/2]

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

Returns next link.

Definition at line 76 of file link_tpl.h.

76  {
77  return _nextLink_;
78  }

◆ nextLink() [2/2]

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

Returns next link.

Definition at line 81 of file link_tpl.h.

81  {
82  return _nextLink_;
83  }

◆ operator delete()

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

Operator delete overload to use the SmallObjectAllocator.

Definition at line 61 of file link_tpl.h.

61  {
62  SmallObjectAllocator::instance().deallocate(p, sizeof(Link< T >));
63  }
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 56 of file link_tpl.h.

56  {
58  }
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:47

◆ setNextLink()

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

Sets the next link.

Definition at line 86 of file link_tpl.h.

86  {
87  _nextLink_ = newLink;
88  }

Member Data Documentation

◆ _element_

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

The element embedded in this link.

Definition at line 118 of file link.h.

◆ _nextLink_

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

The next link in the list.

Definition at line 121 of file link.h.


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