aGrUM  0.14.2
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 45 of file composedLeaf.h.

Constructor & Destructor Documentation

◆ ComposedLeaf()

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

Default constructor.

Definition at line 55 of file composedLeaf.h.

55  :
56  AbstractLeaf(leafId), __l1(l1), __l2(l2) {
57  GUM_CONSTRUCTOR(ComposedLeaf);
58  }
AbstractLeaf * __l1
Definition: composedLeaf.h:98
ComposedLeaf(NodeId leafId, AbstractLeaf *l1, AbstractLeaf *l2)
Default constructor.
Definition: composedLeaf.h:55
AbstractLeaf * __l2
Definition: composedLeaf.h:99
AbstractLeaf(NodeId leafId)
Default constructor.
Definition: abstractLeaf.h:60

◆ ~ComposedLeaf()

gum::ComposedLeaf::~ComposedLeaf ( )
inline

Default destructor.

Definition at line 63 of file composedLeaf.h.

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

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

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

88  {
89  return AbstractLeaf::contains(testedId) || __l1->contains(testedId)
90  || __l2->contains(testedId);
91  }
virtual bool contains(NodeId testedId) const
Returns true if abstractleaf has leaf in it.
Definition: abstractLeaf.h:90
AbstractLeaf * __l1
Definition: composedLeaf.h:98
AbstractLeaf * __l2
Definition: composedLeaf.h:99
+ 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 80 of file composedLeaf.h.

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

80  {
81  return __l1->effectif(moda) + __l2->effectif(moda);
82  }
virtual double effectif(Idx) const =0
Gaves the leaf effectif for given modality.
AbstractLeaf * __l1
Definition: composedLeaf.h:98
AbstractLeaf * __l2
Definition: composedLeaf.h:99
+ Here is the call graph for this function:

◆ id()

NodeId gum::AbstractLeaf::id ( )
inlineinherited

Definition at line 92 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().

92 { 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 93 of file composedLeaf.h.

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

93 { return __l1->nbModa(); }
AbstractLeaf * __l1
Definition: composedLeaf.h:98
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 71 of file composedLeaf.h.

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

71  {
73  }
ComposedLeaf(NodeId leafId, AbstractLeaf *l1, AbstractLeaf *l2)
Default constructor.
Definition: composedLeaf.h:55
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 68 of file composedLeaf.h.

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

68  {
70  }
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 32 of file composedLeaf.cpp.

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

Referenced by nbModa().

32  {
33  std::stringstream ss;
34  ss << "{ Id : " << this->id() << " - Left : " << __l1->toString()
35  << " - Right : " << __l2->toString() << "}";
36  return ss.str();
37  }
AbstractLeaf * __l1
Definition: composedLeaf.h:98
virtual std::string toString()=0
AbstractLeaf * __l2
Definition: composedLeaf.h:99
+ 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 83 of file composedLeaf.h.

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

83 { return __l1->total() + __l2->total(); }
AbstractLeaf * __l1
Definition: composedLeaf.h:98
AbstractLeaf * __l2
Definition: composedLeaf.h:99
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 98 of file composedLeaf.h.

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

◆ __l2

AbstractLeaf* gum::ComposedLeaf::__l2
private

Definition at line 99 of file composedLeaf.h.

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


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