Tawara  0.1.0
seek_element.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_SEEK_ELEMENT_H_)
40 #define TAWARA_SEEK_ELEMENT_H_
41 
42 #include <ios>
43 #include <tawara/binary_element.h>
44 #include <tawara/el_ids.h>
45 #include <tawara/master_element.h>
46 #include <tawara/uint_element.h>
47 #include <tawara/win_dll.h>
48 
51 
52 namespace tawara
53 {
63  {
64  public:
72  SeekElement(ids::ID id, std::streampos offset);
73 
75  virtual ~SeekElement() {}
76 
78  ids::ID indexed_id() const;
80  void indexed_id(ids::ID id);
81 
83  std::streamsize offset() const { return offset_.value(); }
85  void offset(std::streamsize offset) { offset_.value(offset); }
86 
88  virtual std::streamsize write_body(std::ostream& output);
89 
90  protected:
93 
95  virtual std::streamsize body_size() const;
96 
98  virtual std::streamsize read_body(std::istream& input,
99  std::streamsize size);
100  }; // class SeekElement
101 }; // namespace tawara
102 
104 
105 #endif // TAWARA_SEEK_ELEMENT_H_
106 
UIntElement offset_
Definition: seek_element.h:92
void offset(std::streamsize offset)
Set the offset of the indexed ID.
Definition: seek_element.h:85
std::streamsize size(ID id)
Get the number of bytes required by an ID.
#define TAWARA_EXPORT
Definition: win_dll.h:51
The MasterElement interface.
Binary primitive element.
Unsigned integer primitive element.
Definition: uint_element.h:57
uint32_t ID
Definition: el_ids.h:60
std::streamsize offset() const
Get the offset of the indexed ID.
Definition: seek_element.h:83
virtual ~SeekElement()
Destructor.
Definition: seek_element.h:75
BinaryElement indexed_id_
Definition: seek_element.h:91
The Seek element, which contains a single index point in the SeekHead element.
Definition: seek_element.h:62