aGrUM  0.14.2
PRMSlotChain.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 #ifndef GUM_SLOT_CHAIN_H
28 #define GUM_SLOT_CHAIN_H
29 
30 #include <string>
31 
32 #include <agrum/core/sequence.h>
33 
38 
45 
46 namespace gum {
47  namespace prm {
48 
49  template < typename GUM_SCALAR >
50  class PRMClass;
51  template < typename GUM_SCALAR >
52  class PRMAttribute;
53 
78  // ==========================================================================
79  template < typename GUM_SCALAR >
80  class PRMSlotChain : public PRMClassElement< GUM_SCALAR > {
81  public:
82  // ========================================================================
84  // ========================================================================
86 
104  PRMSlotChain(const std::string& name,
105  const Sequence< PRMClassElement< GUM_SCALAR >* >& chain);
106 
124  PRMSlotChain(Sequence< PRMClassElement< GUM_SCALAR >* >* chain,
125  const std::string& name);
126 
132  PRMSlotChain(const PRMSlotChain< GUM_SCALAR >& source);
133 
135  virtual ~PRMSlotChain();
136 
138  // ========================================================================
140  // ========================================================================
142 
145  elt_type() const;
146 
148  virtual PRMType& type();
149 
151  virtual const PRMType& type() const;
152 
153  // /// This is similar to the following call: this->lastElt().cpf()
154  // virtual Potential<GUM_SCALAR>& cpf();
155 
157  virtual const Potential< GUM_SCALAR >& cpf() const;
158 
161  bool isMultiple() const;
162 
165  PRMClassElementContainer< GUM_SCALAR >& end();
166 
169  const PRMClassElementContainer< GUM_SCALAR >& end() const;
170 
173  PRMClassElement< GUM_SCALAR >& lastElt();
174 
177  const PRMClassElement< GUM_SCALAR >& lastElt() const;
178 
181  Sequence< PRMClassElement< GUM_SCALAR >* >& chain();
182 
185  const Sequence< PRMClassElement< GUM_SCALAR >* >& chain() const;
186 
188  virtual void addParent(const PRMClassElement< GUM_SCALAR >& elt);
189 
191  virtual void addChild(const PRMClassElement< GUM_SCALAR >& elt);
192 
195  virtual PRMAttribute< GUM_SCALAR >* getCastDescendant() const;
197  private:
199  PRMSlotChain& operator=(const PRMSlotChain& source);
200 
201  // ========================================================================
203  // ========================================================================
205 
208 
211 
214  void __copyLastElt();
215 
217  };
218 
219 
220 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
221  extern template class PRMSlotChain< double >;
222 #endif
223 
224 
225  } /* namespace prm */
226 } // namespace gum
227 
229 
230 #endif /* GUM_SLOT_CHAIN_H */
PRMSlotChain & operator=(const PRMSlotChain &source)
Copy operator. Don&#39;t use it.
void __copyLastElt()
Copy the last element, this prevents unwanted DuplicateElement exceptions.
Header file of gum::Sequence, a class for storing (ordered) sequences of objects. ...
virtual void addParent(const PRMClassElement< GUM_SCALAR > &elt)
See gum::PRMClassElement<GUM_SCALAR>::_addParent().
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32
class for NoisyOR-net implementation as multiDim
Headers of the MultiDimBijArray class.
The generic class for storing (ordered) sequences of objects.
Definition: sequence.h:1019
class for multiDimNoisyORCompound
virtual PRMType & type()
This is similar to the following call: this->lastElt().type()
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
Inline implementation of gum::PRMSlotChain<GUM_SCALAR>
virtual PRMAttribute< GUM_SCALAR > * getCastDescendant() const
Raise a gum::OperationNotAllowed exception See gum::PRMClassElement<GUM_SCALAR>::getCastDescendant() ...
Header of the Potential class.
virtual const Potential< GUM_SCALAR > & cpf() const
This is similar to the following call: this->lastElt().cpf()
bool isMultiple() const
Return true if this slot chain contains at least one multiple reference slot.
PRMClassElementContainer< GUM_SCALAR > & end()
Returns the PRMClassElement<GUM_SCALAR>Container over which this slot chain ends. ...
Headers of gum::PRMAggregate.
Headers of Class.
Headers of gum::PRMClassElement.
Headers of gum::PRMAttribute.
bool __isMultiple
Flag indicating if this slot chain is multiple or not.
Definition: PRMSlotChain.h:210
PRMSlotChain(const std::string &name, const Sequence< PRMClassElement< GUM_SCALAR > * > &chain)
Default constructor.
virtual ~PRMSlotChain()
Destructor.
virtual PRMClassElement< GUM_SCALAR >::ClassElementType elt_type() const
See gum::PRMClassElement<GUM_SCALAR>::elt_type().
Sequence< PRMClassElement< GUM_SCALAR > *> * __chain
The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain.
Definition: PRMSlotChain.h:207
virtual void addChild(const PRMClassElement< GUM_SCALAR > &elt)
See gum::PRMClassElement<GUM_SCALAR>::_addChild().
PRMClassElement< GUM_SCALAR > & lastElt()
Returns the last element of the slot chain, typically this is an gum::PRMAttribute or a gum::PRMAggre...
Headers of gum::prm::PRMClassElementContainer.
Headers of gum::PRMClassElement.
Sequence< PRMClassElement< GUM_SCALAR > *> & chain()
Return the sequence representing the chain of elements in this PRMSlotChain.
ClassElementType
Returns true if obj_ptr is of type PRMReferenceSlot.