aGrUM  0.16.0
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 48 of file composedLeaf.h.

Constructor & Destructor Documentation

◆ ComposedLeaf()

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

Default constructor.

Definition at line 58 of file composedLeaf.h.

58  :
59  AbstractLeaf(leafId), __l1(l1), __l2(l2) {
60  GUM_CONSTRUCTOR(ComposedLeaf);
61  }
AbstractLeaf * __l1
Definition: composedLeaf.h:101
ComposedLeaf(NodeId leafId, AbstractLeaf *l1, AbstractLeaf *l2)
Default constructor.
Definition: composedLeaf.h:58
AbstractLeaf * __l2
Definition: composedLeaf.h:102
AbstractLeaf(NodeId leafId)
Default constructor.
Definition: abstractLeaf.h:63

◆ ~ComposedLeaf()

gum::ComposedLeaf::~ComposedLeaf ( )
inline

Default destructor.

Definition at line 66 of file composedLeaf.h.

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

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 91 of file composedLeaf.h.

References __l1, __l2, and gum::AbstractLeaf::contains().

91  {
92  return AbstractLeaf::contains(testedId) || __l1->contains(testedId)
93  || __l2->contains(testedId);
94  }
virtual bool contains(NodeId testedId) const
Returns true if abstractleaf has leaf in it.
Definition: abstractLeaf.h:93
AbstractLeaf * __l1
Definition: composedLeaf.h:101
AbstractLeaf * __l2
Definition: composedLeaf.h:102
+ Here is the call graph for this function:

◆ 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.

References __l1, __l2, and gum::AbstractLeaf::effectif().

83  {
84  return __l1->effectif(moda) + __l2->effectif(moda);
85  }
virtual double effectif(Idx) const =0
Gaves the leaf effectif for given modality.
AbstractLeaf * __l1
Definition: composedLeaf.h:101
AbstractLeaf * __l2
Definition: composedLeaf.h:102
+ Here is the call graph for this function:

◆ id()

NodeId gum::AbstractLeaf::id ( )
inlineinherited

Definition at line 95 of file abstractLeaf.h.

References gum::AbstractLeaf::__leafId, gum::AbstractLeaf::nbModa(), and gum::AbstractLeaf::toString().

Referenced by toString(), gum::ConcreteLeaf< AttributeSelection, isScalar >::toString(), and gum::LeafAggregator::updateLeaf().

95 { return __leafId; }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nbModa()

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

Implements gum::AbstractLeaf.

Definition at line 96 of file composedLeaf.h.

References __l1, gum::AbstractLeaf::nbModa(), and toString().

96 { return __l1->nbModa(); }
AbstractLeaf * __l1
Definition: composedLeaf.h:101
virtual Idx nbModa() const =0
+ Here is the call graph for this function:

◆ operator delete()

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

Default constructor.

Definition at line 74 of file composedLeaf.h.

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

74  {
76  }
ComposedLeaf(NodeId leafId, AbstractLeaf *l1, AbstractLeaf *l2)
Default constructor.
Definition: composedLeaf.h:58
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.
static SmallObjectAllocator & instance()
+ Here is the call graph for this function:

◆ operator new()

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

Allocators and Deallocators redefinition.

Definition at line 71 of file composedLeaf.h.

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

71  {
73  }
void * allocate(const size_t &objectSize)
Allocates a block.
static SmallObjectAllocator & instance()
+ Here is the call graph for this function:

◆ toString()

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

Implements gum::AbstractLeaf.

Definition at line 35 of file composedLeaf.cpp.

References __l1, __l2, gum::AbstractLeaf::id(), and gum::AbstractLeaf::toString().

Referenced by nbModa().

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

◆ total()

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

Implements gum::AbstractLeaf.

Definition at line 86 of file composedLeaf.h.

References __l1, __l2, and gum::AbstractLeaf::total().

86 { return __l1->total() + __l2->total(); }
AbstractLeaf * __l1
Definition: composedLeaf.h:101
AbstractLeaf * __l2
Definition: composedLeaf.h:102
virtual double total() const =0
+ Here is the call graph for this function:

Member Data Documentation

◆ __l1

AbstractLeaf* gum::ComposedLeaf::__l1
private

Definition at line 101 of file composedLeaf.h.

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

◆ __l2

AbstractLeaf* gum::ComposedLeaf::__l2
private

Definition at line 102 of file composedLeaf.h.

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


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