| 1 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 | |
| 3 | Header: FGPropertyReader.h |
| 4 | Author: Bertrand Coconnier |
| 5 | Date started: 12/30/13 |
| 6 | |
| 7 | ------------- Copyright (C) 2013 Bertrand Coconnier ------------- |
| 8 | |
| 9 | This program is free software; you can redistribute it and/or modify it under |
| 10 | the terms of the GNU Lesser General Public License as published by the Free |
| 11 | Software Foundation; either version 2 of the License, or (at your option) any |
| 12 | later version. |
| 13 | |
| 14 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 15 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 16 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
| 17 | details. |
| 18 | |
| 19 | You should have received a copy of the GNU Lesser General Public License along |
| 20 | with this program; if not, write to the Free Software Foundation, Inc., 59 |
| 21 | Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 22 | |
| 23 | Further information about the GNU Lesser General Public License can also be |
| 24 | found on the world wide web at http://www.gnu.org. |
| 25 | |
| 26 | HISTORY |
| 27 | -------------------------------------------------------------------------------- |
| 28 | 12/30/13 BC Created |
| 29 | |
| 30 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 31 | SENTRY |
| 32 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 33 | |
| 34 | #ifndef FGPROPERTYREADER_H |
| 35 | #define FGPROPERTYREADER_H |
| 36 | |
| 37 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 38 | INCLUDES |
| 39 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 40 | |
| 41 | #include <map> |
| 42 | |
| 43 | #include "simgear/props/props.hxx" |
| 44 | #include "input_output/FGPropertyManager.h" |
| 45 | |
| 46 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 47 | FORWARD DECLARATIONS |
| 48 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 49 | |
| 50 | namespace JSBSim { |
| 51 | |
| 52 | class Element; |
| 53 | |
| 54 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 55 | CLASS DOCUMENTATION |
| 56 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 57 | |
| 58 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 59 | CLASS DECLARATION |
| 60 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 61 | |
| 62 | class FGPropertyReader |
| 63 | { |
| 64 | public: |
| 65 | void Load(Element* el, FGPropertyManager* PropertyManager, bool override_props); |
| 66 | bool ResetToIC(void); |
| 67 | |
| 68 | class const_iterator |
| 69 | { |
| 70 | public: |
| 71 | explicit const_iterator(const std::map<SGPropertyNode_ptr, double>::const_iterator &it) : prop_it(it) {} |
| 72 | const_iterator& operator++() { ++prop_it; return *this; } |
| 73 | bool operator!=(const const_iterator& it) const { return prop_it != it.prop_it; } |
| 74 | FGPropertyNode* operator*() { |
| 75 | SGPropertyNode* node = prop_it->first; |
| 76 | return static_cast<FGPropertyNode*>(node); |
| 77 | } |
| 78 | |
| 79 | private: |
| 80 | std::map<SGPropertyNode_ptr, double>::const_iterator prop_it; |
| 81 | }; |
| 82 | |
| 83 | const_iterator begin(void) const { return const_iterator(interface_prop_initial_value.begin()); } |
| 84 | const_iterator end(void) const { return const_iterator(interface_prop_initial_value.end()); } |
| 85 | bool empty(void) const { return interface_prop_initial_value.empty(); } |
| 86 | |
| 87 | private: |
| 88 | std::map<SGPropertyNode_ptr, double> interface_prop_initial_value; |
| 89 | }; |
| 90 | } |
| 91 | //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 92 | #endif |