aGrUM  0.16.0
abstractLeaf.h
Go to the documentation of this file.
1 
30 // =========================================================================
31 #ifndef GUM_ABSTRACT_LEAF_H
32 #define GUM_ABSTRACT_LEAF_H
33 // =========================================================================
34 #include <agrum/core/hashTable.h>
36 #include <agrum/core/sequence.h>
38 // =========================================================================
40 // =========================================================================
41 
42 namespace gum {
43 
53  class AbstractLeaf {
54  public:
55  // ==========================================================================
57  // ==========================================================================
59 
60  // ###################################################################
62  // ###################################################################
63  AbstractLeaf(NodeId leafId) : __leafId(leafId) {
64  GUM_CONSTRUCTOR(AbstractLeaf);
65  }
66 
67  // ###################################################################
69  // ###################################################################
70  virtual ~AbstractLeaf() { GUM_DESTRUCTOR(AbstractLeaf); }
71 
72  // ============================================================================
74  // ============================================================================
75  void* operator new(size_t s) {
77  }
78  void operator delete(void* p) {
80  }
81 
83 
84  // ###################################################################
86  // ###################################################################
87  virtual double effectif(Idx) const = 0;
88  virtual double total() const = 0;
89 
90  // ###################################################################
92  // ###################################################################
93  virtual bool contains(NodeId testedId) const { return __leafId == testedId; }
94 
95  NodeId id() { return __leafId; }
96 
97  virtual Idx nbModa() const = 0;
98 
99  virtual std::string toString() = 0;
100 
101  private:
103  };
104 
105 
106 } /* namespace gum */
107 
108 
109 #endif // GUM_ABSTRACT_LEAF_H
virtual bool contains(NodeId testedId) const
Returns true if abstractleaf has leaf in it.
Definition: abstractLeaf.h:93
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual double effectif(Idx) const =0
Gaves the leaf effectif for given modality.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
<agrum/FMDP/learning/datastructure/leaves/abstractLeaf.h>
Definition: abstractLeaf.h:53
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
virtual std::string toString()=0
virtual Idx nbModa() const =0
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.
Size Idx
Type for indexes.
Definition: types.h:53
void * allocate(const size_t &objectSize)
Allocates a block.
static SmallObjectAllocator & instance()
virtual double total() const =0
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual ~AbstractLeaf()
Default destructor.
Definition: abstractLeaf.h:70
Size NodeId
Type for node ids.
Definition: graphElements.h:98
AbstractLeaf(NodeId leafId)
Default constructor.
Definition: abstractLeaf.h:63
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.