aGrUM  0.16.0
PRMClassElementContainer_tpl.h File Reference

Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr. More...

+ Include dependency graph for PRMClassElementContainer_tpl.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 gum
 Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
 
 gum::prm
 namespace for all probabilistic relational models entities
 

Functions

template<typename GUM_SCALAR >
std::ostream & operator<< (std::ostream &output, const gum::prm::PRMClassElementContainer< GUM_SCALAR > &container)
 An << operator for PRMClassElementContainer. Output in the graphviz-dot format. More...
 

Detailed Description

Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.

This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library. If not, see http://www.gnu.org/licenses/.

Inline implementation of gum::PRMClassElementContainer

Author
Lionel TORTI and Pierre-Henri WUILLEMIN

Definition in file PRMClassElementContainer_tpl.h.

Function Documentation

◆ operator<<()

template<typename GUM_SCALAR >
std::ostream& operator<< ( std::ostream &  output,
const gum::prm::PRMClassElementContainer< GUM_SCALAR > &  container 
)

An << operator for PRMClassElementContainer. Output in the graphviz-dot format.

Definition at line 195 of file PRMClassElementContainer_tpl.h.

References gum::prm::PRMClassElementContainer< GUM_SCALAR >::containerDag(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::get(), and gum::prm::PRMObject::name().

196  {
197  std::string tab = " ";
198  output << "digraph \"" << container.name() << "\" {" << std::endl;
199 
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;
205  }
206  } else if (container.containerDag().parents(node).size() == 0) {
207  output << tab << "\"" << container.get(node).name() << "\";" << std::endl;
208  }
209  }
210 
211  output << "}" << std::endl;
212  return output;
213 }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:35
virtual PRMClassElement< GUM_SCALAR > & get(const std::string &name)=0
Getter on a member of this PRMClassElementContainer.
virtual const DAG & containerDag() const
Returns the gum::DAG of this PRMClassElementContainer.
+ Here is the call graph for this function: