Tawara  0.1.0
block.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011, 2012, Geoffrey Biggs, geoffrey.biggs@aist.go.jp
5  * RT-Synthesis Research Group
6  * Intelligent Systems Research Institute,
7  * National Institute of Advanced Industrial Science and Technology (AIST),
8  * Japan
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  *
15  * * Redistributions of source code must retain the above copyright
16  * notice, this list of conditions and the following disclaimer.
17  * * Redistributions in binary form must reproduce the above
18  * copyright notice, this list of conditions and the following
19  * disclaimer in the documentation and/or other materials provided
20  * with the distribution.
21  * * Neither the name of Geoffrey Biggs nor AIST, nor the names of its
22  * contributors may be used to endorse or promote products derived
23  * from this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #if !defined(TAWARA_BLOCK_H_)
40 #define TAWARA_BLOCK_H_
41 
42 #include <boost/operators.hpp>
43 #include <boost/shared_ptr.hpp>
44 #include <stdint.h>
45 #include <tawara/win_dll.h>
46 #include <vector>
47 
50 
51 namespace tawara
52 {
60  public boost::equality_comparable<Block>
61  {
62  public:
64  typedef boost::shared_ptr<Block> Ptr;
66  typedef boost::shared_ptr<Block const> ConstPtr;
67 
70  {
76  LACING_FIXED
77  };
79  typedef std::vector<char> Frame;
81  typedef boost::shared_ptr<Frame> FramePtr;
83  typedef std::vector<FramePtr>::value_type value_type;
85  typedef std::vector<FramePtr>::size_type size_type;
87  typedef std::vector<FramePtr>::reference reference;
89  typedef std::vector<FramePtr>::const_reference const_reference;
91  typedef std::vector<FramePtr>::iterator iterator;
93  typedef std::vector<FramePtr>::const_iterator const_iterator;
95  typedef std::vector<FramePtr>::reverse_iterator reverse_iterator;
97  typedef std::vector<FramePtr>::const_reverse_iterator
99 
106  Block(uint64_t track_number, int16_t timecode,
107  LacingType lacing=LACING_NONE)
108  {}
109 
111  virtual ~Block() = 0;
112 
119  virtual uint64_t track_number() const = 0;
121  virtual void track_number(uint64_t track_number) = 0;
122 
129  virtual int16_t timecode() const = 0;
131  virtual void timecode(int16_t timecode) = 0;
132 
138  virtual bool invisible() const = 0;
140  virtual void invisible(bool invisible) = 0;
141 
151  virtual LacingType lacing() const = 0;
153  virtual void lacing(LacingType lacing) = 0;
154 
161  virtual value_type& at(size_type pos) = 0;
168  virtual value_type const& at(size_type pos) const = 0;
169 
176  virtual value_type& operator[](size_type pos) = 0;
183  virtual value_type const& operator[](size_type pos) const = 0;
184 
186  virtual iterator begin() = 0;
188  virtual const_iterator begin() const = 0;
190  virtual iterator end() = 0;
192  virtual const_iterator end() const = 0;
194  virtual reverse_iterator rbegin() = 0;
196  virtual const_reverse_iterator rbegin() const = 0;
200  virtual reverse_iterator rend() = 0;
204  virtual const_reverse_iterator rend() const = 0;
205 
211  virtual bool empty() const = 0;
213  virtual size_type count() const = 0;
221  virtual size_type max_count() const = 0;
222 
224  virtual void clear() = 0;
225 
230  virtual void erase(iterator position) = 0;
236  virtual void erase(iterator first, iterator last) = 0;
237 
250  virtual void push_back(value_type const& value) = 0;
251 
267  virtual void resize(size_type count) = 0;
268 
273  virtual void swap(Block& other) {}
274  }; // class Block
275 }; // namespace tawara
276 
278 // group interfaces
279 
280 #endif // TAWARA_BLOCK_H_
281 
Block interface.
Definition: block.h:59
LacingType
Lacing types.
Definition: block.h:69
boost::shared_ptr< Frame > FramePtr
A pointer to a frame of data.
Definition: block.h:81
#define TAWARA_EXPORT
Definition: win_dll.h:51
std::vector< FramePtr >::const_iterator const_iterator
The constant random access iterator type.
Definition: block.h:93
std::vector< FramePtr >::reference reference
The reference type.
Definition: block.h:87
std::vector< FramePtr >::value_type value_type
The value type of this container.
Definition: block.h:83
boost::shared_ptr< Block const > ConstPtr
Constant pointer to a block.
Definition: block.h:66
boost::shared_ptr< Block > Ptr
Pointer to a block.
Definition: block.h:64
std::vector< char > Frame
The type of a single frame of data.
Definition: block.h:79
std::vector< FramePtr >::size_type size_type
The size type of this container.
Definition: block.h:85
std::vector< FramePtr >::reverse_iterator reverse_iterator
The reversed random access iterator type.
Definition: block.h:95
Block(uint64_t track_number, int16_t timecode, LacingType lacing=LACING_NONE)
Constructor.
Definition: block.h:106
std::vector< FramePtr >::const_reference const_reference
The constant reference type.
Definition: block.h:89
EBML-style lacing.
Definition: block.h:74
virtual void swap(Block &other)
Swaps the contents of this block with another.
Definition: block.h:273
std::vector< FramePtr >::const_reverse_iterator const_reverse_iterator
The constant reversed random access iterator type.
Definition: block.h:98
std::vector< FramePtr >::iterator iterator
The random access iterator type.
Definition: block.h:91