Tide 0.1.0

block_additions.h

Go to the documentation of this file.
00001 /* Tide
00002  *
00003  * Header file for the BlockAdditions 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_BLOCK_ADDITIONS_H_)
00029 #define TIDE_BLOCK_ADDITIONS_H_
00030 
00031 #include <boost/operators.hpp>
00032 #include <boost/shared_ptr.hpp>
00033 #include <stdint.h>
00034 #include <tide/master_element.h>
00035 #include <vector>
00036 #include <tide/win_dll.h>
00037 
00040 
00041 namespace tide
00042 {
00049     class TIDE_EXPORT BlockAdditions : public MasterElement,
00050         public boost::equality_comparable<BlockAdditions>
00051     {
00052         public:
00054             typedef std::pair<uint64_t, std::vector<char> > Addition;
00056             typedef boost::shared_ptr<Addition> AdditionPtr;
00058             typedef std::vector<AdditionPtr>::value_type value_type;
00060             typedef std::vector<AdditionPtr>::size_type size_type;
00062             typedef std::vector<AdditionPtr>::reference reference;
00064             typedef std::vector<AdditionPtr>::const_reference const_reference;
00066             typedef std::vector<AdditionPtr>::iterator iterator;
00068             typedef std::vector<AdditionPtr>::const_iterator const_iterator;
00070             typedef std::vector<AdditionPtr>::reverse_iterator reverse_iterator;
00072             typedef std::vector<AdditionPtr>::const_reverse_iterator
00073                 const_reverse_iterator;
00074 
00076             BlockAdditions();
00077 
00081             value_type& at(size_type pos)
00082                 { return additions_.at(pos); }
00086             value_type const& at(size_type pos) const
00087                 { return additions_.at(pos); }
00088 
00092             value_type& operator[](size_type pos)
00093                 { return additions_[pos]; }
00097             value_type const& operator[](size_type pos) const
00098                 { return additions_[pos]; }
00099 
00101             iterator begin() { return additions_.begin(); }
00103             const_iterator begin() const { return additions_.begin(); }
00105             iterator end() { return additions_.end(); }
00107             const_iterator end() const { return additions_.end(); }
00109             reverse_iterator rbegin() { return additions_.rbegin(); }
00111             const_reverse_iterator rbegin() const
00112                 { return additions_.rbegin(); }
00116             reverse_iterator rend() { return additions_.rend(); }
00120             const_reverse_iterator rend() const { return additions_.rend(); }
00121 
00123             bool empty() const { return additions_.empty(); }
00125             size_type count() const { return additions_.size(); }
00127             size_type max_count() const { return additions_.max_size(); }
00128 
00130             void clear() { additions_.clear(); }
00131 
00133             void erase(iterator position)
00134                 { additions_.erase(position); }
00136             void erase(iterator first, iterator last)
00137                 { additions_.erase(first, last); }
00138 
00140             void push_back(value_type const& value);
00141 
00143             void resize(size_type count)
00144                 { additions_.resize(count); }
00145 
00147             void swap(BlockAdditions& other)
00148                 { additions_.swap(other.additions_); }
00149 
00151             friend bool operator==(BlockAdditions const& lhs,
00152                     BlockAdditions const& rhs);
00153 
00154         protected:
00155             std::vector<AdditionPtr> additions_;
00156 
00158             virtual std::streamsize body_size() const;
00159 
00161             virtual std::streamsize write_body(std::ostream& output);
00162 
00164             virtual std::streamsize read_body(std::istream& input,
00165                     std::streamsize size);
00166 
00168             std::streamsize read_addition(std::istream& input,
00169                     std::streamsize size);
00170     }; // class BlockAdditions
00171 
00173     bool operator==(BlockAdditions const& lhs, BlockAdditions const& rhs);
00174 }; // namespace tide
00175 
00177 // group elements
00178 
00179 #endif // TIDE_BLOCK_ADDITIONS_H_
00180 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines