Tide 0.1.0
|
00001 /* Tide 00002 * 00003 * Header for the BlockGroup 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_GROUP_H_) 00029 #define TIDE_BLOCK_GROUP_H_ 00030 00031 #include <boost/operators.hpp> 00032 #include <tide/binary_element.h> 00033 #include <tide/block_element.h> 00034 #include <tide/block_additions.h> 00035 #include <tide/block_impl.h> 00036 #include <tide/master_element.h> 00037 #include <tide/uint_element.h> 00038 #include <tide/win_dll.h> 00039 00042 00043 namespace tide 00044 { 00055 class BlockGroup : public BlockElement, 00056 public boost::equality_comparable<BlockGroup> 00057 { 00058 public: 00067 BlockGroup(uint64_t track_number, int16_t timecode, 00068 LacingType lacing=LACING_NONE, uint64_t duration=0, 00069 uint64_t ref_priority=0); 00070 00072 BlockAdditions& additions() { return additions_; } 00073 00087 uint64_t duration() const { return duration_; } 00089 void duration(uint64_t duration) { duration_ = duration; } 00090 00097 uint64_t ref_priority() const { return ref_priority_; } 00099 void ref_priority(uint64_t ref_priority) 00100 { ref_priority_ = ref_priority; } 00101 00108 std::vector<int16_t>& ref_blocks() { return ref_blocks_; } 00109 00116 std::vector<char> codec_state() const 00117 { return codec_state_; } 00119 void codec_state(std::vector<char> const& codec_state) 00120 { codec_state_ = codec_state; } 00121 00123 // Block interface 00125 00132 virtual uint64_t track_number() const 00133 { return block_.track_number(); } 00135 virtual void track_number(uint64_t track_number) 00136 { block_.track_number(track_number); } 00137 00144 virtual int16_t timecode() const { return block_.timecode(); } 00146 virtual void timecode(int16_t timecode) 00147 { block_.timecode(timecode); } 00148 00154 virtual bool invisible() const { return block_.invisible(); } 00156 virtual void invisible(bool invisible) 00157 { block_.invisible(invisible); } 00158 00168 virtual LacingType lacing() const { return block_.lacing(); } 00170 virtual void lacing(LacingType lacing) 00171 { block_.lacing(lacing); } 00172 00179 virtual value_type& at(size_type pos) { return block_.at(pos); } 00186 virtual value_type const& at(size_type pos) const 00187 { return block_.at(pos); } 00188 00195 virtual value_type& operator[](size_type pos) 00196 { return block_[pos]; } 00203 virtual value_type const& operator[](size_type pos) const 00204 { return block_[pos]; } 00205 00207 virtual iterator begin() { return block_.begin(); } 00209 virtual const_iterator begin() const { return block_.begin(); } 00211 virtual iterator end() { return block_.end(); } 00213 virtual const_iterator end() const { return block_.end(); } 00215 virtual reverse_iterator rbegin() { return block_.rbegin(); } 00217 virtual const_reverse_iterator rbegin() const 00218 { return block_.rbegin(); } 00222 virtual reverse_iterator rend() { return block_.rend(); } 00226 virtual const_reverse_iterator rend() const 00227 { return block_.rend(); } 00228 00234 virtual bool empty() const { return block_.empty(); } 00236 virtual size_type count() const { return block_.count(); } 00244 virtual size_type max_count() const { return block_.max_count(); } 00245 00247 virtual void clear() { block_.clear(); } 00248 00253 virtual void erase(iterator position) { block_.erase(position); } 00259 virtual void erase(iterator first, iterator last) 00260 { block_.erase(first, last); } 00261 00274 virtual void push_back(value_type const& value) 00275 { block_.push_back(value); } 00276 00292 virtual void resize(size_type count) { block_.resize(count); } 00293 00298 virtual void swap(BlockGroup& other); 00299 00301 friend bool operator==(BlockGroup const& lhs, 00302 BlockGroup const& rhs); 00303 00304 protected: 00305 BlockAdditions additions_; 00306 UIntElement duration_; 00307 UIntElement ref_priority_; 00308 std::vector<int16_t> ref_blocks_; 00309 BinaryElement codec_state_; 00310 BlockImpl block_; 00311 00313 // Element interface 00315 00317 virtual std::streamsize body_size() const; 00318 00320 virtual std::streamsize read_body(std::istream& input, 00321 std::streamsize size); 00322 00324 virtual std::streamsize write_body(std::ostream& output); 00325 00327 void reset(); 00328 }; // class BlockGroup 00329 00331 bool operator==(BlockGroup const& lhs, BlockGroup const& rhs); 00332 }; // namespace tide 00333 00335 // group elements 00336 00337 #endif // TIDE_BLOCK_GROUP_H_ 00338