A JP2_Box contains JP2 file format box data.
More...
#include <JP2_Box.hh>
|
| static std::string | type_name (unsigned int box_type) |
| | Convert a JP2 box type code to a string.
|
| static unsigned int | type_code (const std::string &name) |
| | Convert a JP2 box type string to an integer code.
|
|
| static const char *const | ID |
| | Class identification name with source code version and date.
|
| static const unsigned int | UUID_BOX_TYPE = 0x75756964 |
| | UUID box type.
|
| static const unsigned int | UUID_SIZE = 16 |
| | Size of the UUID data content.
|
| static const unsigned int | UUID_INFO_BOX_TYPE = 0x75696E66 |
| | UUID Info box type.
|
| static const unsigned int | UUID_LIST_BOX_TYPE = 0x756C7374 |
| | UUID List box type.
|
| static const unsigned int | URL_BOX_TYPE = 0x75726C20 |
| | URL box type.
|
| static const unsigned int | XML_BOX_TYPE = 0x786D6C20 |
| | XML box type.
|
| static const unsigned int | ASSOCIATION_BOX_TYPE = 0X61736F63 |
| | Association box type.
|
| static const unsigned int | LABEL_BOX_TYPE = 0X6C626C20 |
| | Label box type.
|
| static const unsigned int | INTELLECTUAL_PROPERTY_BOX_TYPE = 0x6A703269 |
| | Intellectual Property box type.
|
A JP2_Box contains JP2 file format box data.
- Author
- Bradford Castalia; UA/HiROC
- Version
- 1.4
◆ JP2_Box_List
◆ JP2_Box() [1/3]
Construct a JP2_Box with no data content.
Construct JP2_Box with no content.
◆ JP2_Box() [2/3]
| JP2_Box |
( |
unsigned int | box_type, |
|
|
const unsigned char * | data = NULL, |
|
|
unsigned int | amount = 0 ) |
|
explicit |
Construct a JP2_Box of some type and with optional data content.
- Parameters
-
| box_type | The 32-bit integer box type code value. |
| amount | The number of data content bytes. If zero the box will be emptied and the data will be ignored. |
| data | A pointer (const unsigned char*) to the data content. N.B.: The data will be copied to a locally owned data buffer. If NULL the box will be emptied and the amount will be ignored. |
- Exceptions
-
| invalid_argument | If a type code byte value does not correspond to a printable character (<32 or >126). |
| length_error | If insufficient memory is available to allocate the data content buffer. |
- See also
- content(unsigned int, const unsigned char*)
◆ JP2_Box() [3/3]
| JP2_Box |
( |
unsigned int | box_type, |
|
|
const std::string & | text ) |
|
explicit |
◆ ~JP2_Box()
◆ type_name() [1/3]
| std::string type_name |
( |
| ) |
const |
|
inline |
Get the type name of the box.
The type name is the string representation of the type code bytes that are stored as the second value of each JP2 box.
- Returns
- The type name of the box. This will be the empty string if the box is undefined.
- Exceptions
-
| invalid_argument | If the type code is an invalid value. |
- See also
- type_name(unsigned int)
◆ type_name() [2/3]
| JP2_Box & type_name |
( |
const std::string & | name | ) |
|
Set the type name of the box.
- Parameters
-
| name | The type name to be applied to the JP2 box. |
- Returns
- This JP2_Box.
- Exceptions
-
| invalid_argument | If the string does not contain exactly four characters or any character is not printable (<32 or >126). |
- See also
- type_code(const std::string&)
◆ type_name() [3/3]
| std::string type_name |
( |
unsigned int | box_type | ) |
|
|
static |
Convert a JP2 box type code to a string.
Each byte, starting with the most significant byte, of the type value is appended as a character to a string.
- Parameters
-
| box_type | The box type code value to be converted. |
- Returns
- The string repesentation of the type value.
- Exceptions
-
| invalid_argument | If a type code byte value does not correspond to a printable character (<32 or >126). |
- See also
- type_code(const std::string)
◆ type_code() [1/3]
| unsigned int type_code |
( |
| ) |
const |
|
inline |
Get the type code of the box.
The type code is the second value of each JP2 box.
- Returns
- The JP2 box type code value. This will be zero if the box is undefined.
◆ type_code() [2/3]
| JP2_Box & type_code |
( |
unsigned int | box_type | ) |
|
Set the type code of the box.
- Parameters
-
| box_type | The 32-bit integer box type code value. |
- Returns
- This JP2_Box.
- Exceptions
-
| invalid_argument | If a type code byte value does not correspond to a printable character (<32 or >126). |
◆ type_code() [3/3]
| unsigned int type_code |
( |
const std::string & | name | ) |
|
|
static |
Convert a JP2 box type string to an integer code.
Each character of the string is placed as a byte value in the corresponding location of the type code, starting with the most significant byte.
- Parameters
-
| name | The type name string to be converted. |
- Returns
- The integer type code value.
- Exceptions
-
| invalid_argument | If the string does not contain exactly four characters or any character is not printable (<32 or >126). |
- See also
- type_name(unsigned int)
◆ content_amount()
| unsigned int content_amount |
( |
| ) |
const |
|
inline |
Get the box data content amount.
The box data content amount is the size of the content buffer, in bytes.
- Returns
- The size of the box data content data buffer, in bytes. This will be zero if the box has no data content.
◆ content() [1/3]
| unsigned char * content |
( |
| ) |
const |
|
inline |
Get the box data content.
- Returns
- A pointer to the box data content as an unsigned char*. Caution: The box data content is not copied.
◆ content() [2/3]
| JP2_Box & content |
( |
const unsigned char * | data, |
|
|
unsigned int | amount = 0 ) |
Set the box data content.
Any current content is replaced.
- Parameters
-
| data | A pointer (const unsigned char*) to the data content. N.B.: The data will be copied to a locally owned content buffer. If NULL the box will be emptied and the amount will be ignored. |
| amount | The number of data bytes. If zero the box will be emptied and the data will be ignored. |
- Returns
- This JP2_Box.
- Exceptions
-
| length_error | If insufficient memory is available to allocate the data content buffer. |
- See also
- attach_content(unsigned int, unsigned char*)
◆ content() [3/3]
| JP2_Box & content |
( |
const std::string & | text | ) |
|
Set the box data content.
Any current content is replaced.
The characters of the string, plus a terminating zero-value character, are copied into the box content.
- Parameters
-
| text | The text string to be set as the box content. |
- Returns
- This JP2_Box.
- Exceptions
-
| length_error | If insufficient memory is available to allocate the data content buffer. |
- See also
- content(unsigned int, const unsigned char*)
◆ locally_owned_content()
| bool locally_owned_content |
( |
| ) |
const |
|
inline |
Test if the box data content buffer is locally owned.
A locally owned data content buffer has been allocated by the JP2_Box and will be deleted when the JP2_Box is destroyed. If the data content buffer was attached to the JP2_Box it is externally owned and will not be deleted when the JP2_Box is destroyed; in this case it is the responsibility of the data buffer owner to ensure that the buffer remains valid until the JP2_Box will no longer be used.
N.B.: Data content that is not locally owned will not be freed when the JP2_Box is destroyed.
- Returns
- true if the data content buffer is locally owned, false otherwise.
◆ attach_content()
| JP2_Box & attach_content |
( |
unsigned char * | data, |
|
|
unsigned int | amount = 0 ) |
Set the box data content.
Any current content is replaced.
- Parameters
-
| data | A pointer (const unsigned char*) to the data content. N.B.: The data data will not be copied. If NULL the box will be emptied and the amount will be ignored. |
| amount | The number of data bytes. If zero the box will be emptied and the data will be ignored. |
- Returns
- This JP2_Box.
- See also
- content(unsigned int, const unsigned char*)
◆ append_content() [1/2]
| JP2_Box & append_content |
( |
const unsigned char * | data, |
|
|
unsigned int | amount ) |
Append data to the box data content.
N.B.: Data can only be appended to locally owned content.
A new data content buffer is provided that is the size of the current content amount plus the amount of new data. The current content and new data are copied into the new buffer. The previous buffer is deleted, the new buffer becomes the current content and content amount is updated.
- Parameters
-
| amount | The number of data bytes. If zero nothing is done. |
| data | A pointer (const unsigned char*) to the additional data content. If NULL nothing is done. |
- Returns
- This JP2_Box.
- Exceptions
-
| logic_error | If there is a non-zero amount of content that is not locally owned. |
| length_error | If insufficient memory is available to allocate the data content buffer. |
◆ append_content() [2/2]
| JP2_Box & append_content |
( |
const std::string & | text | ) |
|
Append text to the box data content.
N.B.: Data can only be appended to locally owned content.
The characters of the text string, plus a terminating null character, are appended to the current box content.
- Parameters
-
| text | The text string to be appended to the box content. |
- Returns
- This JP2_Box.
◆ add() [1/2]
Add a sub-box to this box.
If the sub-box is contained in another box it is removed from its container.
The sub-box is added to the end of the list of sub-boxes and its container is set to this JP2_Box.
- Parameters
-
| sub_box | A pointer to the JP2_Box that is to be added to this box. If NULL nothing is done. |
- Returns
- This JP2_Box.
- Exceptions
-
| invalid_argument | If the sub-box is this JP2_Box. |
- See also
- remove(JP2_Box*)
◆ add() [2/2]
Add a sub-box to this box.
- Parameters
-
| sub_box | A pointer to the JP2_Box that is to be added to this box. If NULL nothing is done. |
- Returns
- This JP2_Box.
- Exceptions
-
| invalid_argument | If the sub-box is this JP2_Box. |
- See also
- add(JP2_Box*)
◆ remove()
Remove a sub-box from this box.
If the sub-box is found in the list of sub-boxes it is removed from the list and its container is set to NULL.
- Parameters
-
| sub_box | A pointer to the JP2_Box that is to be removed from this box. A NULL argument is allowed and will be used to remove a NULL entry if one is present, however this should not occur if the add method is always used to add sub-boxes to the box. |
- Returns
- true if the sub-box was removed, or false if the sub-box was not found in this box.
- See also
- add(JP2_Box*)
◆ sub_boxes()
Get the list of sub-boxes contained in this box.
Caution: The JP2_Box_List is a vector of JP2_Box pointers which can be manipulated (re-ordered, etc.) as desired, however adding and removing entries should only be done with the add and remove methods to maintain the correct container relationships.
- Returns
- A reference to the JP2_Box_List for this box.
◆ container()
Get the container of this box.
- Returns
- A pointer to the JP2_Box that has this box in its list of
sub-boxes. This will be NULL if this box is not contained in another box.
◆ ID
Initial value: =
"UA::HiRISE::JP2_Box (1.6 2010/11/24 03:32:14)"
Class identification name with source code version and date.
◆ UUID_BOX_TYPE
| const unsigned int UUID_BOX_TYPE = 0x75756964 |
|
static |
◆ UUID_SIZE
| const unsigned int UUID_SIZE = 16 |
|
static |
Size of the UUID data content.
Referenced by usage().
◆ UUID_INFO_BOX_TYPE
| const unsigned int UUID_INFO_BOX_TYPE = 0x75696E66 |
|
static |
◆ UUID_LIST_BOX_TYPE
| const unsigned int UUID_LIST_BOX_TYPE = 0x756C7374 |
|
static |
◆ URL_BOX_TYPE
| const unsigned int URL_BOX_TYPE = 0x75726C20 |
|
static |
◆ XML_BOX_TYPE
| const unsigned int XML_BOX_TYPE = 0x786D6C20 |
|
static |
◆ ASSOCIATION_BOX_TYPE
| const unsigned int ASSOCIATION_BOX_TYPE = 0X61736F63 |
|
static |
◆ LABEL_BOX_TYPE
| const unsigned int LABEL_BOX_TYPE = 0X6C626C20 |
|
static |
◆ INTELLECTUAL_PROPERTY_BOX_TYPE
| const unsigned int INTELLECTUAL_PROPERTY_BOX_TYPE = 0x6A703269 |
|
static |
Intellectual Property box type.
◆ Type
◆ Content
◆ Content_Amount
| unsigned int Content_Amount |
|
protected |
The amount (bytes) of content data.
◆ Locally_Owned_Content
| bool Locally_Owned_Content |
|
protected |
Flag for a locally owned data content buffer.
◆ Container
Pointer to the JP2_Box that contains this box.
◆ Sub_Boxes
List of boxes contained in this box.
The documentation for this class was generated from the following files: