| 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 | #include "taxNamEntry.h" |
| 21 | #include "DataTypeCenter.h" |
| 22 | #include "DataReasoning.h" |
| 23 | |
| 24 | DataTypeCenter :: ~DataTypeCenter() |
| 25 | { |
| 26 | for ( iterator p = begin(), p_end = end(); p < p_end; ++p ) |
| 27 | delete *p; |
| 28 | } |
| 29 | |
| 30 | TDataType* |
| 31 | DataTypeCenter :: getTypeByName ( const std::string& name ) const |
| 32 | { |
| 33 | // special case whatever you want here |
| 34 | |
| 35 | // go through all types and check the name |
| 36 | for ( const_iterator p = begin(), p_end = end(); p < p_end; ++p ) |
| 37 | if ( name == (*p)->getType()->getName() ) |
| 38 | return *p; |
| 39 | |
| 40 | return nullptr; |
| 41 | } |
| 42 | |
| 43 | void |
| 44 | DataTypeCenter :: setLocked ( bool val ) |
| 45 | { |
| 46 | if ( val ) |
| 47 | return; |
| 48 | |
| 49 | for ( iterator p = begin(), p_end = end(); p < p_end; ++p ) |
| 50 | (*p)->setLocked(val); |
| 51 | } |
| 52 | |
| 53 | void |
| 54 | DataTypeCenter :: initDataTypeReasoner ( DataTypeReasoner& DTReasoner ) const |
| 55 | { |
| 56 | for ( const_iterator p = begin(), p_end = end(); p < p_end; ++p ) |
| 57 | { |
| 58 | TDataEntry* type = (*p)->getType(); |
| 59 | if ( isValid(type->getBP()) ) |
| 60 | DTReasoner.registerDataType(type); |
| 61 | } |
| 62 | } |