aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
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.

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

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

72  :
73  AbstractLeaf(leafId),
74  n1__(n1), valueDomain__(valueDomain) {
75  GUM_CONSTRUCTOR(ConcreteLeaf);
76  }
NodeDatabase< AttributeSelection, isScalar > * n1__
Definition: concreteLeaf.h:127
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
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:

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

◆ 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 92 of file abstractLeaf.h.

92 { return leafId__ == testedId; }

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

98  {
99  return effectif__(moda, Int2Type< isScalar >());
100  }
double effectif__(Idx moda, Int2Type< true >) const
Definition: concreteLeaf.h:103

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

103  {
104  return (double)n1__->effectif(Idx(valueDomain__->atPos(moda)));
105  }
NodeDatabase< AttributeSelection, isScalar > * n1__
Definition: concreteLeaf.h:127
const Sequence< ValueType > * valueDomain__
Definition: concreteLeaf.h:128
Size Idx
Type for indexes.
Definition: types.h:52

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

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

◆ id()

NodeId gum::AbstractLeaf::id ( )
inlineinherited

Definition at line 94 of file abstractLeaf.h.

94 { return leafId__; }

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

113 { return nbModa__(Int2Type< isScalar >()); }
Idx nbModa__(Int2Type< true >) const
Definition: concreteLeaf.h:116

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

116 { return valueDomain__->size(); }
const Sequence< ValueType > * valueDomain__
Definition: concreteLeaf.h:128

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

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

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

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()

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

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

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

120  {
121  std::stringstream ss;
122  ss << "{ Id : " << this->id() << "}";
123  return ss.str();
124  }

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

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

Definition at line 127 of file concreteLeaf.h.

◆ valueDomain__

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

Definition at line 128 of file concreteLeaf.h.


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