0的递增序列 ListN-ux//DAG中到下面级别的#x链接序列 ListN u//DAG中到下面级别的#x-1链接序列 友元布尔运算符==(常数节点&X1,常数节点&X2) { 返回X1.x==X2.x&&X1.ux==X2.ux&&X1.u==X2.u; }; }; 模板 使用叶子=向量; //typedef向量叶//DAG中级别0处的节点集 模板 使用节点=向量; //typedef向量节点//DAG中给定级别上的节点集 模板 类DAG { 受保护的: Leaves leaf;//级别为0的非空节点集,如果#leaf=0,则G为空 vectorNodes;//节点[l]级别l上的非空节点集+ //回忆录 载体C; //C[l][j][i]在l级对i和j进行比较,i,class,uml,diagram,class-diagram,Class,Uml,Diagram,Class Diagram" /> 0的递增序列 ListN-ux//DAG中到下面级别的#x链接序列 ListN u//DAG中到下面级别的#x-1链接序列 友元布尔运算符==(常数节点&X1,常数节点&X2) { 返回X1.x==X2.x&&X1.ux==X2.ux&&X1.u==X2.u; }; }; 模板 使用叶子=向量; //typedef向量叶//DAG中级别0处的节点集 模板 使用节点=向量; //typedef向量节点//DAG中给定级别上的节点集 模板 类DAG { 受保护的: Leaves leaf;//级别为0的非空节点集,如果#leaf=0,则G为空 vectorNodes;//节点[l]级别l上的非空节点集+ //回忆录 载体C; //C[l][j][i]在l级对i和j进行比较,i,class,uml,diagram,class-diagram,Class,Uml,Diagram,Class Diagram" />

Class 带有typedef的uml模板类图 我试图从C++代码开始创建类图。我遇到了麻烦,因为我找不到关于如何表示代码中的内容的标准规则。这是我的。 编辑:扩展的.h文件 #ifndef TYPES_H_INCLUDED #define TYPES_H_INCLUDED #include <vector> using namespace std; //natural numbers typedef unsigned int N; //lattice c_no<c_lt,c_gt<c_eq of comparison results in a PO typedef char CMP; //intervals [l,u] in R with l<=u, with inclusion order template <typename R> struct IR { R l, u; IR() {}; IR(R,R); }; //unions of intervals (increasing sequence of disjoint intervals) template <typename R> struct U_IR { vector<IR <R> > S; U_IR() {}; }; //points in R^d with d>0, with pointwise order template <typename R> struct PR { vector<R> x; PR(N d){ x=vector<R>(d);}; }; //boxes in R^d with d>0, with inclusion order template <typename R> struct BR { vector<IR <R> > x; BR(N d){ x=vector<IR <R> >(d);}; }; //U_BR unions of boxes in Number^d, see UBR.h #include "IR.tpp" #include "UIR.tpp" #include "basic.tpp" #include "BR.tpp" #endif// TYPES_H_INCLUDED #如果包含NDEF类型# #定义包含的类型 #包括 使用名称空间std; //自然数 typedef无符号整数N; //晶格c_-nox//R中大小为#x>0的递增序列 ListN-ux//DAG中到下面级别的#x链接序列 ListN u//DAG中到下面级别的#x-1链接序列 友元布尔运算符==(常数节点&X1,常数节点&X2) { 返回X1.x==X2.x&&X1.ux==X2.ux&&X1.u==X2.u; }; }; 模板 使用叶子=向量; //typedef向量叶//DAG中级别0处的节点集 模板 使用节点=向量; //typedef向量节点//DAG中给定级别上的节点集 模板 类DAG { 受保护的: Leaves leaf;//级别为0的非空节点集,如果#leaf=0,则G为空 vectorNodes;//节点[l]级别l上的非空节点集+ //回忆录 载体C; //C[l][j][i]在l级对i和j进行比较,i

Class 带有typedef的uml模板类图 我试图从C++代码开始创建类图。我遇到了麻烦,因为我找不到关于如何表示代码中的内容的标准规则。这是我的。 编辑:扩展的.h文件 #ifndef TYPES_H_INCLUDED #define TYPES_H_INCLUDED #include <vector> using namespace std; //natural numbers typedef unsigned int N; //lattice c_no<c_lt,c_gt<c_eq of comparison results in a PO typedef char CMP; //intervals [l,u] in R with l<=u, with inclusion order template <typename R> struct IR { R l, u; IR() {}; IR(R,R); }; //unions of intervals (increasing sequence of disjoint intervals) template <typename R> struct U_IR { vector<IR <R> > S; U_IR() {}; }; //points in R^d with d>0, with pointwise order template <typename R> struct PR { vector<R> x; PR(N d){ x=vector<R>(d);}; }; //boxes in R^d with d>0, with inclusion order template <typename R> struct BR { vector<IR <R> > x; BR(N d){ x=vector<IR <R> >(d);}; }; //U_BR unions of boxes in Number^d, see UBR.h #include "IR.tpp" #include "UIR.tpp" #include "basic.tpp" #include "BR.tpp" #endif// TYPES_H_INCLUDED #如果包含NDEF类型# #定义包含的类型 #包括 使用名称空间std; //自然数 typedef无符号整数N; //晶格c_-nox//R中大小为#x>0的递增序列 ListN-ux//DAG中到下面级别的#x链接序列 ListN u//DAG中到下面级别的#x-1链接序列 友元布尔运算符==(常数节点&X1,常数节点&X2) { 返回X1.x==X2.x&&X1.ux==X2.ux&&X1.u==X2.u; }; }; 模板 使用叶子=向量; //typedef向量叶//DAG中级别0处的节点集 模板 使用节点=向量; //typedef向量节点//DAG中给定级别上的节点集 模板 类DAG { 受保护的: Leaves leaf;//级别为0的非空节点集,如果#leaf=0,则G为空 vectorNodes;//节点[l]级别l上的非空节点集+ //回忆录 载体C; //C[l][j][i]在l级对i和j进行比较,i,class,uml,diagram,class-diagram,Class,Uml,Diagram,Class Diagram,这是由我的UML工具自动生成的UML图: 我没有深入阅读您的用例,因此您可能希望添加其他依赖关系(根据需要使用适当的原型«use»/«bind»)为了给图表的读者澄清更多的事情。typedef通常表示为特殊的原型,因为UML 2标准。模板选项要么保留通用参数,要么与这些参数的规范一致。所以在我的例子中,我如何表示typedef的typedef?我指的是图形化的@πάνταῥεῖ可能会很好,是的。如果图形表示看起来代表了这种情况。无法判断代码生成是否正确。可能有点取决于工具。我仍然拥有企业架构师

这是由我的UML工具自动生成的UML图:


我没有深入阅读您的用例,因此您可能希望添加其他依赖关系(根据需要使用适当的原型«use»/«bind»)为了给图表的读者澄清更多的事情。

typedef通常表示为特殊的原型,因为UML 2标准。模板选项要么保留通用参数,要么与这些参数的规范一致。所以在我的例子中,我如何表示typedef的typedef?我指的是图形化的@πάνταῥεῖ可能会很好,是的。如果图形表示看起来代表了这种情况。无法判断代码生成是否正确。可能有点取决于工具。我仍然拥有企业架构师,可能会尝试导入您的代码,如果您希望我这样做,工具会如何处理它。(可能需要一些时间,因为我的笔记本电脑有点跛)可能有助于您自己尝试一下。非常感谢!但是正如您所看到的,没有提到使用using而不是typedef定义的类型。可能是因为模板(我无法模板化typedef),我需要使用“using”EA不认识这种构造。我会像描述普通类型定义一样来描述它。@cristina是的,当然。我提到过你可以添加更多的关系或中间类型(def)实例化以澄清您的意图。我通常知道这个问题,因为我有时也倾向于先编写工作代码,然后在UML中记录。我总是需要调整UML工具从代码中导入的内容,以添加一些半熟练的同事可以理解的附加信息。他正在使用名称空间std;这是我想应该是一个
#ifndef DAG_H_INCLUDED
#define DAG_H_INCLUDED

#include <fstream>
#include "types.h"

using namespace std;

template <typename R>
using Leaf=U_IR<R>; 
//typedef U_IR<R> Leaf;//non-empty leaf in DAG

typedef vector<N> ListN;

template <typename R> 
struct Node//non-empty node in DAG
{
    vector < R > x; //incresing sequence in R of size #x>0
    ListN ux;//sequences of #x links to level below in DAG
    ListN u; //sequences of #x-1 links to level below in DAG
    friend bool operator==(const Node<R>&X1, const Node<R>&X2)
    {
        return X1.x==X2.x &&X1.ux==X2.ux &&X1.u==X2.u;
    };
};

template <typename R>
using Leaves=vector < Leaf<R> >;
//typedef vector < Leaf<R> > Leaves;//set of nodes at level 0 in DAG

template <typename R> 
using Nodes=vector<Node <R> >;
//typedef vector < Node<R> > Nodes;//set of nodes at a given level in DAG

template <typename R> 
class DAG
{
protected:
    Leaves<R> leaf;  //set of non-empty nodes at level 0, G empty if #leaf=0
    vector < Nodes<R> > nodes;//nodes[l] set of non-empty nodes at level l+
    //memoization
    vector<vector <vector <CMP> > > C;
    //C[l][j][i] comparison of i and j at level l, with i<j ('?' if not computed yet)
    vector<vector <vector <N> > > U;
    //U[l][j][i] result of union of i and j  at level l, with i<j (0 if not computed yet)
    N add_leaf(const Leaf<R>&);//prevent duplication
    N add_node(const Node<R>&, N l);//prevent duplication
    bool cover(const BR<R>&,ListN&,N l) const;
    bool cover(R,R,const Node<R>&,ListN&) const;
    CMP cmp(N,N,N l);//comparison of nodes at level l
    void cmp(const Node<R> &, const Node<R> &, CMP &, N l);
    N make(const BR<R>&,N l);//make at level l
    N sum(N,N,N l);//union of nodes at level l
    Node<R> sum(const Node<R> & X1, const Node<R> & X2, N l);
public:
    DAG(N d);//dimension d>0
    void print() const;//print DAG (for debug purposes)
    void print_test(ostream &cout) const;//print for testing
    void print2(N) const;//print subsets of the plane with integer bounds
    N dim() const;
    N empty() const;
    bool cover(const BR<R>&,N) const;
    CMP cmp(N,N);
    N make(const BR<R>&);
    N sum(N,N);
};

#include "DAG.tpp"
#include "DAG-sum.tpp"
#include "DAG-cover.tpp"
#include "DAG-make.tpp"
#include "DAG-cmp.tpp"


#endif  // DAG_H_INCLUDED