9 #ifndef _1c7b57cc_79f5_497c_815c_920e0711a864
10 #define _1c7b57cc_79f5_497c_815c_920e0711a864
55 Field(std::string
const & value);
58 Field(std::vector<Item>
const & value);
139 std::vector<Item> _items;
142 typedef std::vector<std::pair<std::string, Field>>
Container;
148 Item(std::vector<std::pair<std::string, Field>>
const & fields);
154 Container::size_type
size()
const;
222 std::string
const &
as_string(std::string
const & name)
const;
232 std::vector<Item>
const &
as_items(std::string
const & name)
const;
240 std::vector<Item> &
as_items(std::string
const & name);
252 std::istream & stream,std::string
const & name,
Field::Type type,
253 std::streamsize size=0);
256 std::vector<std::pair<std::string, Field>> _fields;
Generic field.
Definition: Item.h:33
uint16_t & as_unsigned_int_16()
Return the uint16_t stored in the field.
uint32_t & as_unsigned_int_32()
Return the uint32_t stored in the field.
uint32_t as_unsigned_int_32() const
Return the uint32_t stored in the field.
Field(uint32_t value)
Constructor.
std::string & as_string()
Return the string stored in the field.
uint8_t as_unsigned_int_8() const
Return the uint8_t stored in the field.
Field(std::string const &value)
Constructor.
uint8_t & as_unsigned_int_8()
Return the uint8_t stored in the field.
Field(uint16_t value)
Constructor.
Type get_type() const
Return the concrete type stored in the field.
Field(std::vector< Item > const &value)
Constructor.
std::vector< Item > const & as_items() const
Return the items stored in the field.
Field(uint8_t value)
Constructor.
uint16_t as_unsigned_int_16() const
Return the uint16_t stored in the field.
std::vector< Item > & as_items()
Return the items stored in the field.
Type
Possible types stored in the field.
Definition: Item.h:37
std::string const & as_string() const
Return the string stored in the field.
A sequence of fields forming a full PDU or a part of it.
Definition: Item.h:29
uint32_t as_unsigned_int_32(std::string const &name) const
Return the named field as an uint32_t.
Field & operator[](std::string const &name)
Return the named field. Raise an exception if no such field exists.
std::vector< std::pair< std::string, Field > > Container
Definition: Item.h:142
std::string const & as_string(std::string const &name) const
Return the named field as a string.
Container::size_type size() const
Return the number of fields.
Container::const_iterator const_iterator
Definition: Item.h:242
std::string & as_string(std::string const &name)
Return the named field as a sequence of items.
uint8_t as_unsigned_int_8(std::string const &name) const
Return the named field as an uint8_t.
const_iterator end() const
uint32_t & as_unsigned_int_32(std::string const &name)
Return the named field as an uint32_t.
bool has_field(std::string const &name) const
Test whether the PDU item contains a field with a given name.
Item(std::vector< std::pair< std::string, Field >> const &fields)
Create an initialized PDU item.
const_iterator begin() const
uint16_t as_unsigned_int_16(std::string const &name) const
Return the named field as an uint16_t.
std::vector< Item > & as_items(std::string const &name)
Return the named field as a sequence of items.
Field const & operator[](std::string const &name) const
Return the named field. Raise an exception if no such field exists.
std::vector< Item > const & as_items(std::string const &name) const
Item()
Create an empty PDU item.
uint8_t & as_unsigned_int_8(std::string const &name)
Return the named field as an uint8_t.
Item & add(std::string const &name, Field const &field)
Add a new field to the PDU item.
bool empty() const
Test whether the container is empty.
uint16_t & as_unsigned_int_16(std::string const &name)
Return the named field as an uint16_t.
void read(std::istream &stream, std::string const &name, Field::Type type, std::streamsize size=0)
Read a field from a stream.
std::ostream & operator<<(std::ostream &stream, Item const &item)
Definition: Association.h:25
#define ODIL_API
Definition: odil.h:28