| 1 | /* This file is part of the FaCT++ DL reasoner |
| 2 | Copyright (C) 2010-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 | #include "tExpressionManager.h" |
| 21 | |
| 22 | TExpressionManager :: TExpressionManager ( void ) |
| 23 | : CTop(new TDLConceptTop) |
| 24 | , CBottom(new TDLConceptBottom) |
| 25 | , DTop(new TDLDataTop) |
| 26 | , DBottom(new TDLDataBottom) |
| 27 | , ORTop(new TDLObjectRoleTop) |
| 28 | , ORBottom(new TDLObjectRoleBottom) |
| 29 | , DRTop(new TDLDataRoleTop) |
| 30 | , DRBottom(new TDLDataRoleBottom) |
| 31 | , InverseRoleCache(this) |
| 32 | , OneOfCache(this) |
| 33 | { |
| 34 | } |
| 35 | |
| 36 | TExpressionManager :: ~TExpressionManager() |
| 37 | { |
| 38 | clear(); |
| 39 | delete CTop; |
| 40 | delete CBottom; |
| 41 | delete ORTop; |
| 42 | delete ORBottom; |
| 43 | delete DRTop; |
| 44 | delete DRBottom; |
| 45 | delete DTop; |
| 46 | delete DBottom; |
| 47 | } |
| 48 | |
| 49 | void |
| 50 | TExpressionManager :: clear ( void ) |
| 51 | { |
| 52 | // clear all the names but the datatypes |
| 53 | NS_C.clear(); |
| 54 | NS_I.clear(); |
| 55 | NS_OR.clear(); |
| 56 | NS_DR.clear(); |
| 57 | InverseRoleCache.clear(); |
| 58 | OneOfCache.clear(); |
| 59 | // delete all the recorded references |
| 60 | for ( auto& expr: RefRecorder ) |
| 61 | delete expr; |
| 62 | RefRecorder.clear(); |
| 63 | } |
| 64 | |
| 65 | /// clear the TNamedEntry cache for all elements of all name-sets |
| 66 | void |
| 67 | TExpressionManager :: clearNameCache ( void ) |
| 68 | { |
| 69 | clearEntriesCache(NS_C); |
| 70 | clearEntriesCache(NS_I); |
| 71 | clearEntriesCache(NS_OR); |
| 72 | clearEntriesCache(NS_DR); |
| 73 | clearEntriesCache(NS_DT); |
| 74 | } |