Tide 0.1.0

segment.h

Go to the documentation of this file.
00001 /* Tide
00002  *
00003  * Header for the Segment 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_SEGMENT_H_)
00029 #define TIDE_SEGMENT_H_
00030 
00031 #include <map>
00032 #include <tide/master_element.h>
00033 #include <tide/metaseek.h>
00034 #include <tide/segment_info.h>
00035 #include <tide/win_dll.h>
00036 
00039 
00040 namespace tide
00041 {
00068     class TIDE_EXPORT Segment : public MasterElement
00069     {
00070         public:
00076             Segment(std::streamsize pad_size=4096);
00077 
00091             std::streamsize pad_size() const { return pad_size_; }
00093             void pad_size(std::streamsize pad_size) { pad_size_ = pad_size; }
00094 
00096             std::streamsize size() const;
00097 
00113             std::streamsize finalise(std::iostream& stream);
00114 
00126             SeekHead index;
00127 
00133             SegmentInfo info;
00134 
00140             std::streamsize to_segment_offset(std::streamsize stream_offset);
00141 
00148             std::streamsize to_stream_offset(std::streamsize seg_offset);
00149 
00150         protected:
00152             std::streamsize pad_size_;
00154             std::streamsize size_;
00156             bool writing_;
00157 
00164             std::streamsize body_size() const
00165                 { return size_; }
00166 
00168             std::streamsize write_size(std::ostream& output);
00169 
00180             std::streamsize write_body(std::ostream& output);
00181 
00211             std::streamsize read_body(std::istream& input,
00212                     std::streamsize size);
00213     }; // class Segment
00214 }; // namespace tide
00215 
00217 
00218 #endif // TIDE_SEGMENT_H_
00219 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines