HiRISE
 PDS_JP2

JP2_Box.hh

Go to the documentation of this file.
00001 /*  JP2_Box
00002 
00003 HiROC CVS ID: JP2_Box.hh,v 1.4 2007/10/20 00:39:47 castalia Exp
00004 
00005 Copyright (C) 2007  Arizona Board of Regents on behalf of the
00006 Planetary Image Research Laboratory, Lunar and Planetary Laboratory at
00007 the University of Arizona.
00008 
00009 This library is free software; you can redistribute it and/or modify it
00010 under the terms of the GNU Lesser General Public License, version 2.1,
00011 as published by the Free Software Foundation.
00012 
00013 This library is distributed in the hope that it will be useful, but
00014 WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 Lesser General Public License for more details.
00017 
00018 You should have received a copy of the GNU Lesser General Public License
00019 along with this library; if not, write to the Free Software Foundation,
00020 Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
00021 */
00022 
00023 #ifndef _JP2_Box_
00024 #define _JP2_Box_
00025 
00026 #include    <string>
00027 #include    <vector>
00028 
00029 
00030 namespace UA
00031 {
00032 namespace HiRISE
00033 {
00039 class JP2_Box
00040 {
00041 public:
00042 /*==============================================================================
00043     Types:
00044 */
00046 typedef std::vector<JP2_Box*>   JP2_Box_List;
00047 
00048 /*==============================================================================
00049     Constants:
00050 */
00052 static const char* const
00053     ID;
00054 
00056 static const unsigned int
00057     UUID_BOX_TYPE;
00059 static const unsigned int
00060     UUID_SIZE;
00062 static const unsigned int
00063     UUID_INFO_BOX_TYPE;
00065 static const unsigned int
00066     UUID_LIST_BOX_TYPE;
00067 
00069 static const unsigned int
00070     URL_BOX_TYPE;
00071 
00073 static const unsigned int
00074     XML_BOX_TYPE;
00075 
00077 static const unsigned int
00078     ASSOCIATION_BOX_TYPE;
00079 
00081 static const unsigned int
00082     LABEL_BOX_TYPE;
00083 
00085 static const unsigned int
00086     INTELLECTUAL_PROPERTY_BOX_TYPE;
00087 
00088 /*==============================================================================
00089     Constructors:
00090 */
00093 JP2_Box ();
00094 
00110 explicit JP2_Box (unsigned int box_type,
00111     const unsigned char* data = NULL, unsigned int amount = 0);
00112 
00119 explicit JP2_Box (unsigned int box_type, const std::string& text);
00120 
00126 virtual ~JP2_Box ();
00127 
00128 /*==============================================================================
00129     Accessors:
00130 */
00142 std::string type_name () const
00143     {return Type ? type_name (Type) : "";}
00144 
00153 JP2_Box& type_name (const std::string& name);
00154 
00162 unsigned int type_code () const
00163     {return Type;}
00164 
00172 JP2_Box& type_code (unsigned int box_type);
00173 
00182 unsigned int content_amount () const
00183     {return Content_Amount;}
00184 
00190 unsigned char* content () const
00191     {return Content;}
00192 
00208 JP2_Box& content (const unsigned char* data, unsigned int amount = 0);
00209 
00223 JP2_Box& content (const std::string& text);
00224 
00241 bool locally_owned_content () const
00242     {return Locally_Owned_Content;}
00243 
00256 JP2_Box& attach_content (unsigned char* data, unsigned int amount = 0);
00257 
00258 /*==============================================================================
00259     Manipulators:
00260 */
00281 JP2_Box& append_content (const unsigned char* data, unsigned int amount);
00282 
00295 JP2_Box& append_content (const std::string& text);
00296 
00297 //------------------------------------------------------------------------------
00298 //  Sub-boxes
00299 
00315 JP2_Box& add (JP2_Box* sub_box);
00316 
00325 JP2_Box& add (JP2_Box& sub_box)
00326     {return add (&sub_box);}
00327 
00343 bool remove (JP2_Box* sub_box);
00344 
00356 JP2_Box_List& sub_boxes ()
00357     {return Sub_Boxes;}
00358 
00365 JP2_Box* container () const
00366     {return Container;}
00367 
00368 /*==============================================================================
00369     Helpers
00370 */
00382 static std::string type_name (unsigned int box_type);
00383 
00398 static unsigned int type_code (const std::string& name);
00399 
00400 /*==============================================================================
00401     Data members:
00402 */
00403 protected:
00404 
00406 unsigned int
00407     Type;
00408 
00410 unsigned char
00411     *Content;
00412 
00414 unsigned int
00415     Content_Amount;
00416 
00418 bool
00419     Locally_Owned_Content;
00420 
00422 JP2_Box
00423     *Container;
00424 
00426 JP2_Box_List
00427     Sub_Boxes;
00428 
00429 };  //  class JP2_Box
00430 
00431 
00432 }   //  namespace HiRISE
00433 }   //  namespace UA
00434 #endif
00435 

Generated on Tue Jul 15 14:22:43 2008 for UA::HiRISE::PDS_JP2 by  doxygen 1.4.6