aGrUM  0.20.3
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  }
const Sequence< ValueType > * _valueDomain_
Definition: concreteLeaf.h:125
NodeDatabase< AttributeSelection, isScalar > * _n1_
Definition: concreteLeaf.h:124
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  {
82  GUM_DESTRUCTOR(ConcreteLeaf);
83  ;
84  }
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 102 of file concreteLeaf.h.

102  {
103  return (double)_n1_->effectif(Idx(_valueDomain_->atPos(moda)));
104  }
const Sequence< ValueType > * _valueDomain_
Definition: concreteLeaf.h:125
NodeDatabase< AttributeSelection, isScalar > * _n1_
Definition: concreteLeaf.h:124
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 105 of file concreteLeaf.h.

105 { return (double)_n1_->effectif(moda); }
NodeDatabase< AttributeSelection, isScalar > * _n1_
Definition: concreteLeaf.h:124

◆ _nbModa_() [1/2]

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

Definition at line 113 of file concreteLeaf.h.

113 { return _valueDomain_->size(); }
const Sequence< ValueType > * _valueDomain_
Definition: concreteLeaf.h:125

◆ _nbModa_() [2/2]

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

Definition at line 114 of file concreteLeaf.h.

114 { return _n1_->valueDomain(); }
NodeDatabase< AttributeSelection, isScalar > * _n1_
Definition: concreteLeaf.h:124

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

91 { 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 99 of file concreteLeaf.h.

99 { return _effectif_(moda, Int2Type< isScalar >()); }
double _effectif_(Idx moda, Int2Type< true >) const
Definition: concreteLeaf.h:102

◆ id()

NodeId gum::AbstractLeaf::id ( )
inlineinherited

Definition at line 93 of file abstractLeaf.h.

93 { return _leafId_; }

◆ nbModa()

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

Implements gum::AbstractLeaf.

Definition at line 110 of file concreteLeaf.h.

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

◆ operator delete()

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

Default constructor.

Definition at line 90 of file concreteLeaf.h.

90  {
92  }
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 89 of file concreteLeaf.h.

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 117 of file concreteLeaf.h.

117  {
118  std::stringstream ss;
119  ss << "{ Id : " << this->id() << "}";
120  return ss.str();
121  }

◆ total()

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

Implements gum::AbstractLeaf.

Definition at line 108 of file concreteLeaf.h.

108 { return double(_n1_->nbObservation()); }
NodeDatabase< AttributeSelection, isScalar > * _n1_
Definition: concreteLeaf.h:124

Member Data Documentation

◆ _n1_

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

Definition at line 124 of file concreteLeaf.h.

◆ _valueDomain_

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

Definition at line 125 of file concreteLeaf.h.


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