Tide 0.1.0
|
00001 /* Tide 00002 * 00003 * Header file for the SeekHead element. 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_METASEEK_H_) 00029 #define TIDE_METASEEK_H_ 00030 00031 #include <boost/operators.hpp> 00032 #include <map> 00033 #include <tide/el_ids.h> 00034 #include <tide/master_element.h> 00035 #include <tide/seek_element.h> 00036 #include <tide/win_dll.h> 00037 00040 00041 namespace tide 00042 { 00056 class TIDE_EXPORT SeekHead : public MasterElement, 00057 public boost::equality_comparable<SeekHead> 00058 { 00059 public: 00061 typedef ids::ID key_type; 00063 typedef std::streamoff mapped_type; 00064 00065 protected: 00067 typedef std::multimap<key_type, mapped_type> storage_type_; 00068 00069 public: 00074 SeekHead(); 00075 00077 typedef storage_type_::value_type value_type; 00079 typedef storage_type_::size_type size_type; 00081 typedef storage_type_::reference reference; 00083 typedef storage_type_::const_reference const_reference; 00085 typedef storage_type_::iterator iterator; 00087 typedef storage_type_::const_iterator const_iterator; 00089 typedef storage_type_::reverse_iterator reverse_iterator; 00091 typedef storage_type_::const_reverse_iterator 00092 const_reverse_iterator; 00093 00097 SeekHead& operator=(SeekHead const& other) 00098 { index_ = other.index_; return *this; } 00099 00101 iterator begin() { return index_.begin(); } 00103 const_iterator begin() const { return index_.begin(); } 00107 iterator end() { return index_.end(); } 00111 const_iterator end() const { return index_.end(); } 00113 reverse_iterator rbegin() { return index_.rbegin(); } 00115 const_reverse_iterator rbegin() const { return index_.rbegin(); } 00119 reverse_iterator rend() { return index_.rend(); } 00123 const_reverse_iterator rend() const { return index_.rend(); } 00124 00126 bool empty() const { return index_.empty(); } 00128 size_type count() const { return index_.size(); } 00130 size_type max_count() const { return index_.max_size(); } 00131 00133 void clear() { index_.clear(); } 00144 iterator insert(value_type const& value) 00145 { return index_.insert(value); } 00151 void insert(const_iterator first, const_iterator last) 00152 { index_.insert(first, last); } 00157 void erase(iterator position) { index_.erase(position); } 00163 void erase(iterator first, iterator last) 00164 { index_.erase(first, last); } 00170 size_type erase(key_type const& id) 00171 { return index_.erase(id); } 00176 void swap(SeekHead& other) 00177 { index_.swap(other.index_); } 00178 00188 iterator find(key_type const& id) { return index_.find(id); } 00195 const_iterator find(key_type const& id) const 00196 { return index_.find(id); } 00197 00199 friend bool operator==(SeekHead const& lhs, SeekHead const& rhs); 00200 00201 protected: 00202 storage_type_ index_; 00203 00205 virtual std::streamsize body_size() const; 00206 00208 virtual std::streamsize write_body(std::ostream& output); 00209 00211 virtual std::streamsize read_body(std::istream& input, 00212 std::streamsize size); 00213 }; // class SeekHead 00214 00216 bool operator==(SeekHead const& lhs, SeekHead const& rhs); 00217 }; // namespace Tide 00218 00220 // group elements 00221 00222 #endif // TIDE_METASEEK_H_ 00223