Odil
A C++11 library for the DICOM standard
|
A sequence of fields forming a full PDU or a part of it. More...
#include <Item.h>
Classes | |
class | Field |
Generic field. More... | |
Public Types | |
typedef std::vector< std::pair< std::string, Field > > | Container |
typedef Container::const_iterator | const_iterator |
Public Member Functions | |
Item () | |
Create an empty PDU item. | |
Item (std::vector< std::pair< std::string, Field > > const &fields) | |
Create an initialized PDU item. | |
Item & | add (std::string const &name, Field const &field) |
Add a new field to the PDU item. | |
Container::size_type | size () const |
Return the number of fields. | |
bool | empty () const |
Test whether the container is empty. | |
bool | has_field (std::string const &name) const |
Test whether the PDU item contains a field with a given name. | |
Field const & | operator[] (std::string const &name) const |
Return the named field. Raise an exception if no such field exists. | |
Field & | operator[] (std::string const &name) |
Return the named field. Raise an exception if no such field exists. | |
uint8_t | as_unsigned_int_8 (std::string const &name) const |
Return the named field as an uint8_t. | |
uint8_t & | as_unsigned_int_8 (std::string const &name) |
Return the named field as an uint8_t. | |
uint16_t | as_unsigned_int_16 (std::string const &name) const |
Return the named field as an uint16_t. | |
uint16_t & | as_unsigned_int_16 (std::string const &name) |
Return the named field as an uint16_t. | |
uint32_t | as_unsigned_int_32 (std::string const &name) const |
Return the named field as an uint32_t. | |
uint32_t & | as_unsigned_int_32 (std::string const &name) |
Return the named field as an uint32_t. | |
std::string const & | as_string (std::string const &name) const |
Return the named field as a string. | |
std::string & | as_string (std::string const &name) |
Return the named field as a sequence of items. | |
std::vector< Item > const & | as_items (std::string const &name) const |
std::vector< Item > & | as_items (std::string const &name) |
Return the named field as a sequence of items. | |
const_iterator | begin () const |
const_iterator | end () const |
void | read (std::istream &stream, std::string const &name, Field::Type type, std::streamsize size=0) |
Read a field from a stream. | |
A sequence of fields forming a full PDU or a part of it.
typedef Container::const_iterator odil::pdu::Item::const_iterator |
typedef std::vector<std::pair<std::string, Field> > odil::pdu::Item::Container |
odil::pdu::Item::Item | ( | ) |
Create an empty PDU item.
odil::pdu::Item::Item | ( | std::vector< std::pair< std::string, Field > > const & | fields | ) |
Create an initialized PDU item.
Add a new field to the PDU item.
std::vector< Item > & odil::pdu::Item::as_items | ( | std::string const & | name | ) |
Return the named field as a sequence of items.
Raise an exception if no such field exists or if the field does not contain a sequence of items.
std::vector< Item > const & odil::pdu::Item::as_items | ( | std::string const & | name | ) | const |
std::string & odil::pdu::Item::as_string | ( | std::string const & | name | ) |
Return the named field as a sequence of items.
Raise an exception if no such field exists or if the field does not contain a sequence of items.
std::string const & odil::pdu::Item::as_string | ( | std::string const & | name | ) | const |
Return the named field as a string.
Raise an exception if no such field exists or if the field does not contain a string.
uint16_t & odil::pdu::Item::as_unsigned_int_16 | ( | std::string const & | name | ) |
Return the named field as an uint16_t.
Raise an exception if no such field exists or if the field does not contain an uint16_t.
uint16_t odil::pdu::Item::as_unsigned_int_16 | ( | std::string const & | name | ) | const |
Return the named field as an uint16_t.
Raise an exception if no such field exists or if the field does not contain an uint16_t.
uint32_t & odil::pdu::Item::as_unsigned_int_32 | ( | std::string const & | name | ) |
Return the named field as an uint32_t.
Raise an exception if no such field exists or if the field does not contain an uint32_t.
uint32_t odil::pdu::Item::as_unsigned_int_32 | ( | std::string const & | name | ) | const |
Return the named field as an uint32_t.
Raise an exception if no such field exists or if the field does not contain an uint32_t.
uint8_t & odil::pdu::Item::as_unsigned_int_8 | ( | std::string const & | name | ) |
Return the named field as an uint8_t.
Raise an exception if no such field exists or if the field does not contain an uint8_t.
uint8_t odil::pdu::Item::as_unsigned_int_8 | ( | std::string const & | name | ) | const |
Return the named field as an uint8_t.
Raise an exception if no such field exists or if the field does not contain an uint8_t.
const_iterator odil::pdu::Item::begin | ( | ) | const |
bool odil::pdu::Item::empty | ( | ) | const |
Test whether the container is empty.
const_iterator odil::pdu::Item::end | ( | ) | const |
bool odil::pdu::Item::has_field | ( | std::string const & | name | ) | const |
Test whether the PDU item contains a field with a given name.
Field & odil::pdu::Item::operator[] | ( | std::string const & | name | ) |
Return the named field. Raise an exception if no such field exists.
Field const & odil::pdu::Item::operator[] | ( | std::string const & | name | ) | const |
Return the named field. Raise an exception if no such field exists.
void odil::pdu::Item::read | ( | std::istream & | stream, |
std::string const & | name, | ||
Field::Type | type, | ||
std::streamsize | size = 0 |
||
) |
Read a field from a stream.
The size parameter is ignored for non-string types.
Container::size_type odil::pdu::Item::size | ( | ) | const |
Return the number of fields.