aGrUM  0.16.0
gum::ConcreteLeaf< AttributeSelection, isScalar > Class Template Reference

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

#include <concreteLeaf.h>

+ Inheritance diagram for gum::ConcreteLeaf< AttributeSelection, isScalar >:
+ Collaboration diagram for gum::ConcreteLeaf< AttributeSelection, isScalar >:

Public Member Functions

virtual double effectif (Idx moda) const
 Gaves the leaf effectif for given modality. More...
 
virtual double total () const
 
Idx nbModa () const
 
std::string toString ()
 
virtual bool contains (NodeId testedId) const
 Returns true if abstractleaf has leaf in it. More...
 
NodeId id ()
 
Constructor & destructor.
 ConcreteLeaf (NodeId leafId, NodeDatabase< AttributeSelection, isScalar > *n1, const Sequence< ValueType > *valueDomain)
 Default constructor. More...
 
 ~ConcreteLeaf ()
 Default destructor. More...
 
void * operator new (size_t s)
 Allocators and Deallocators redefinition. More...
 
void operator delete (void *p)
 Default constructor. More...
 

Detailed Description

template<TESTNAME AttributeSelection, bool isScalar>
class gum::ConcreteLeaf< AttributeSelection, isScalar >

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

A concrete leaf

Definition at line 58 of file concreteLeaf.h.

Member Typedef Documentation

◆ ValueType

template<TESTNAME AttributeSelection, bool isScalar>
typedef ValueSelect< isScalar, double, Idx >::type gum::ConcreteLeaf< AttributeSelection, isScalar >::ValueType
private

Definition at line 59 of file concreteLeaf.h.

Constructor & Destructor Documentation

◆ ConcreteLeaf()

template<TESTNAME AttributeSelection, bool isScalar>
gum::ConcreteLeaf< AttributeSelection, isScalar >::ConcreteLeaf ( NodeId  leafId,
NodeDatabase< AttributeSelection, isScalar > *  n1,
const Sequence< ValueType > *  valueDomain 
)
inline

Default constructor.

Definition at line 70 of file concreteLeaf.h.

72  :
73  AbstractLeaf(leafId),
74  __n1(n1), __valueDomain(valueDomain) {
75  GUM_CONSTRUCTOR(ConcreteLeaf);
76  }
const Sequence< ValueType > * __valueDomain
Definition: concreteLeaf.h:128
ConcreteLeaf(NodeId leafId, NodeDatabase< AttributeSelection, isScalar > *n1, const Sequence< ValueType > *valueDomain)
Default constructor.
Definition: concreteLeaf.h:70
NodeDatabase< AttributeSelection, isScalar > * __n1
Definition: concreteLeaf.h:127
AbstractLeaf(NodeId leafId)
Default constructor.
Definition: abstractLeaf.h:63

◆ ~ConcreteLeaf()

template<TESTNAME AttributeSelection, bool isScalar>
gum::ConcreteLeaf< AttributeSelection, isScalar >::~ConcreteLeaf ( )
inline

Default destructor.

Definition at line 81 of file concreteLeaf.h.

81 { GUM_DESTRUCTOR(ConcreteLeaf); }
ConcreteLeaf(NodeId leafId, NodeDatabase< AttributeSelection, isScalar > *n1, const Sequence< ValueType > *valueDomain)
Default constructor.
Definition: concreteLeaf.h:70

Member Function Documentation

◆ __effectif() [1/2]

template<TESTNAME AttributeSelection, bool isScalar>
double gum::ConcreteLeaf< AttributeSelection, isScalar >::__effectif ( Idx  moda,
Int2Type< true >   
) const
inlineprivate

Definition at line 103 of file concreteLeaf.h.

References gum::ConcreteLeaf< AttributeSelection, isScalar >::__n1, and gum::ConcreteLeaf< AttributeSelection, isScalar >::__valueDomain.

Referenced by gum::ConcreteLeaf< AttributeSelection, isScalar >::effectif().

103  {
104  return (double)__n1->effectif(Idx(__valueDomain->atPos(moda)));
105  }
const Sequence< ValueType > * __valueDomain
Definition: concreteLeaf.h:128
NodeDatabase< AttributeSelection, isScalar > * __n1
Definition: concreteLeaf.h:127
Size Idx
Type for indexes.
Definition: types.h:53
+ Here is the caller graph for this function:

◆ __effectif() [2/2]

template<TESTNAME AttributeSelection, bool isScalar>
double gum::ConcreteLeaf< AttributeSelection, isScalar >::__effectif ( Idx  moda,
Int2Type< false >   
) const
inlineprivate

Definition at line 106 of file concreteLeaf.h.

References gum::ConcreteLeaf< AttributeSelection, isScalar >::__n1.

106  {
107  return (double)__n1->effectif(moda);
108  }
NodeDatabase< AttributeSelection, isScalar > * __n1
Definition: concreteLeaf.h:127

◆ __nbModa() [1/2]

template<TESTNAME AttributeSelection, bool isScalar>
Idx gum::ConcreteLeaf< AttributeSelection, isScalar >::__nbModa ( Int2Type< true >  ) const
inlineprivate

Definition at line 116 of file concreteLeaf.h.

References gum::ConcreteLeaf< AttributeSelection, isScalar >::__valueDomain.

Referenced by gum::ConcreteLeaf< AttributeSelection, isScalar >::nbModa().

116 { return __valueDomain->size(); }
const Sequence< ValueType > * __valueDomain
Definition: concreteLeaf.h:128
+ Here is the caller graph for this function:

◆ __nbModa() [2/2]

template<TESTNAME AttributeSelection, bool isScalar>
Idx gum::ConcreteLeaf< AttributeSelection, isScalar >::__nbModa ( Int2Type< false >  ) const
inlineprivate

Definition at line 117 of file concreteLeaf.h.

References gum::ConcreteLeaf< AttributeSelection, isScalar >::__n1.

117 { return __n1->valueDomain(); }
NodeDatabase< AttributeSelection, isScalar > * __n1
Definition: concreteLeaf.h:127

◆ contains()

virtual bool gum::AbstractLeaf::contains ( NodeId  testedId) const
inlinevirtualinherited

Returns true if abstractleaf has leaf in it.

Reimplemented in gum::ComposedLeaf.

Definition at line 93 of file abstractLeaf.h.

References gum::AbstractLeaf::__leafId.

Referenced by gum::ComposedLeaf::contains(), gum::LeafPair::contains(), and gum::LeafAggregator::update().

93 { return __leafId == testedId; }
+ Here is the caller graph for this function:

◆ effectif()

template<TESTNAME AttributeSelection, bool isScalar>
virtual double gum::ConcreteLeaf< AttributeSelection, isScalar >::effectif ( Idx  moda) const
inlinevirtual

Gaves the leaf effectif for given modality.

Implements gum::AbstractLeaf.

Definition at line 98 of file concreteLeaf.h.

References gum::ConcreteLeaf< AttributeSelection, isScalar >::__effectif().

98  {
99  return __effectif(moda, Int2Type< isScalar >());
100  }
double __effectif(Idx moda, Int2Type< true >) const
Definition: concreteLeaf.h:103
+ 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 gum::ComposedLeaf::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()

template<TESTNAME AttributeSelection, bool isScalar>
Idx gum::ConcreteLeaf< AttributeSelection, isScalar >::nbModa ( ) const
inlinevirtual

Implements gum::AbstractLeaf.

Definition at line 113 of file concreteLeaf.h.

References gum::ConcreteLeaf< AttributeSelection, isScalar >::__nbModa().

113 { return __nbModa(Int2Type< isScalar >()); }
Idx __nbModa(Int2Type< true >) const
Definition: concreteLeaf.h:116
+ Here is the call graph for this function:

◆ operator delete()

template<TESTNAME AttributeSelection, bool isScalar>
void gum::ConcreteLeaf< AttributeSelection, isScalar >::operator delete ( void *  p)
inline

Default constructor.

Definition at line 89 of file concreteLeaf.h.

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

89  {
91  }
ConcreteLeaf(NodeId leafId, NodeDatabase< AttributeSelection, isScalar > *n1, const Sequence< ValueType > *valueDomain)
Default constructor.
Definition: concreteLeaf.h:70
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.
static SmallObjectAllocator & instance()
+ Here is the call graph for this function:

◆ operator new()

template<TESTNAME AttributeSelection, bool isScalar>
void* gum::ConcreteLeaf< AttributeSelection, isScalar >::operator new ( size_t  s)
inline

Allocators and Deallocators redefinition.

Definition at line 86 of file concreteLeaf.h.

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

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

◆ toString()

template<TESTNAME AttributeSelection, bool isScalar>
std::string gum::ConcreteLeaf< AttributeSelection, isScalar >::toString ( )
inlinevirtual

Implements gum::AbstractLeaf.

Definition at line 120 of file concreteLeaf.h.

References gum::AbstractLeaf::id().

120  {
121  std::stringstream ss;
122  ss << "{ Id : " << this->id() << "}";
123  return ss.str();
124  }
+ Here is the call graph for this function:

◆ total()

template<TESTNAME AttributeSelection, bool isScalar>
virtual double gum::ConcreteLeaf< AttributeSelection, isScalar >::total ( ) const
inlinevirtual

Implements gum::AbstractLeaf.

Definition at line 111 of file concreteLeaf.h.

References gum::ConcreteLeaf< AttributeSelection, isScalar >::__n1.

111 { return double(__n1->nbObservation()); }
NodeDatabase< AttributeSelection, isScalar > * __n1
Definition: concreteLeaf.h:127

Member Data Documentation

◆ __n1

template<TESTNAME AttributeSelection, bool isScalar>
NodeDatabase< AttributeSelection, isScalar >* gum::ConcreteLeaf< AttributeSelection, isScalar >::__n1
private

◆ __valueDomain

template<TESTNAME AttributeSelection, bool isScalar>
const Sequence< ValueType >* gum::ConcreteLeaf< AttributeSelection, isScalar >::__valueDomain
private

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