1 /* 2 This file is part of Freeminer. 3 4 Freeminer is free software: you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation, either version 3 of the License, or 7 (at your option) any later version. 8 9 Freeminer is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with Freeminer. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef CIRCUIT_ELEMENT_VIRTUAL_H 19 #define CIRCUIT_ELEMENT_VIRTUAL_H 20 21 #include <list> 22 #include <map> 23 #include <sstream> 24 25 #include "irrlichttypes.h" 26 27 class CircuitElement; 28 29 struct CircuitElementVirtualContainer { 30 u8 shift; 31 std::list<CircuitElement>::iterator element_pointer; 32 }; 33 34 class CircuitElementVirtual : public std::list <CircuitElementVirtualContainer> { 35 public: 36 CircuitElementVirtual(u32 id); 37 ~CircuitElementVirtual(); 38 39 void update(); 40 41 void serialize(std::ostream& out); 42 void deSerialize(std::istream& is, std::list <CircuitElementVirtual>::iterator current_element_it, 43 std::map <u32, std::list<CircuitElement>::iterator>& id_to_pointer); 44 45 void setId(u32 id); 46 47 u32 getId(); 48 addState(const bool state)49 inline void addState(const bool state) { 50 m_state |= state; 51 } 52 53 private: 54 u32 m_element_id; 55 bool m_state; 56 }; 57 58 #endif 59