00001 00005 /* Copyright © 2009 James Legg. 00006 This program is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 */ 00011 00012 #include "PathEdgeEnd.h" 00013 #include "../stream_loader.h" 00014 #include "../FormErrors.h" 00015 00016 namespace Track 00017 { 00018 00019 const unsigned int path_edge_end_newest_version = 1; 00020 00021 PathEdgeEnd::PathEdgeEnd(std::size_t edge_index, EditAssist::EdgeStrengthHandle::EdgeEnd end) 00022 : file_version(0) 00023 , gradient_strength(10.0) 00024 , handle(edge_index, end) 00025 { 00026 } 00027 00028 PathEdgeEnd::PathEdgeEnd(std::istream & source, std::size_t edge_index, 00029 EditAssist::EdgeStrengthHandle::EdgeEnd end) 00030 : file_version(int_from_stream(source)) 00031 , handle(edge_index, end) 00032 { 00033 if (file_version == 0) throw CorruptedError(); 00034 if (file_version > path_edge_end_newest_version) throw NewVersionError(); 00035 source >> gradient_strength >> segment_connection_index; 00036 } 00037 00038 PathEdgeEnd::~PathEdgeEnd() 00039 { 00040 00041 } 00042 00043 std::ostream & operator<<(std::ostream & destination, const PathEdgeEnd & path_edge_end) 00044 { 00045 destination << path_edge_end_newest_version << ' ' 00046 << path_edge_end.gradient_strength << ' ' 00047 << path_edge_end.segment_connection_index; 00048 return destination; 00049 } 00050 00051 }
Generated at Mon Sep 6 00:41:12 2010 by Doxygen version 1.4.7 for Racer version svn335.