Tide 0.1.0
|
00001 /* Tide 00002 * 00003 * Header file for the base element object. 00004 * 00005 * Copyright 2011 Geoffrey Biggs geoffrey.biggs@aist.go.jp 00006 * RT-Synthesis Research Group 00007 * Intelligent Systems Research Institute, 00008 * National Institute of Advanced Industrial Science and Technology (AIST), 00009 * Japan 00010 * All rights reserved. 00011 * 00012 * This file is part of Tide. 00013 * 00014 * Tide is free software; you can redistribute it and/or modify it under 00015 * the terms of the GNU Lesser General Public License as published by 00016 * the Free Software Foundation; either version 2.1 of the License, or 00017 * (at your option) any later version. 00018 * 00019 * Tide is distributed in the hope that it will be useful, but WITHOUT 00020 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00021 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00022 * License for more details. 00023 * 00024 * You should have received a copy of the GNU Lesser General Public 00025 * License along with Tide. If not, see <http://www.gnu.org/licenses/>. 00026 */ 00027 00028 #if !defined(TIDE_ELEMENT_H_) 00029 #define TIDE_ELEMENT_H_ 00030 00031 #include <tide/el_ids.h> 00032 #include <tide/win_dll.h> 00033 00034 #include <ios> 00035 #include <iostream> 00036 #include <stdint.h> 00037 00038 00041 00042 namespace tide 00043 { 00055 class TIDE_EXPORT Element 00056 { 00057 public: 00064 Element(tide::ids::ID id); 00065 00067 virtual ~Element() {}; 00068 00093 uint32_t id() const { return id_; } 00094 00106 std::streampos offset() const { return offset_; } 00107 00115 virtual std::streamsize size() const; 00116 00126 virtual std::streamsize write(std::ostream& output); 00127 00152 virtual std::streamsize read(std::istream& input); 00153 00154 protected: 00155 tide::ids::ID id_; 00156 std::streampos offset_; 00157 00168 virtual std::streamsize body_size() const = 0; 00169 00179 std::streamsize write_id(std::ostream& output); 00180 00189 virtual std::streamsize write_size(std::ostream& output); 00190 00199 virtual std::streamsize write_body(std::ostream& output) = 0; 00200 00227 virtual std::streamsize read_body(std::istream& input, 00228 std::streamsize size) = 0; 00229 00230 }; // class Element 00231 00232 00245 std::streamsize skip_read(std::istream& input, bool and_id); 00246 00247 00260 std::streamsize skip_write(std::iostream& stream, bool and_id); 00261 }; // namespace tide 00262 00265 00266 #endif // TIDE_ELEMENT_H_ 00267