aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
gum::ComposedLeaf Class Referencefinal

<agrum/FMDP/learning/datastructure/leaves/composedLeaf.h> More...

#include <composedLeaf.h>

Inheritance diagram for gum::ComposedLeaf:
Collaboration diagram for gum::ComposedLeaf:

Public Member Functions

double effectif (Idx moda) const override
 Gaves the leaf effectif for given modality.
double total () const override
bool contains (NodeId testedId) const override
 Returns true if abstractleaf has leaf in it.
Idx nbModa () const override
std::string toString () override
NodeId id ()
Constructor & destructor.
 ComposedLeaf (NodeId leafId, AbstractLeaf *l1, AbstractLeaf *l2)
 Default constructor.
 ~ComposedLeaf () override
 Default destructor.
void * operator new (size_t s)
 Allocators and Deallocators redefinition.
void operator delete (void *p)
 Default constructor.

Private Attributes

AbstractLeaf_l1_
AbstractLeaf_l2_
NodeId _leafId_

Detailed Description

<agrum/FMDP/learning/datastructure/leaves/composedLeaf.h>

A leaf that has leaves inside

Definition at line 68 of file composedLeaf.h.

Constructor & Destructor Documentation

◆ ComposedLeaf()

INLINE gum::ComposedLeaf::ComposedLeaf ( NodeId leafId,
AbstractLeaf * l1,
AbstractLeaf * l2 )

Default constructor.

Definition at line 48 of file composedLeaf_inl.h.

48 :
49 AbstractLeaf(leafId), _l1_(l1), _l2_(l2) {
50 GUM_CONSTRUCTOR(ComposedLeaf);
51 }
AbstractLeaf(NodeId leafId)
Default constructor.
ComposedLeaf(NodeId leafId, AbstractLeaf *l1, AbstractLeaf *l2)
Default constructor.
AbstractLeaf * _l2_
AbstractLeaf * _l1_

References gum::AbstractLeaf::AbstractLeaf(), ComposedLeaf(), _l1_, and _l2_.

Referenced by ComposedLeaf(), ~ComposedLeaf(), and operator delete().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~ComposedLeaf()

INLINE gum::ComposedLeaf::~ComposedLeaf ( )
override

Default destructor.

Definition at line 53 of file composedLeaf_inl.h.

53 {
54 GUM_DESTRUCTOR(ComposedLeaf);
55 ;
56 }

References ComposedLeaf().

Here is the call graph for this function:

Member Function Documentation

◆ contains()

INLINE bool gum::ComposedLeaf::contains ( NodeId testedId) const
overridevirtual

Returns true if abstractleaf has leaf in it.

Reimplemented from gum::AbstractLeaf.

Definition at line 72 of file composedLeaf_inl.h.

72 {
73 return AbstractLeaf::contains(testedId) || _l1_->contains(testedId) || _l2_->contains(testedId);
74 }
virtual bool contains(NodeId testedId) const
Returns true if abstractleaf has leaf in it.

References _l1_, _l2_, and gum::AbstractLeaf::contains().

Here is the call graph for this function:

◆ effectif()

INLINE double gum::ComposedLeaf::effectif ( Idx moda) const
overridevirtual

Gaves the leaf effectif for given modality.

Implements gum::AbstractLeaf.

Definition at line 66 of file composedLeaf_inl.h.

66 {
67 return _l1_->effectif(moda) + _l2_->effectif(moda);
68 }

References _l1_, and _l2_.

◆ id()

INLINE NodeId gum::AbstractLeaf::id ( )
inherited

Definition at line 67 of file abstractLeaf_inl.h.

67{ return _leafId_; }

References _leafId_.

Referenced by gum::LeafAggregator::updateLeaf().

Here is the caller graph for this function:

◆ nbModa()

INLINE Idx gum::ComposedLeaf::nbModa ( ) const
overridevirtual

Implements gum::AbstractLeaf.

Definition at line 76 of file composedLeaf_inl.h.

76{ return _l1_->nbModa(); }

References _l1_.

◆ operator delete()

INLINE void gum::ComposedLeaf::operator delete ( void * p)

Default constructor.

Definition at line 62 of file composedLeaf_inl.h.

62 {
64 }
static SmallObjectAllocator & instance()
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.

References ComposedLeaf(), gum::SmallObjectAllocator::deallocate(), and gum::SmallObjectAllocator::instance().

Here is the call graph for this function:

◆ operator new()

INLINE void * gum::ComposedLeaf::operator new ( size_t s)

Allocators and Deallocators redefinition.

Definition at line 58 of file composedLeaf_inl.h.

58 {
60 }
void * allocate(const size_t &objectSize)
Allocates a block.

References gum::SmallObjectAllocator::allocate(), and gum::SmallObjectAllocator::instance().

Here is the call graph for this function:

◆ toString()

std::string gum::ComposedLeaf::toString ( )
overridevirtual

Implements gum::AbstractLeaf.

Definition at line 60 of file composedLeaf.cpp.

60 {
61 return std::format("{{ Id : {} - Left : {} - Right : {}}}",
62 this->id(),
63 _l1_->toString(),
64 _l2_->toString());
65 }

References _l1_, and _l2_.

◆ total()

INLINE double gum::ComposedLeaf::total ( ) const
overridevirtual

Implements gum::AbstractLeaf.

Definition at line 70 of file composedLeaf_inl.h.

70{ return _l1_->total() + _l2_->total(); }

References _l1_, and _l2_.

Member Data Documentation

◆ _l1_

AbstractLeaf* gum::ComposedLeaf::_l1_
private

Definition at line 111 of file composedLeaf.h.

Referenced by ComposedLeaf(), contains(), effectif(), nbModa(), toString(), and total().

◆ _l2_

AbstractLeaf* gum::ComposedLeaf::_l2_
private

Definition at line 112 of file composedLeaf.h.

Referenced by ComposedLeaf(), contains(), effectif(), toString(), and total().

◆ _leafId_

NodeId gum::AbstractLeaf::_leafId_
privateinherited

Definition at line 116 of file abstractLeaf.h.

Referenced by AbstractLeaf(), contains(), and id().


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