Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78209 - in sandbox/icl/libs/xplore/br1/sqlbrowser: . Dag
From: afojgo_at_[hidden]
Date: 2012-04-26 12:27:44


Author: jofaber
Date: 2012-04-26 12:27:39 EDT (Thu, 26 Apr 2012)
New Revision: 78209
URL: http://svn.boost.org/trac/boost/changeset/78209

Log:
Coding type graph.
Added:
   sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/DbType.cpp (contents, props changed)
Text files modified:
   sandbox/icl/libs/xplore/br1/sqlbrowser/Dag.h | 7 +++++
   sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/DbType.h | 43 +++++++++++++++++++++++++++------------
   sandbox/icl/libs/xplore/br1/sqlbrowser/sqlbrowser4.pro | 3 +
   3 files changed, 38 insertions(+), 15 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-26 12:27:39 EDT (Thu, 26 Apr 2012)
@@ -56,7 +56,12 @@
 private:
     int m_nodeId;
     QString m_name;
- int m_depth;
+ int m_depth;
+
+ //---- Db::Object associated to the Vertex ---------------------------------
+ //JODO dag::db::tObjectUniPtr m_pObject;
+
+ //---- DagModel ------------------------------------------------------------
     DagItem* p_dagItem;
     DagItem* p_parentItem;
 };

Added: sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/DbType.cpp
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/DbType.cpp 2012-04-26 12:27:39 EDT (Thu, 26 Apr 2012)
@@ -0,0 +1,109 @@
+#include "Dag/DbType.h"
+
+using namespace dag::db;
+
+
+
+class TypeTraits
+{
+public:
+ static const int ciMaxBitCount = 64;
+ typedef std::bitset<ciMaxBitCount> tTraitSet;
+private:
+ tTraitSet m_aTraitSet;
+};
+
+
+bool dag::db::isBuiltIn(const TypeTraits& aTraits);
+bool dag::db::isAtom(const TypeTraits& aTraits);
+bool isComposite(const TypeTraits& aTraits);
+
+
+
+
+/*
+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
+//==============================================================================
+
+
+
+//! dag::db::Object is a fairly general and thus boring object.
+//! It has a db::Type which determines the flat type of data record m_aValue.
+template<class Type>
+class Object
+{
+public:
+ Object(): m_aType(){};
+ explicit Object(Type aType): m_aType(aType){};
+private:
+ Type m_aType;
+ tVariVector m_aValue;
+};
+
+typedef boost::scoped_ptr<Object> tObjectUniPtr;
+typedef Object* tObjectRawPtr;
+typedef const Object* tObjectConstRawPtr;
+
+*/
+
+}} //namespace dag { namespace db
+
+
+

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-04-26 12:27:39 EDT (Thu, 26 Apr 2012)
@@ -27,21 +27,26 @@
 //= dag::db::Types
 //==============================================================================
 
-
-class TypeTraits
+template<unsigned int ciMaxBitCount = 64>
+class TypeTraits : public std::bitset<ciMaxBitCount>
 {
 public:
- static const int ciMaxBitCount = 64;
- typedef std::bitset<ciMaxBitCount> tTraitSet;
-private:
- tTraitSet m_aTraitSet;
-};
+ enum
+ {
+ eDefined = 0 //Bit 0: 0:undefined 1:defined
+ , eComposed //Bit 0: 0:atomic 1:composite
+ , eRelation //Bit 1: 0:object 1:relation
+ , eAddedType //Bit 2: 0:built_in 1:added_type
+ , eTraits_count
+ };
 
-bool isBuiltIn(const TypeTraits& aTraits);
-bool isAtom(const TypeTraits& aTraits);
-bool isComposite(const TypeTraits& aTraits);
+ typedef std::bitset<ciMaxBitCount> tTraitSet;
 
+ TypeTraits(): tTraitSet(){};
+ TypeTraits(unsigned long bits): tTraitSet(bits){};
+};
 
+typedef TypeTraits<> tTypeTraits;
 
 //! TypeSignature: The sequence of Types of an Objects
 //! Fields. The fields that contain all 1:1 Relationships
@@ -71,7 +76,7 @@
 public:
 private:
     tKey m_uKey;
- TypeTraits m_aTraits;
+ TypeTraits<> m_aTraits;
     tString m_aName;
     TypeSignature m_aTypeSeq;
     FieldSignature m_aFieldSeq;
@@ -98,17 +103,29 @@
 //= dag::db::Objects
 //==============================================================================
 
-//!
+
+
+//! dag::db::Object is a fairly general and thus boring object.
+//! It has a db::Type which determines the flat type of data record m_aValue.
 template<class Type>
 class Object
 {
 public:
- Object(Type aType): m_aType(aType){};
+ typedef Type tType;
+ Object(): m_aType(){};
+ explicit Object(Type aType): m_aType(aType){};
 private:
     Type m_aType;
     tVariVector m_aValue;
 };
 
+typedef Object<ObjectType> tObject;
+typedef boost::scoped_ptr<tObject> tObjectUniPtr;
+typedef tObject* tObjectRawPtr;
+typedef const tObject* tObjectConstRawPtr;
+
+
+
 }} //namespace dag { namespace db
 
 

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-26 12:27:39 EDT (Thu, 26 Apr 2012)
@@ -14,7 +14,8 @@
     StringVisitor.h \
     Dag.h \
     CreatorVisitor.h \
- Dag/DbType.h
+ Dag/DbType.h \
+ Dag/DbType.cpp
 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