Debian Codegraph @

Kernel/dumpInterface.h

raw symbols SCIP
1 /* This file is part of the FaCT++ DL reasoner
2 Copyright (C) 2003-2015 Dmitry Tsarkov and The University of Manchester
3 Copyright (C) 2015-2017 Dmitry Tsarkov
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #ifndef DUMPINTERFACE_H
21 #define DUMPINTERFACE_Hcxx . . $ `Kernel/dumpInterface.h:21:9`!
22
23 #include <ostream>
24
25 #include "tNamedEntry.h"cxx . . $ `<file>/Kernel/tNamedEntry.h`/
26 #include "dltree.h"cxx . . $ `<file>/Kernel/dltree.h`/
27
28 class TConceptcxx . . $ TConcept#;
29 class TRolecxx . . $ TRole#;
30
31 /// enumeration of dump interface concept operations
32 enum diOpcxx . . $ diOp#
33 { // concept expressions
34 diNotcxx . . $ diNot.,
35 diAndcxx . . $ diAnd.,
36 diOrcxx . . $ diOr.,
37 diExistscxx . . $ diExists.,
38 diForallcxx . . $ diForall.,
39 diGEcxx . . $ diGE.,
40 diLEcxx . . $ diLE.,
41 // role expressions
42 diInvcxx . . $ diInv.,
43 // individual expressions
44 diOneOfcxx . . $ diOneOf.,
45 // wrong operation
46 diErrorOpcxx . . $ diErrorOp.,
47 // end of the enum
48 diLastOpcxx . . $ diLastOp. = diErrorOpcxx . . $ diErrorOp.
49 }; // diOp
50
51 /// enumeration of dump interface axioms
52 enum diAxcxx . . $ diAx#
53 { // wrong axiom
54 diErrorAxcxx . . $ diErrorAx. = diLastOpcxx . . $ diLastOp.,
55 // concept axioms
56 diDefineCcxx . . $ diDefineC.,
57 diImpliesCcxx . . $ diImpliesC.,
58 diEqualsCcxx . . $ diEqualsC.,
59 diDisjointCcxx . . $ diDisjointC.,
60 // role axioms
61 diDefineRcxx . . $ diDefineR.,
62 diTransitiveRcxx . . $ diTransitiveR.,
63 diFunctionalRcxx . . $ diFunctionalR.,
64 diImpliesRcxx . . $ diImpliesR.,
65 diEqualsRcxx . . $ diEqualsR.,
66 diDomainRcxx . . $ diDomainR.,
67 diRangeRcxx . . $ diRangeR.,
68 // individual axioms
69 diInstanceOfcxx . . $ diInstanceOf.,
70 }; // diAx
71
72 /// general interface for dumping ontology to a proper format
73 class dumpInterfacecxx . . $ dumpInterface#
74 {
75 protected: // members
76 /// output stream
77 stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& ocxx . . $ dumpInterface#o.;
78 /// indentation level
79 unsigned int indentcxx . . $ dumpInterface#indent. = 0;
80 /// print every axiom on a single line (need for sorting, for example)
81 bool onelinercxx . . $ dumpInterface#oneliner. = false;
82
83 protected: // methods
84 /// write necessary amount of TABs
85 void skipIndentcxx . . $ dumpInterface#skipIndent(49f6e7a06ebc5aa8). ( void );
86 /// increase indentation level
87 void incIndentcxx . . $ dumpInterface#incIndent(49f6e7a06ebc5aa8). ( void );
88 /// decrease indentation level
89 void decIndentcxx . . $ dumpInterface#decIndent(49f6e7a06ebc5aa8). ( void );
90
91 public: // interface
92 /// the only c'tor -- empty
93 explicit dumpInterfacecxx . . $ dumpInterface#dumpInterface(f7f45734e6842120). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& oo ) : ocxx . . $ dumpInterface#o.(oo) {}
94 /// empty d'tor
95 virtual ~cxx . . $ dumpInterface#`~dumpInterface`(49f6e7a06ebc5aa8).dumpInterfacecxx . . $ dumpInterface#() = default;
96
97 /// set ONELINER flag; @return previous value
98 bool useIndentationcxx . . $ dumpInterface#useIndentation(efaadfb7dc14930a). ( bool val )
99 {
100 bool ret = onelinercxx . . $ dumpInterface#oneliner.;
101 onelinercxx . . $ dumpInterface#oneliner. = val;
102 return ret;
103 }
104
105 // global prologue/epilogue
106 virtual void prologuecxx . . $ dumpInterface#prologue(49f6e7a06ebc5aa8). ( void ) {}
107 virtual void epiloguecxx . . $ dumpInterface#epilogue(49f6e7a06ebc5aa8). ( void ) {}
108
109 // general concept expression
110 virtual void dumpTopcxx . . $ dumpInterface#dumpTop(49f6e7a06ebc5aa8). ( void ) {}
111 virtual void dumpBottomcxx . . $ dumpInterface#dumpBottom(49f6e7a06ebc5aa8). ( void ) {}
112 virtual void dumpNumbercxx . . $ dumpInterface#dumpNumber(cb2f890c2fdad230). ( unsigned int ) {}
113
114 virtual void startOpcxx . . $ dumpInterface#startOp(7be172353191b2e5). ( diOpcxx . . $ diOp# ) {}
115 /// start operation >=/<= with number
116 virtual void startOpcxx . . $ dumpInterface#startOp(8f1f39ecbb206b02). ( diOpcxx . . $ diOp#, unsigned int ) {}
117 virtual void contOpcxx . . $ dumpInterface#contOp(7be172353191b2e5). ( diOpcxx . . $ diOp# ) {}
118 virtual void finishOpcxx . . $ dumpInterface#finishOp(7be172353191b2e5). ( diOpcxx . . $ diOp# ) {}
119
120 virtual void startAxcxx . . $ dumpInterface#startAx(125b68beff83e054). ( diAxcxx . . $ diAx# ) {}
121 virtual void contAxcxx . . $ dumpInterface#contAx(125b68beff83e054). ( diAxcxx . . $ diAx# ) {}
122 virtual void finishAxcxx . . $ dumpInterface#finishAx(125b68beff83e054). ( diAxcxx . . $ diAx# ) {}
123
124 /// obtain name by the named entry
125 virtual void dumpNamecxx . . $ dumpInterface#dumpName(dccc50802eb9f6d5). ( const TNamedEntrycxx . . $ TNamedEntry#* p ) { ocxx . . $ dumpInterface#o. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). p->getNamecxx . . $ TNamedEntry#getName(a9f41ea0e82d88cf).(); }
126 /// dump concept atom (as used in expression)
127 virtual void dumpConceptcxx . . $ dumpInterface#dumpConcept(49c8796e4511ff9d). ( const TConceptcxx . . $ TConcept#* ) {}
128 /// dump role atom (as used in expression)
129 virtual void dumpRolecxx . . $ dumpInterface#dumpRole(67b1ad1f11addbc2). ( const TRolecxx . . $ TRole#* ) {}
130 }; // dumpInterface
131
132 inline void dumpInterfacecxx . . $ dumpInterface# :: skipIndentcxx . . $ dumpInterface#skipIndent(49f6e7a06ebc5aa8). ( void )
133 {
134 if ( onelinercxx . . $ dumpInterface#oneliner. )
135 return;
136 ocxx . . $ dumpInterface#o. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n";
137 for ( unsigned int i = indentcxx . . $ dumpInterface#indent.; i > 0; --i )
138 ocxx . . $ dumpInterface#o. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " ";
139 }
140
141 inline void dumpInterfacecxx . . $ dumpInterface# :: incIndentcxx . . $ dumpInterface#incIndent(49f6e7a06ebc5aa8). ( void )
142 {
143 skipIndentcxx . . $ dumpInterface#skipIndent(49f6e7a06ebc5aa8).();
144 ++indentcxx . . $ dumpInterface#indent.; // operands of AND-like
145 }
146
147 inline void dumpInterfacecxx . . $ dumpInterface# :: decIndentcxx . . $ dumpInterface#decIndent(49f6e7a06ebc5aa8). ( void )
148 {
149 --indentcxx . . $ dumpInterface#indent.;
150 skipIndentcxx . . $ dumpInterface#skipIndent(49f6e7a06ebc5aa8).();
151 }
152
153 // dump given concept expression
154 void dumpCExpressioncxx . . $ dumpCExpression(de02d640352e7413). ( dumpInterfacecxx . . $ dumpInterface#* dump, const DLTreecxx . . $ DLTree#* C );
155 // dump given role expression
156 void dumpRExpressioncxx . . $ dumpRExpression(de02d640352e7413). ( dumpInterfacecxx . . $ dumpInterface#* dump, const DLTreecxx . . $ DLTree#* R );
157
158 #endif