BTRFS: Implement BTree::Path and change _Find.
[haiku.git] / src / add-ons / media / media-add-ons / dvb / Packet.h
blob3de2401f9e95c1b8a37f2483e3bcded26112f5db
1 /*
2 * Copyright (c) 2004-2007 Marcus Overhagen <marcus@overhagen.de>
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without restriction,
7 * including without limitation the rights to use, copy, modify,
8 * merge, publish, distribute, sublicense, and/or sell copies of
9 * the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
25 #ifndef __PACKET_H
26 #define __PACKET_H
28 #include <SupportDefs.h>
30 class Packet
32 public:
33 Packet(size_t init_size = 8192);
34 Packet(const Packet &clone);
35 Packet(const void *data, size_t size, bigtime_t time_stamp = 0);
36 ~Packet();
38 void AddData(const void *data, size_t size);
40 void MakeEmpty();
42 const uint8 * Data() const;
43 size_t Size() const;
45 void SetTimeStamp(bigtime_t time_stamp);
46 bigtime_t TimeStamp() const;
49 private:
50 // not implemented
51 Packet & operator= (const Packet &clone);
53 private:
54 void * fBuffer;
55 size_t fBufferSize;
56 size_t fBufferSizeMax;
57 bigtime_t fTimeStamp;
61 inline const uint8 *
62 Packet::Data() const
64 return (uint8 *)fBuffer;
68 inline size_t
69 Packet::Size() const
71 return fBufferSize;
75 inline void
76 Packet::SetTimeStamp(bigtime_t time_stamp)
78 fTimeStamp = time_stamp;
82 inline bigtime_t
83 Packet::TimeStamp() const
85 return fTimeStamp;
89 inline void
90 Packet::MakeEmpty()
92 fBufferSize = 0;
93 fTimeStamp = 0;
97 #endif