aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
gum::ComposedLeaf Class Reference

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

Detailed Description

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

A leaf that has leaves inside

Definition at line 47 of file composedLeaf.h.

Constructor & Destructor Documentation

◆ ComposedLeaf()

gum::ComposedLeaf::ComposedLeaf ( NodeId  leafId,
AbstractLeaf l1,
AbstractLeaf l2 
)
inline

Default constructor.

Definition at line 57 of file composedLeaf.h.

References ComposedLeaf().

Referenced by ComposedLeaf().

57  :
58  AbstractLeaf(leafId), _l1_(l1), _l2_(l2) {
59  GUM_CONSTRUCTOR(ComposedLeaf);
60  }
AbstractLeaf * _l2_
Definition: composedLeaf.h:100
ComposedLeaf(NodeId leafId, AbstractLeaf *l1, AbstractLeaf *l2)
Default constructor.
Definition: composedLeaf.h:57
AbstractLeaf * _l1_
Definition: composedLeaf.h:99
AbstractLeaf(NodeId leafId)
Default constructor.
Definition: abstractLeaf.h:62
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~ComposedLeaf()

gum::ComposedLeaf::~ComposedLeaf ( )
inline

Default destructor.

Definition at line 65 of file composedLeaf.h.

65  {
66  GUM_DESTRUCTOR(ComposedLeaf);
67  ;
68  }
ComposedLeaf(NodeId leafId, AbstractLeaf *l1, AbstractLeaf *l2)
Default constructor.
Definition: composedLeaf.h:57

Member Function Documentation

◆ contains()

bool gum::ComposedLeaf::contains ( NodeId  testedId) const
inlinevirtual

Returns true if abstractleaf has leaf in it.

Reimplemented from gum::AbstractLeaf.

Definition at line 89 of file composedLeaf.h.

89  {
90  return AbstractLeaf::contains(testedId) || _l1_->contains(testedId)
91  || _l2_->contains(testedId);
92  }
virtual bool contains(NodeId testedId) const
Returns true if abstractleaf has leaf in it.
Definition: abstractLeaf.h:91
AbstractLeaf * _l2_
Definition: composedLeaf.h:100
AbstractLeaf * _l1_
Definition: composedLeaf.h:99

◆ effectif()

double gum::ComposedLeaf::effectif ( Idx  moda) const
inlinevirtual

Gaves the leaf effectif for given modality.

Implements gum::AbstractLeaf.

Definition at line 83 of file composedLeaf.h.

83 { return _l1_->effectif(moda) + _l2_->effectif(moda); }
virtual double effectif(Idx) const =0
Gaves the leaf effectif for given modality.
AbstractLeaf * _l2_
Definition: composedLeaf.h:100
AbstractLeaf * _l1_
Definition: composedLeaf.h:99

◆ id()

NodeId gum::AbstractLeaf::id ( )
inlineinherited

Definition at line 93 of file abstractLeaf.h.

93 { return _leafId_; }

◆ nbModa()

Idx gum::ComposedLeaf::nbModa ( ) const
inlinevirtual

Implements gum::AbstractLeaf.

Definition at line 94 of file composedLeaf.h.

94 { return _l1_->nbModa(); }
virtual Idx nbModa() const =0
AbstractLeaf * _l1_
Definition: composedLeaf.h:99

◆ operator delete()

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

Default constructor.

Definition at line 74 of file composedLeaf.h.

74  {
76  }
ComposedLeaf(NodeId leafId, AbstractLeaf *l1, AbstractLeaf *l2)
Default constructor.
Definition: composedLeaf.h:57
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.
static SmallObjectAllocator & instance()

◆ operator new()

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

Allocators and Deallocators redefinition.

Definition at line 73 of file composedLeaf.h.

void * allocate(const size_t &objectSize)
Allocates a block.
static SmallObjectAllocator & instance()

◆ toString()

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

Implements gum::AbstractLeaf.

Definition at line 35 of file composedLeaf.cpp.

References gum::Set< Key, Alloc >::emplace().

35  {
36  std::stringstream ss;
37  ss << "{ Id : " << this->id() << " - Left : " << _l1_->toString()
38  << " - Right : " << _l2_->toString() << "}";
39  return ss.str();
40  }
AbstractLeaf * _l2_
Definition: composedLeaf.h:100
virtual std::string toString()=0
AbstractLeaf * _l1_
Definition: composedLeaf.h:99
+ Here is the call graph for this function:

◆ total()

double gum::ComposedLeaf::total ( ) const
inlinevirtual

Implements gum::AbstractLeaf.

Definition at line 84 of file composedLeaf.h.

84 { return _l1_->total() + _l2_->total(); }
AbstractLeaf * _l2_
Definition: composedLeaf.h:100
AbstractLeaf * _l1_
Definition: composedLeaf.h:99
virtual double total() const =0

Member Data Documentation

◆ _l1_

AbstractLeaf* gum::ComposedLeaf::_l1_
private

Definition at line 99 of file composedLeaf.h.

◆ _l2_

AbstractLeaf* gum::ComposedLeaf::_l2_
private

Definition at line 100 of file composedLeaf.h.


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