Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78192 - in sandbox/icl/libs/xplore/br1/sqlbrowser: . Dag
From: afojgo_at_[hidden]
Date: 2012-04-25 12:36:31


Author: jofaber
Date: 2012-04-25 12:36:29 EDT (Wed, 25 Apr 2012)
New Revision: 78192
URL: http://svn.boost.org/trac/boost/changeset/78192

Log:
Started coding the Type-graph
Added:
   sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/ (props changed)
   sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/DbType.h (contents, props changed)
Text files modified:
   sandbox/icl/libs/xplore/br1/sqlbrowser/Dag.h | 17 +++++++++--------
   sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.cpp | 22 +++++++++++-----------
   sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.h | 2 +-
   sandbox/icl/libs/xplore/br1/sqlbrowser/sqlbrowser4.pro | 3 ++-
   4 files changed, 23 insertions(+), 21 deletions(-)

Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/Dag.h
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/Dag.h (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/Dag.h 2012-04-25 12:36:29 EDT (Wed, 25 Apr 2012)
@@ -11,6 +11,7 @@
 #include <boost/graph/graph_utility.hpp>
 
 #include "dagitem.h"
+#include "Dag/DbType.h"
 
 inline QString indentation(int depth)
 {
@@ -28,12 +29,12 @@
 // this class, to add more information to graph nodes.
 //
 // The contents of this class is associated to the graph using tags:
-// attribute_tag, boost::property<attribute_tag, NodeAttributes>
-class NodeAttributes
+// attribute_tag, boost::property<attribute_tag, VertexAttributes>
+class VertexAttributes
 {
 public:
- NodeAttributes(): m_nodeId(), m_name(), m_depth() {}
- NodeAttributes(const QString& name, int id): m_nodeId(id), m_name(name), m_depth(), p_dagItem() {}
+ VertexAttributes(): m_nodeId(), m_name(), m_depth() {}
+ VertexAttributes(const QString& name, int id): m_nodeId(id), m_name(name), m_depth(), p_dagItem() {}
 
     void setName(const QString& name) { m_name = name; }
     QString name()const { return m_name; }
@@ -86,7 +87,7 @@
              };
     }
 
- inline void copyBoostNode2DagItem(const NodeAttributes& src, tVariVector& target)//JODO cpp
+ inline void copyBoostNode2DagItem(const VertexAttributes& src, tVariVector& target)//JODO cpp
     {
         target[dag::node::posId] = QVariant(src.nodeId());
         target[dag::node::posName] = QVariant(src.name());
@@ -98,9 +99,9 @@
     // The kind of attribute_tag is a vertex_property_tag
     struct attribute_tag { typedef boost::vertex_property_tag kind; };
 
- // Here we associate a real type for content 'NodeAttributes' to the tag type
- // attribute_tag -> NodeAttributes
- typedef boost::property<attribute_tag, NodeAttributes> tAttributeTag;
+ // Here we associate a real type for content 'VertexAttributes' to the tag type
+ // attribute_tag -> VertexAttributes
+ typedef boost::property<attribute_tag, VertexAttributes> tAttributeTag;
 
     typedef boost::adjacency_list
     < boost::vecS

Added: sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/DbType.h
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/DbType.h 2012-04-25 12:36:29 EDT (Wed, 25 Apr 2012)
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+**
+****************************************************************************/
+
+#pragma once
+
+//std
+#include <bitset>
+//boost
+#include <boost/scoped_ptr.hpp>
+//qt
+#include <QtCore/QVariant>
+#include <QtCore/QVector>
+
+namespace dag { namespace db
+{
+
+typedef unsigned int tKey;
+typedef QVector<tKey> tKeySequence;
+typedef QVector<QVariant> tVariVector;
+typedef QString tString;
+
+
+
+//==============================================================================
+//= dag::db::Types
+//==============================================================================
+
+
+class TypeTraits
+{
+public:
+ static const int ciMaxBitCount = 64;
+ typedef std::bitset<ciMaxBitCount> tTraitSet;
+private:
+ tTraitSet m_aTraitSet;
+};
+
+bool isBuiltIn(const TypeTraits& aTraits);
+bool isAtom(const TypeTraits& aTraits);
+bool isComposite(const TypeTraits& aTraits);
+
+
+
+//! TypeSignature: The sequence of Types of an Objects
+//! Fields. The fields that contain all 1:1 Relationships
+//! that an object has in a given model.
+class TypeSignature
+{
+public:
+private:
+ tKeySequence m_aTypeSequence;
+};
+
+//! FieldSignature: The sequence of Fields of an Object.
+class FieldSignature
+{
+public:
+private:
+ tKeySequence m_aFieldSequence;
+};
+
+
+//Don't optimize premature: Clearness first!!
+//I have to prepare and build the TypeGraph first.
+//
+
+class ObjectType
+{
+public:
+private:
+ tKey m_uKey;
+ TypeTraits m_aTraits;
+ tString m_aName;
+ TypeSignature m_aTypeSeq;
+ FieldSignature m_aFieldSeq;
+};
+
+typedef boost::scoped_ptr<ObjectType> tObjectTypeUniPtr;
+typedef ObjectType* tObjectTypeRawPtr;
+typedef const ObjectType* tConstObjectTypeRawPtr;
+
+
+class EdgeType
+{
+public:
+private:
+ tKey m_uKey;
+ tString m_aName;
+ tObjectTypeUniPtr m_pSourceType;
+ tObjectTypeUniPtr m_pRelationType;
+ tObjectTypeUniPtr m_pTargetType;
+};
+
+
+//==============================================================================
+//= dag::db::Objects
+//==============================================================================
+
+//!
+template<class Type>
+class Object
+{
+public:
+ Object(Type aType): m_aType(aType){};
+private:
+ Type m_aType;
+ tVariVector m_aValue;
+};
+
+}} //namespace dag { namespace db
+
+
+

Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.cpp
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.cpp (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.cpp 2012-04-25 12:36:29 EDT (Wed, 25 Apr 2012)
@@ -140,8 +140,8 @@
     if(!(source==0 && target==0))
     {
         boost::add_edge(source, target, m_dag);
- m_nodeAttributes[source] = NodeAttributes(edgeData[m_parentName].toString(), source);
- m_nodeAttributes[target] = NodeAttributes(edgeData[m_childName].toString(), target);
+ m_aVertexAttributes[source] = VertexAttributes(edgeData[m_parentName].toString(), source);
+ m_aVertexAttributes[target] = VertexAttributes(edgeData[m_childName].toString(), target);
     }
 }
 
@@ -317,9 +317,9 @@
     boost::depth_first_search(
         m_dag
       , boost::visitor(make_dfs_visitor(boost::make_list(
- CreatorVisitor::OnDiscoverVertex(m_rootItem, &dagAsString, m_nodeAttributes)
- , CreatorVisitor::OnExamineEdge (m_rootItem, &dagAsString, m_nodeAttributes)
- , CreatorVisitor::OnFinishVertex (m_rootItem, &dagAsString, m_nodeAttributes)
+ CreatorVisitor::OnDiscoverVertex(m_rootItem, &dagAsString, m_aVertexAttributes)
+ , CreatorVisitor::OnExamineEdge (m_rootItem, &dagAsString, m_aVertexAttributes)
+ , CreatorVisitor::OnFinishVertex (m_rootItem, &dagAsString, m_aVertexAttributes)
                                             )
                       ))
     );
@@ -367,7 +367,7 @@
 {
     m_dag.clear();
 
- m_nodeAttributes = get(Dag::attribute_tag(), m_dag);
+ m_aVertexAttributes = get(Dag::attribute_tag(), m_dag);
 
     for(tEdgeList::iterator iter = m_edges.begin(); iter != m_edges.end(); iter++)
     {
@@ -376,8 +376,8 @@
         if(!(source==0 && target==0))
         {
             boost::add_edge(source, target, m_dag);
- m_nodeAttributes[source] = NodeAttributes((*iter)[m_parentName].toString(), source);
- m_nodeAttributes[target] = NodeAttributes((*iter)[m_childName].toString(), target);
+ m_aVertexAttributes[source] = VertexAttributes((*iter)[m_parentName].toString(), source);
+ m_aVertexAttributes[target] = VertexAttributes((*iter)[m_childName].toString(), target);
         }
     }
 }
@@ -389,9 +389,9 @@
     boost::depth_first_search(
         m_dag
       , boost::visitor(make_dfs_visitor(boost::make_list(
- StringVisitor::OnDiscoverVertex(&dagAsString, m_nodeAttributes)
- , StringVisitor::OnExamineEdge(&dagAsString, m_nodeAttributes, m_parentMap)
- , StringVisitor::OnFinishVertex(&dagAsString, m_nodeAttributes)
+ StringVisitor::OnDiscoverVertex(&dagAsString, m_aVertexAttributes)
+ , StringVisitor::OnExamineEdge(&dagAsString, m_aVertexAttributes, m_parentMap)
+ , StringVisitor::OnFinishVertex(&dagAsString, m_aVertexAttributes)
                                             //, boost::record_predecessors(parentMap.begin(), boost::on_tree_edge())
                                             )
                       ))

Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.h
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.h (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.h 2012-04-25 12:36:29 EDT (Wed, 25 Apr 2012)
@@ -129,7 +129,7 @@
     //==========================================================================
     // Graph
     Dag::type m_dag;
- Dag::tAttributesMap m_nodeAttributes;
+ Dag::tAttributesMap m_aVertexAttributes;
     Dag::tParentMap m_parentMap;
 };
 

Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/sqlbrowser4.pro
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/sqlbrowser4.pro (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/sqlbrowser4.pro 2012-04-25 12:36:29 EDT (Wed, 25 Apr 2012)
@@ -13,7 +13,8 @@
     dagmodel.h \
     StringVisitor.h \
     Dag.h \
- CreatorVisitor.h
+ CreatorVisitor.h \
+ Dag/DbType.h
 SOURCES = main.cpp browser.cpp connectionwidget.cpp qsqlconnectiondialog.cpp \
     exttableview.cpp \
     dagitem.cpp \


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