omg_rabinacc.h
Go to the documentation of this file.
1 /** @file omg_rabinacc.h Rabin acceptance condition */
2 
3 
4 /* FAU Discrete Event Systems Library (libfaudes)
5 
6  Copyright (C) 2025 Thomas Moor
7  Exclusive copyright is granted to Klaus Schmidt
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef FAUDES_OMG_RABINACC_H
24 #define FAUDES_OMG_RABINACC_H
25 
26 #include "corefaudes.h"
27 
28 namespace faudes {
29 
30 /**
31  * The class RabinPair models a pair of state sets.
32  * We use faudes Type as base class to faciltate serialisation
33  * of sets of RabinPairs aka RabinAcceptance.
34  *
35  * @ingroup OmgPlugin
36  */
37 class FAUDES_API RabinPair : public ExtType {
38 
40 
41 public:
42  /**
43  * Default constructor, all empty
44  */
45  RabinPair(void);
46 
47  /**
48  * Copy constructor.
49  */
50  RabinPair(const RabinPair& rRP);
51 
52  /**
53  * Destructor
54  */
55  virtual ~RabinPair(void) {};
56 
57  /**
58  * Clear to default (all empty)
59  */
60  virtual void Clear(void);
61 
62  /*
63  * Member access R
64  *
65  * @return
66  * writable ref to Set of states type R
67  */
68  StateSet& RSet(void) {return mRSet;};
69 
70  /*
71  * Member access R
72  *
73  * @return
74  * const ref to Set of states type R
75  */
76  const StateSet& RSet(void) const {return mRSet;};
77 
78  /**
79  * Member access I
80  *
81  * @return
82  * writable ref to Set of states type I
83  */
84  StateSet& ISet(void) {return mISet;};
85 
86  /**
87  * Member access I
88  *
89  * @return
90  * const ref to Set of states type I
91  */
92  const StateSet& ISet(void) const {return mISet;};
93 
94  /**
95  * Restrict to specified State set
96  *
97  * @param rDomain
98  * State set to restrict to
99  */
100  void RestrictStates(const StateSet& rDomain);
101 
102  /**
103  * Compare for set-ordering
104  *
105  * @param rOther
106  * other Rabin pair to compare with
107  * @return
108  * true if "this>other"
109  */
110  bool operator<(const RabinPair& rOther) const;
111 
112 protected:
113 
114  /**
115  * set of states type R
116  */
118 
119  /**
120  * set of states type I
121  */
123 
124  /**
125  * Assignment method.
126  *
127  * @param rSrc
128  * Source to assign from
129  */
130  void DoAssign(const RabinPair& rSrc);
131 
132  /**
133  * Test equality of configuration data.
134  *
135  * @param rOther
136  * RabinPair to compare with
137  * @return
138  * True on match.
139  */
140  bool DoEqual(const RabinPair& rOther) const;
141 
142  /**
143  * Read configuratioj from TokenReader, see Type for public wrappers.
144  * Use am optional Generator context for symbolic state names.
145  *
146  * @param rTr
147  * TokenReader to read from
148  * @param rLabel
149  * Section to read
150  * @param pContext
151  * Provide contextual information
152  *
153  * @exception Exception
154  * - IO error (id 1)
155  */
156  virtual void DoRead(TokenReader& rTr, const std::string& rLabel="", const Type* pContext=nullptr);
157 
158  /**
159  * Writes configuration to TokenWriter, see Type for public wrappers.
160  * Use am optional Generator context for symbolic state names.
161  *
162  * @param rTw
163  * TokenWriter to write to
164  * @param rLabel
165  * Section to write
166  * @param pContext
167  * Provide contextual information
168  *
169  * @exception Exception
170  * - IO error (id 2)
171  */
172  virtual void DoWrite(TokenWriter& rTw,const std::string& rLabel="", const Type* pContext=nullptr) const;
173 
174  /**
175  * Writes configuration to TokenWriter, see Type for public wrappers.
176  * Use am optional Generator context for symbolic state names.
177  *
178  * @param rTw
179  * TokenWriter to write to
180  * @param rLabel
181  * Section to write
182  * @param pContext
183  * Provide contextual information
184  *
185  * @exception Exception
186  * - IO error (id 2)
187  */
188 
189  virtual void DoXWrite(TokenWriter& rTw,const std::string& rLabel="", const Type* pContext=nullptr) const;
190 
191 };
192 
193 
194 /**
195  * The class RabinAcceptance is a set of RabinPairs.
196  * We use faudes::TBaseVector as the base class and perhaps
197  * add some convenience accessors in due course.
198  *
199  * @ingroup OmgPlugin
200  */
201 class FAUDES_API RabinAcceptance : public TBaseVector<RabinPair> {
202 
204 
205 public:
206  /**
207  * Default constructor (all empty)
208  */
209  RabinAcceptance(void);
210 
211  /**
212  * Copy constructor.
213  */
214  RabinAcceptance(const RabinAcceptance& rRA);
215 
216  /**
217  * Construct from file.
218  */
219  RabinAcceptance(const std::string& rFileName);
220 
221  /**
222  * Destructor
223  */
224  virtual ~RabinAcceptance(void) {};
225 
226  /**
227  * Restrict to specified State set
228  *
229  * @param rDomain
230  * State set to restrict to
231  */
232  void RestrictStates(const StateSet& rDomain);
233 
234 
235 protected:
236 
237  /**
238  * Token output, see Type::SWrite for public wrappers.
239  * Statistics include sizes of members and is meant to record test cases
240  *
241  * @param rTw
242  * Reference to TokenWriter
243  */
244  virtual void DoSWrite(TokenWriter& rTw) const;
245 
246 };
247 
248 }//namespace
249 #endif//.H
#define FAUDES_API
Definition: cfl_platform.h:80
#define FAUDES_TYPE_DECLARATION(ftype, ctype, cbase)
Definition: cfl_types.h:880
virtual ~RabinAcceptance(void)
Definition: omg_rabinacc.h:224
const StateSet & ISet(void) const
Definition: omg_rabinacc.h:92
StateSet & RSet(void)
Definition: omg_rabinacc.h:68
const StateSet & RSet(void) const
Definition: omg_rabinacc.h:76
virtual ~RabinPair(void)
Definition: omg_rabinacc.h:55
StateSet & ISet(void)
Definition: omg_rabinacc.h:84

libFAUDES 2.33h --- 2025.06.18 --- c++ api documentaion by doxygen