| 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 TNAMEDENTRY_H |
| 21 | #define TNAMEDENTRY_H |
| 22 | |
| 23 | #include <string> |
| 24 | #include <ostream> |
| 25 | |
| 26 | #include "flags.h" |
| 27 | |
| 28 | class TNamedEntity; |
| 29 | class SaveLoadManager; |
| 30 | |
| 31 | class TNamedEntry: public Flags |
| 32 | { |
| 33 | protected: // members |
| 34 | /// name of the entry |
| 35 | std::string extName; |
| 36 | /// entry identifier |
| 37 | int extId = 0; |
| 38 | /// original entity |
| 39 | const TNamedEntity* entity = nullptr; |
| 40 | |
| 41 | public: // interface |
| 42 | /// the only c'tor |
| 43 | explicit TNamedEntry ( const std::string& name ) |
| 44 | : extName (name) // copy name |
| 45 | {} |
| 46 | /// no copy c'tor |
| 47 | TNamedEntry ( const TNamedEntry& ) = delete; |
| 48 | /// no assignment |
| 49 | TNamedEntry& operator = ( const TNamedEntry& ) = delete; |
| 50 | |
| 51 | /// gets name of given entry |
| 52 | const char* getName ( void ) const { return extName.c_str(); } |
| 53 | |
| 54 | /// set internal ID |
| 55 | void setId ( int id ) { extId = id; } |
| 56 | /// get internal ID |
| 57 | int getId ( void ) const { return extId; } |
| 58 | |
| 59 | /// set entity |
| 60 | void setEntity ( const TNamedEntity* e ) { entity = e; } |
| 61 | /// get entity |
| 62 | const TNamedEntity* getEntity ( void ) const { return entity; } |
| 63 | |
| 64 | /// register a System flag |
| 65 | FPP_ADD_FLAG(System,0x1); |
| 66 | |
| 67 | // hierarchy interface |
| 68 | |
| 69 | /// register a Top-of-the-hierarchy flag |
| 70 | FPP_ADD_FLAG(Top,0x1000); |
| 71 | /// register a Bottom-of-the-hierarchy flag |
| 72 | FPP_ADD_FLAG(Bottom,0x2000); |
| 73 | |
| 74 | virtual void Print ( std::ostream& o ) const { o << getName (); } |
| 75 | |
| 76 | // save/load interface; implementation is in SaveLoad.cpp |
| 77 | |
| 78 | /// save entry |
| 79 | virtual void Save ( SaveLoadManager& ) const; |
| 80 | /// load entry |
| 81 | virtual void Load ( SaveLoadManager& ); |
| 82 | }; // TNamedEntry |
| 83 | |
| 84 | #endif |