1
//------------------------------------------------------------------------------
3
// This file is part of Toolkit for Conceptual Modeling (TCM).
4
// (c) copyright 1997, Vrije Universiteit Amsterdam.
5
// Author: Frank Dehne (frank@cs.vu.nl).
7
// TCM is free software; you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License as published by
9
// the Free Software Foundation; either version 2 of the License, or
10
// (at your option) any later version.
12
// TCM is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
// You should have received a copy of the GNU General Public License
18
// along with TCM; if not, write to the Free Software
19
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21
//-----------------------------------------------------------------------------
22
#ifndef _DIAGRAMCHECKS_H
23
#define _DIAGRAMCHECKS_H
31
/// implements generic checks for soft constraints on diagrams.
33
/*@Doc: {\large {\bf scope:} diagram} */
36
DiagramChecks(Diagram *d, Graph *g);
38
// Error messages are appended to chkbuf. The functions return the
39
// number of errors found.
41
/// diagram should have count nodes of nodeType.
42
unsigned CheckNodeCount(unsigned count, int nodeType, string &chkbuf);
44
/// diagram should have min <= count <= max nodes of nodeType.
45
unsigned CheckNodeCount(unsigned min, unsigned max,
46
int nodeType, string &chkbuf);
48
/// diagram should have count edges of edgeType
49
unsigned CheckEdgeCount(unsigned count, int edgeType, string &chkbuf);
51
/// diagram should have min <= count <= max edges of edgeType.
52
unsigned CheckEdgeCount(unsigned min, unsigned max,
53
int edgeType, string &chkbuf);
55
/// check that nodes unique indexes.
56
unsigned CheckDoubleIndexes(string &chkbuf);
58
/// diagram should have no nameless nodes of nodeType
59
unsigned CheckNamelessNodes(int nodeType, string &chkbuf);
61
/// diagram should have no nameless edges of edgeType
62
unsigned CheckNamelessEdges(int edgeType, string &chkbuf);
64
/// diagram should have no nodes of nodeType named 'name'.
65
unsigned CheckIllegalNodeNames(int nodeType, const string *name,
68
/// diagram should have no edges of edgeType named 'name'.
69
unsigned CheckIllegalEdgeNames(int edgeType, const string *name,
72
/// diagram should have no nameless edges of edgeType between types.
73
unsigned CheckNamelessEdges(
74
int edgeType, int type1, int type2, string &chkbuf);
76
/// diagram shouldn't have double nameless edges between these types.
77
unsigned CheckDoubleNamelessEdges(int edgeType, int type1,
78
int type2, string &chkbuf);
80
/// diagram should not have multiple nodes of nodeType with same name.
81
unsigned CheckDoubleNodes(int nodeType, string &chkbuf);
83
/// nodeType nodes should be connected (index: name or index in msg)
84
unsigned CheckConnected(int nodeType, bool index, string &chkbuf);
86
/// nodeType nodes should be connected (index: name or index in msg)
87
unsigned CheckConnected(int nodeType, int toNode, int min, int max,
88
bool index, string &chkbuf);
90
/// nodes of nodeType connected by 1 parent edge and minChildren edges.
91
unsigned CheckJunctionCoherence(int nodeType, int parenttype,
92
int childtype, unsigned minChildren, string &chkbuf);
94
/// nodes of nodeType should have min/max departing edges of edgeType.
95
unsigned CheckCountEdgesFrom(int nodeType, int edgeType, unsigned min,
96
unsigned max, bool zeroAllowed, bool index,
99
/// nodes of nodeType are reachable from >= 1 nodes of rootType.
100
unsigned CheckReachability(int rootType, int nodeType,
101
bool index, string &chkbuf);
105
Graph *GetGraph() const {return graph;}
107
Diagram *GetDiagram() const {return diagram;}
109
unsigned CheckCount(unsigned min, unsigned max, int type,
110
string &chkbuf, bool node);
112
unsigned CheckIllegalNames(int type, const string *name,
113
string &chkbuf, bool node);