aGrUM  0.20.2
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:101
ComposedLeaf(NodeId leafId, AbstractLeaf *l1, AbstractLeaf *l2)
Default constructor.
Definition: composedLeaf.h:57
AbstractLeaf * l1__
Definition: composedLeaf.h:100
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 { GUM_DESTRUCTOR(ComposedLeaf); }
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 90 of file composedLeaf.h.

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

◆ effectif()

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

Gaves the leaf effectif for given modality.

Implements gum::AbstractLeaf.

Definition at line 82 of file composedLeaf.h.

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

◆ id()

NodeId gum::AbstractLeaf::id ( )
inlineinherited

Definition at line 94 of file abstractLeaf.h.

94 { return leafId__; }

◆ nbModa()

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

Implements gum::AbstractLeaf.

Definition at line 95 of file composedLeaf.h.

95 { return l1__->nbModa(); }
virtual Idx nbModa() const =0
AbstractLeaf * l1__
Definition: composedLeaf.h:100

◆ operator delete()

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

Default constructor.

Definition at line 73 of file composedLeaf.h.

73  {
75  }
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 70 of file composedLeaf.h.

70  {
72  }
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:101
virtual std::string toString()=0
AbstractLeaf * l1__
Definition: composedLeaf.h:100
+ Here is the call graph for this function:

◆ total()

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

Implements gum::AbstractLeaf.

Definition at line 85 of file composedLeaf.h.

85 { return l1__->total() + l2__->total(); }
AbstractLeaf * l2__
Definition: composedLeaf.h:101
virtual double total() const =0
AbstractLeaf * l1__
Definition: composedLeaf.h:100

Member Data Documentation

◆ l1__

AbstractLeaf* gum::ComposedLeaf::l1__
private

Definition at line 100 of file composedLeaf.h.

◆ l2__

AbstractLeaf* gum::ComposedLeaf::l2__
private

Definition at line 101 of file composedLeaf.h.


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