36 template <
typename GUM_SCALAR >
40 _setIOFlag(
get(flag.first), flag.second);
43 template <
typename GUM_SCALAR >
45 const std::string& name) :
50 template <
typename GUM_SCALAR >
55 template <
typename GUM_SCALAR >
62 template <
typename GUM_SCALAR >
68 "illegal call to ClassElementContainer copy constructor");
71 template <
typename GUM_SCALAR >
75 return _getIOFlag(elt).first;
76 }
catch (
NotFound&) {
return false; }
79 template <
typename GUM_SCALAR >
84 ": <" + elt.
safeName() +
"> is not in <" + name() +
">");
88 _getIOFlag(elt).first = b;
89 }
catch (
NotFound&) { _setIOFlag(elt, std::make_pair(b,
false)); }
92 "given id is not an PRMAttribute or an PRMAggregate");
96 template <
typename GUM_SCALAR >
104 _getIOFlag(elt).second = b;
105 }
catch (
NotFound&) { _setIOFlag(elt, std::make_pair(
false, b)); }
107 if (b) { _updateDescendants(elt); }
110 "given ClassElement<GUM_SCALAR> is not an " 111 "PRMAttribute or an PRMAggregate");
115 template <
typename GUM_SCALAR >
119 return !(_getIOFlag(elt).first || _getIOFlag(elt).second);
120 }
catch (
NotFound&) {
return true; }
123 template <
typename GUM_SCALAR >
129 template <
typename GUM_SCALAR >
130 INLINE std::pair< bool, bool >&
137 "this ClassElement<GUM_SCALAR> does not have any IO flags");
141 template <
typename GUM_SCALAR >
142 INLINE
const std::pair< bool, bool >&
149 "this ClassElement<GUM_SCALAR> does not have any IO flags");
153 template <
typename GUM_SCALAR >
156 const std::pair< bool, bool >& flags) {
162 template <
typename GUM_SCALAR >
164 return containerDag().
exists(
id);
167 template <
typename GUM_SCALAR >
169 const std::string& name)
const {
173 }
catch (
NotFound&) {
return false; }
176 template <
typename GUM_SCALAR >
180 return &elt == &(
get(elt.
safeName()));
181 }
catch (
NotFound&) {
return false; }
184 template <
typename GUM_SCALAR >
193 template <
typename GUM_SCALAR >
197 std::string tab =
" ";
198 output <<
"digraph \"" << container.
name() <<
"\" {" << std::endl;
200 for (
const auto node : container.
containerDag().nodes()) {
201 if (container.
containerDag().children(node).size() > 0) {
202 for (
const auto chi : container.
containerDag().children(node)) {
203 output << tab <<
"\"" << container.
get(node).name() <<
"\" -> " 204 <<
"\"" << container.
get(chi).name() <<
"\";" << std::endl;
206 }
else if (container.
containerDag().parents(node).size() == 0) {
207 output << tab <<
"\"" << container.
get(node).name() <<
"\";" << std::endl;
211 output <<
"}" << std::endl;
PRMClassElementContainer(const std::string &name)
Default constructor.
const std::string & name() const
Returns the name of this object.
Abstract class representing an element of PRM class.
virtual PRMClassElement< GUM_SCALAR > & get(const std::string &name)=0
Getter on a member of this PRMClassElementContainer.
virtual bool exists(const std::string &name) const
Returns true if a member with the given name exists in this PRMClassElementContainer or in the PRMCla...
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual void _copyIOFlags(const PRMClassElementContainer< GUM_SCALAR > &c)
Copy the IO Flags of c in this PRMClassElementContainer.
virtual bool isSubTypeOf(const PRMClassElementContainer< GUM_SCALAR > &cec) const =0
Test if this PRMClassElementContainer is a subtype of cec.
const std::string & safeName() const
Returns the safe name of this PRMClassElement, if any.
std::ostream & operator<<(std::ostream &output, const gum::prm::PRMClassElementContainer< GUM_SCALAR > &container)
An << operator for PRMClassElementContainer. Output in the graphviz-dot format.
HashTable< std::string, std::pair< bool, bool > > __IOFlags
input / output flags, useful when inheriting or copying.
Abstract base class for any element defined in a PRM.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
<agrum/PRM/classElementContainer.h>
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual const DAG & containerDag() const
Returns the gum::DAG of this PRMClassElementContainer.
Size NodeId
Type for node ids.
#define GUM_ERROR(type, msg)