Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79803 - in sandbox/icl/libs/xplore/br1/sqlbrowser: . Dag data/qsql
From: afojgo_at_[hidden]
Date: 2012-07-30 12:33:11


Author: jofaber
Date: 2012-07-30 12:33:10 EDT (Mon, 30 Jul 2012)
New Revision: 79803
URL: http://svn.boost.org/trac/boost/changeset/79803

Log:
Adapting visitor for dag representation.
Text files modified:
   sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/DbType.h | 11 ++++++++---
   sandbox/icl/libs/xplore/br1/sqlbrowser/StringVisitor2.h | 12 +++++++-----
   sandbox/icl/libs/xplore/br1/sqlbrowser/data/qsql/QSqlCreator.h | 6 ++++--
   3 files changed, 19 insertions(+), 10 deletions(-)

Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/DbType.h
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/DbType.h (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/DbType.h 2012-07-30 12:33:10 EDT (Mon, 30 Jul 2012)
@@ -150,6 +150,7 @@
 
     tKey sourceKey()const { return m_iRefSourceType; }
     tKey targetKey()const { return m_iRefTargetType; }
+ QString typeName()const { return m_aName; }
 
 private:
     tKey m_iKey;
@@ -212,26 +213,30 @@
 
     Edge(): m_key(), m_refEdgeType(), m_refSourceVertex(), m_refTargetVertex(){};
 
- explicit Edge(tKey key, tKey refEdgeType, tKey sourceKey, tKey targetKey)
+ explicit Edge(tKey key, tKey refEdgeType, tKey sourceKey, tKey targetKey, QString typeName)
         : m_key(key), m_refEdgeType(refEdgeType)
- , m_refSourceVertex(sourceKey), m_refTargetVertex(targetKey){};
+ , m_refSourceVertex(sourceKey), m_refTargetVertex(targetKey)
+ , m_edgeTypeName(typeName)
+ {};
 
     tKey key()const { m_key; }
     tKey refEdgeType()const { return m_refEdgeType; }
     tKey refSourceVertex()const { return m_refSourceVertex; }
     tKey refTargetVertex()const { return m_refTargetVertex; }
+ QString typeName()const { return m_edgeTypeName; }
 
     tKey sourceKey()const { return m_refSourceVertex; }
     tKey targetKey()const { return m_refTargetVertex; }
 
     QString toString()const
- { return QString("Edge(%1,..)").arg(m_key); }
+ { return QString("Edge(%1,%2..)").arg(m_key).arg(m_refEdgeType); }
 
 private:
     tKey m_key;
     tKey m_refEdgeType;
     tKey m_refSourceVertex;
     tKey m_refTargetVertex;
+ QString m_edgeTypeName;
     //JODO Object m_object; //The object that is referec my m_key.
 };
 

Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/StringVisitor2.h
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/StringVisitor2.h (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/StringVisitor2.h 2012-07-30 12:33:10 EDT (Mon, 30 Jul 2012)
@@ -31,10 +31,11 @@
 
         template<class Vertex, class Graph>
         void operator()(Vertex node, Graph& graph)
- {
- if(boost::out_degree(node, graph) > 0)
- {
- *p_result += indentation(depth(node)) + "(";
+ { //MEMO degree == node count
+ if(boost::out_degree(node, graph) > 0) //MEMO out_degree(node, graph) == outgoing node count
+ { //MEMO in_degree(node, graph) == ingoing node count | only for BiDiectionalGraph
+ *p_result += indentation(depth(node))
+ + "(" + QString("%1 ").arg(boost::out_degree(node, graph));
                 *p_result += graph[node].name();
                 *p_result += "\n";
             }
@@ -75,7 +76,8 @@
 
             if(boost::out_degree(target(edge, graph), graph)==0)
             {
- *p_result += indentation(target_depth) + graph[target(edge, graph)].name();
+ *p_result += indentation(target_depth) + "(0 " + graph[target(edge, graph)].name() + ")"
+ + graph[edge].typeName();
                 *p_result += "\n";
             }
         }

Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/data/qsql/QSqlCreator.h
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/data/qsql/QSqlCreator.h (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/data/qsql/QSqlCreator.h 2012-07-30 12:33:10 EDT (Mon, 30 Jul 2012)
@@ -103,7 +103,7 @@
 class QSqlCreator<dag::db::Edge, QSqlSelector>
 {
 public:
- enum { e_key=0, e_refEdgeType, e_refSourceVertex, e_refTargetVertex };
+ enum { e_key=0, e_refEdgeType, e_refSourceVertex, e_refTargetVertex, e_edgeTypeName };
 
     typedef QSqlCreator type;
     typedef dag::db::Edge tObject;
@@ -115,7 +115,8 @@
     static SqlQuery::tRepr createQuery()
     {
         return
- "select Edge.key, Edge.refEdgeType, Edge.refSourceVertex, Edge.refTargetVertex from Edge ";
+ "select Edge.key, Edge.refEdgeType, Edge.refSourceVertex, Edge.refTargetVertex, EdgeType.name from Edge "
+ " left outer join EdgeType on Edge.refEdgeType = EdgeType.key " ;
     }
 
     static tObject create(const_iterator it)
@@ -124,6 +125,7 @@
                              ,(*it).field(e_refEdgeType).value().toInt()
                              ,(*it).field(e_refSourceVertex).value().toInt()
                              ,(*it).field(e_refTargetVertex).value().toInt()
+ ,(*it).field(e_edgeTypeName).value().toString()
                             );
     }
 };


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk