aGrUM  0.14.2
abstractLeaf.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
27 // =========================================================================
28 #ifndef GUM_ABSTRACT_LEAF_H
29 #define GUM_ABSTRACT_LEAF_H
30 // =========================================================================
31 #include <agrum/core/hashTable.h>
33 #include <agrum/core/sequence.h>
35 // =========================================================================
37 // =========================================================================
38 
39 namespace gum {
40 
50  class AbstractLeaf {
51  public:
52  // ==========================================================================
54  // ==========================================================================
56 
57  // ###################################################################
59  // ###################################################################
60  AbstractLeaf(NodeId leafId) : __leafId(leafId) {
61  GUM_CONSTRUCTOR(AbstractLeaf);
62  }
63 
64  // ###################################################################
66  // ###################################################################
67  virtual ~AbstractLeaf() { GUM_DESTRUCTOR(AbstractLeaf); }
68 
69  // ============================================================================
71  // ============================================================================
72  void* operator new(size_t s) {
74  }
75  void operator delete(void* p) {
77  }
78 
80 
81  // ###################################################################
83  // ###################################################################
84  virtual double effectif(Idx) const = 0;
85  virtual double total() const = 0;
86 
87  // ###################################################################
89  // ###################################################################
90  virtual bool contains(NodeId testedId) const { return __leafId == testedId; }
91 
92  NodeId id() { return __leafId; }
93 
94  virtual Idx nbModa() const = 0;
95 
96  virtual std::string toString() = 0;
97 
98  private:
100  };
101 
102 
103 } /* namespace gum */
104 
105 
106 #endif // GUM_ABSTRACT_LEAF_H
virtual bool contains(NodeId testedId) const
Returns true if abstractleaf has leaf in it.
Definition: abstractLeaf.h:90
Priority queues in which the same element can appear several times.
virtual double effectif(Idx) const =0
Gaves the leaf effectif for given modality.
Headers of gum::SmallObjectAllocator.
Header file of gum::Sequence, a class for storing (ordered) sequences of objects. ...
<agrum/FMDP/learning/datastructure/leaves/abstractLeaf.h>
Definition: abstractLeaf.h:50
gum is the global namespace for all aGrUM entities
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:50
void * allocate(const size_t &objectSize)
Allocates a block.
static SmallObjectAllocator & instance()
virtual double total() const =0
Class hash tables iterators.
virtual ~AbstractLeaf()
Default destructor.
Definition: abstractLeaf.h:67
Size NodeId
Type for node ids.
Definition: graphElements.h:97
AbstractLeaf(NodeId leafId)
Default constructor.
Definition: abstractLeaf.h:60
some utils for topology : NodeId, Edge, Arc and consorts ...