HiRISE
 PDS_JP2

JP2_Box.hh
Go to the documentation of this file.
1/* JP2_Box
2
3HiROC CVS ID: JP2_Box.hh,v 1.4 2007/10/20 00:39:47 castalia Exp
4
5Copyright (C) 2007 Arizona Board of Regents on behalf of the
6Planetary Image Research Laboratory, Lunar and Planetary Laboratory at
7the University of Arizona.
8
9This library is free software; you can redistribute it and/or modify it
10under the terms of the GNU Lesser General Public License, version 2.1,
11as published by the Free Software Foundation.
12
13This library is distributed in the hope that it will be useful, but
14WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16Lesser General Public License for more details.
17
18You should have received a copy of the GNU Lesser General Public License
19along with this library; if not, write to the Free Software Foundation,
20Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21*/
22
23#ifndef _JP2_Box_
24#define _JP2_Box_
25
26#include <string>
27#include <vector>
28
29
30namespace UA
31{
32namespace HiRISE
33{
40{
41public:
42/*==============================================================================
43 Types:
44*/
46typedef std::vector<JP2_Box*> JP2_Box_List;
47
48/*==============================================================================
49 Constants:
50*/
52static const char* const
54
56static const unsigned int
59static const unsigned int
62static const unsigned int
65static const unsigned int
67
69static const unsigned int
71
73static const unsigned int
75
77static const unsigned int
79
81static const unsigned int
83
85static const unsigned int
87
88/*==============================================================================
89 Constructors:
90*/
93JP2_Box ();
94
110explicit JP2_Box (unsigned int box_type,
111 const unsigned char* data = NULL, unsigned int amount = 0);
112
119explicit JP2_Box (unsigned int box_type, const std::string& text);
120
126virtual ~JP2_Box ();
127
128/*==============================================================================
129 Accessors:
130*/
142std::string type_name () const
143 {return Type ? type_name (Type) : "";}
144
153JP2_Box& type_name (const std::string& name);
154
162unsigned int type_code () const
163 {return Type;}
164
172JP2_Box& type_code (unsigned int box_type);
173
182unsigned int content_amount () const
183 {return Content_Amount;}
184
190unsigned char* content () const
191 {return Content;}
192
208JP2_Box& content (const unsigned char* data, unsigned int amount = 0);
209
223JP2_Box& content (const std::string& text);
224
243
256JP2_Box& attach_content (unsigned char* data, unsigned int amount = 0);
257
258/*==============================================================================
259 Manipulators:
260*/
281JP2_Box& append_content (const unsigned char* data, unsigned int amount);
282
295JP2_Box& append_content (const std::string& text);
296
297//------------------------------------------------------------------------------
298// Sub-boxes
299
315JP2_Box& add (JP2_Box* sub_box);
316
325JP2_Box& add (JP2_Box& sub_box)
326 {return add (&sub_box);}
327
343bool remove (JP2_Box* sub_box);
344
358
366 {return Container;}
367
368/*==============================================================================
369 Helpers
370*/
382static std::string type_name (unsigned int box_type);
383
398static unsigned int type_code (const std::string& name);
399
400/*==============================================================================
401 Data members:
402*/
403protected:
404
406unsigned int
408
410unsigned char
412
414unsigned int
416
418bool
420
424
428
429}; // class JP2_Box
430
431
432} // namespace HiRISE
433} // namespace UA
434#endif
435
JP2_Box()
Construct a JP2_Box with no data content.
Definition JP2_Box.cc:127
A JP2_Box contains JP2 file format box data.
Definition JP2_Box.hh:40
JP2_Box_List & sub_boxes()
Get the list of sub-boxes contained in this box.
Definition JP2_Box.hh:356
bool remove(JP2_Box *sub_box)
Remove a sub-box from this box.
Definition JP2_Box.cc:389
JP2_Box * container() const
Get the container of this box.
Definition JP2_Box.hh:365
JP2_Box & add(JP2_Box *sub_box)
Add a sub-box to this box.
Definition JP2_Box.cc:350
unsigned char * content() const
Get the box data content.
Definition JP2_Box.hh:190
unsigned int content_amount() const
Get the box data content amount.
Definition JP2_Box.hh:182
virtual ~JP2_Box()
Destroy this JP2_Box.
Definition JP2_Box.cc:181
unsigned int type_code() const
Get the type code of the box.
Definition JP2_Box.hh:162
static const unsigned int LABEL_BOX_TYPE
Label box type.
Definition JP2_Box.hh:82
static const unsigned int UUID_LIST_BOX_TYPE
UUID List box type.
Definition JP2_Box.hh:66
JP2_Box & attach_content(unsigned char *data, unsigned int amount=0)
Set the box data content.
Definition JP2_Box.cc:330
static const unsigned int UUID_BOX_TYPE
UUID box type.
Definition JP2_Box.hh:57
JP2_Box & add(JP2_Box &sub_box)
Add a sub-box to this box.
Definition JP2_Box.hh:325
unsigned int Content_Amount
The amount (bytes) of content data.
Definition JP2_Box.hh:415
static const unsigned int UUID_SIZE
Size of the UUID data content.
Definition JP2_Box.hh:60
unsigned char * Content
The data content buffer.
Definition JP2_Box.hh:411
unsigned int Type
The JP2 box type code.
Definition JP2_Box.hh:407
static const unsigned int URL_BOX_TYPE
URL box type.
Definition JP2_Box.hh:70
JP2_Box_List Sub_Boxes
List of boxes contained in this box.
Definition JP2_Box.hh:427
std::string type_name() const
Get the type name of the box.
Definition JP2_Box.hh:142
bool locally_owned_content() const
Test if the box data content buffer is locally owned.
Definition JP2_Box.hh:241
static const unsigned int ASSOCIATION_BOX_TYPE
Association box type.
Definition JP2_Box.hh:78
JP2_Box()
Construct a JP2_Box with no data content.
Definition JP2_Box.cc:127
static const unsigned int UUID_INFO_BOX_TYPE
UUID Info box type.
Definition JP2_Box.hh:63
bool Locally_Owned_Content
Flag for a locally owned data content buffer.
Definition JP2_Box.hh:419
static const unsigned int INTELLECTUAL_PROPERTY_BOX_TYPE
Intellectual Property box type.
Definition JP2_Box.hh:86
JP2_Box & append_content(const unsigned char *data, unsigned int amount)
Append data to the box data content.
Definition JP2_Box.cc:268
std::vector< JP2_Box * > JP2_Box_List
List of JP2 boxes.
Definition JP2_Box.hh:46
JP2_Box * Container
Pointer to the JP2_Box that contains this box.
Definition JP2_Box.hh:423
static const char *const ID
Class identification name with source code version and date.
Definition JP2_Box.hh:53
static const unsigned int XML_BOX_TYPE
XML box type.
Definition JP2_Box.hh:74
Definition Dimensions.cc:32
Definition Dimensions.cc:30
kdu_uint32 box_type(const char *box_name)
Definition relocate_label.cc:813