| 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 TLABELLER_H |
| 21 | #define TLABELLER_Hcxx . . $ `Kernel/tLabeller.h:21:9`! |
| 22 | |
| 23 | #include "fpp_assert.h"cxx . . $ `<file>/Kernel/fpp_assert.h`/ |
| 24 | #include "tCounter.h"cxx . . $ `<file>/Kernel/tCounter.h`/ |
| 25 | |
| 26 | /** define class that implements support for labelling entries with |
| 27 | * cheap 'unselect' operation. An external entity is 'marked' iff |
| 28 | * it's value equal to the internal counter. |
| 29 | */ |
| 30 | class TLabellercxx . . $ TLabeller# |
| 31 | { |
| 32 | private: // internal type definition |
| 33 | /// type of a counter |
| 34 | typedef TCountercxx . . $ TCounter#<unsigned int> LabelCountercxx . . $ TLabeller#LabelCounter#; |
| 35 | |
| 36 | public: // type interface |
| 37 | /// define integral type of a label |
| 38 | typedef LabelCountercxx . . $ TLabeller#LabelCounter#::IntTypecxx . . $ TCounter#IntType# LabelTypecxx . . $ TLabeller#LabelType#; |
| 39 | |
| 40 | protected: // members |
| 41 | /// counter |
| 42 | LabelCountercxx . . $ TLabeller#LabelCounter# countercxx . . $ TLabeller#counter.{cxx . . $ TCounter#TCounter(9b289cee16747614).1}; |
| 43 | |
| 44 | public: // interface |
| 45 | |
| 46 | // operations with Labeller |
| 47 | |
| 48 | /// create a new label value |
| 49 | void newLabelcxx . . $ TLabeller#newLabel(49f6e7a06ebc5aa8). ( void ) |
| 50 | { |
| 51 | countercxx . . $ TLabeller#counter..inccxx . . $ TCounter#inc(5f357b03ed472e5e).(); |
| 52 | fpp_assertcxx . . $ EFPPAssertion#EFPPAssertion(85c52e162fed56f9). ( counter.val() != 0 ); |
| 53 | } |
| 54 | |
| 55 | // operations with Labels |
| 56 | |
| 57 | /// set given label's value to the counter's one |
| 58 | void setcxx . . $ TLabeller#set(702af1567bd3bb3c). ( LabelTypecxx . . $ TLabeller#LabelType#& lab ) const { lab = countercxx . . $ TLabeller#counter..valcxx . . $ TCounter#val(8f5363d873dd4781).(); } |
| 59 | /// clear given label's value (independent of a labeller) |
| 60 | static void clearcxx . . $ TLabeller#clear(db0e23f8c3d03d8b). ( LabelTypecxx . . $ TLabeller#LabelType#& lab ) { lab = 0; } |
| 61 | /// check if given label is labelled |
| 62 | bool isLabelledcxx . . $ TLabeller#isLabelled(7ba91045e28e2316). ( const LabelTypecxx . . $ TLabeller#LabelType#& lab ) const { return (lab == countercxx . . $ TLabeller#counter..valcxx . . $ TCounter#val(8f5363d873dd4781).()); } |
| 63 | }; // TLabeller |
| 64 | |
| 65 | #endif |