33 template <
typename GUM_SCALAR >
37 _setIOFlag(
get(flag.first), flag.second);
40 template <
typename GUM_SCALAR >
42 const std::string& name) :
47 template <
typename GUM_SCALAR >
52 template <
typename GUM_SCALAR >
59 template <
typename GUM_SCALAR >
65 "illegal call to ClassElementContainer copy constructor");
68 template <
typename GUM_SCALAR >
72 return _getIOFlag(elt).first;
73 }
catch (
NotFound&) {
return false; }
76 template <
typename GUM_SCALAR >
81 ": <" + elt.
safeName() +
"> is not in <" + name() +
">");
85 _getIOFlag(elt).first = b;
86 }
catch (
NotFound&) { _setIOFlag(elt, std::make_pair(b,
false)); }
89 "given id is not an PRMAttribute or an PRMAggregate");
93 template <
typename GUM_SCALAR >
101 _getIOFlag(elt).second = b;
102 }
catch (
NotFound&) { _setIOFlag(elt, std::make_pair(
false, b)); }
104 if (b) { _updateDescendants(elt); }
107 "given ClassElement<GUM_SCALAR> is not an " 108 "PRMAttribute or an PRMAggregate");
112 template <
typename GUM_SCALAR >
116 return !(_getIOFlag(elt).first || _getIOFlag(elt).second);
117 }
catch (
NotFound&) {
return true; }
120 template <
typename GUM_SCALAR >
126 template <
typename GUM_SCALAR >
127 INLINE std::pair< bool, bool >&
134 "this ClassElement<GUM_SCALAR> does not have any IO flags");
138 template <
typename GUM_SCALAR >
139 INLINE
const std::pair< bool, bool >&
146 "this ClassElement<GUM_SCALAR> does not have any IO flags");
150 template <
typename GUM_SCALAR >
153 const std::pair< bool, bool >& flags) {
159 template <
typename GUM_SCALAR >
161 return containerDag().
exists(
id);
164 template <
typename GUM_SCALAR >
166 const std::string& name)
const {
170 }
catch (
NotFound&) {
return false; }
173 template <
typename GUM_SCALAR >
177 return &elt == &(
get(elt.
safeName()));
178 }
catch (
NotFound&) {
return false; }
181 template <
typename GUM_SCALAR >
190 template <
typename GUM_SCALAR >
194 std::string tab =
" ";
195 output <<
"digraph \"" << container.
name() <<
"\" {" << std::endl;
197 for (
const auto node : container.
containerDag().nodes()) {
198 if (container.
containerDag().children(node).size() > 0) {
199 for (
const auto chi : container.
containerDag().children(node)) {
200 output << tab <<
"\"" << container.
get(node).name() <<
"\" -> " 201 <<
"\"" << container.
get(chi).name() <<
"\";" << std::endl;
203 }
else if (container.
containerDag().parents(node).size() == 0) {
204 output << tab <<
"\"" << container.
get(node).name() <<
"\";" << std::endl;
208 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...
gum is the global namespace for all aGrUM entities
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.
Headers of gum::PRMClassElement.
<agrum/PRM/classElementContainer.h>
Headers of gum::prm::PRMClassElementContainer.
virtual const DAG & containerDag() const
Returns the gum::DAG of this PRMClassElementContainer.
Size NodeId
Type for node ids.
#define GUM_ERROR(type, msg)