field_iterator.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __INTERFACE_FIELD_ITERATOR_H__
00026 #define __INTERFACE_FIELD_ITERATOR_H__
00027
00028 #include <interface/types.h>
00029
00030 #define __STD_LIMIT_MACROS
00031 #include <stdint.h>
00032
00033 namespace fawkes {
00034 class Interface;
00035 class Message;
00036
00037 class InterfaceFieldIterator
00038 {
00039 friend class Interface;
00040 friend class Message;
00041
00042 public:
00043 InterfaceFieldIterator();
00044 InterfaceFieldIterator(const InterfaceFieldIterator &fit);
00045 ~InterfaceFieldIterator();
00046 InterfaceFieldIterator & operator++ ();
00047 InterfaceFieldIterator operator++ (int inc);
00048 InterfaceFieldIterator & operator+ (unsigned int i);
00049 InterfaceFieldIterator & operator+= (unsigned int i);
00050 bool operator== (const InterfaceFieldIterator & fit) const;
00051 bool operator!= (const InterfaceFieldIterator & fit) const;
00052 const void * operator* () const;
00053 InterfaceFieldIterator & operator= (const InterfaceFieldIterator & fit);
00054
00055 interface_fieldtype_t get_type() const;
00056 const char * get_typename() const;
00057 const char * get_name() const;
00058 const void * get_value() const;
00059 const char * get_value_string();
00060 size_t get_length() const;
00061 bool get_bool(unsigned int index = 0) const;
00062 int8_t get_int8(unsigned int index = 0) const;
00063 uint8_t get_uint8(unsigned int index = 0) const;
00064 int16_t get_int16(unsigned int index = 0) const;
00065 uint16_t get_uint16(unsigned int index = 0) const;
00066 int32_t get_int32(unsigned int index = 0) const;
00067 uint32_t get_uint32(unsigned int index = 0) const;
00068 int64_t get_int64(unsigned int index = 0) const;
00069 uint64_t get_uint64(unsigned int index = 0) const;
00070 float get_float(unsigned int index = 0) const;
00071 uint8_t get_byte(unsigned int index = 0) const;
00072 bool * get_bools() const;
00073 int8_t * get_int8s() const;
00074 uint8_t * get_uint8s() const;
00075 int16_t * get_int16s() const;
00076 uint16_t * get_uint16s() const;
00077 int32_t * get_int32s() const;
00078 uint32_t * get_uint32s() const;
00079 int64_t * get_int64s() const;
00080 uint64_t * get_uint64s() const;
00081 float * get_floats() const;
00082 uint8_t * get_bytes() const;
00083 const char * get_string() const;
00084
00085 void set_bool(bool b, unsigned int index = 0);
00086 void set_int8(int8_t i, unsigned int index = 0);
00087 void set_uint8(uint8_t i, unsigned int index = 0);
00088 void set_int16(int16_t i, unsigned int index = 0);
00089 void set_uint16(uint16_t i, unsigned int index = 0);
00090 void set_int32(int32_t i, unsigned int index = 0);
00091 void set_uint32(uint32_t i, unsigned int index = 0);
00092 void set_int64(int64_t i, unsigned int index = 0);
00093 void set_uint64(uint64_t i, unsigned int index = 0);
00094 void set_float(float f, unsigned int index = 0);
00095 void set_byte(uint8_t b, unsigned int index = 0);
00096 void set_bools(bool *b);
00097 void set_int8s(int8_t *i);
00098 void set_uint8s(uint8_t *i);
00099 void set_int16s(int16_t *i);
00100 void set_uint16s(uint16_t *i);
00101 void set_int32s(int32_t *i);
00102 void set_uint32s(uint32_t *i);
00103 void set_int64s(int64_t *i);
00104 void set_uint64s(uint64_t *i);
00105 void set_floats(float *f);
00106 void set_bytes(uint8_t* b);
00107 void set_string(const char* s);
00108
00109 protected:
00110 InterfaceFieldIterator(const Interface *interface,
00111 const interface_fieldinfo_t *info_list);
00112
00113 private:
00114 const interface_fieldinfo_t *__infol;
00115 char *__value_string;
00116 const Interface *__interface;
00117 };
00118
00119 }
00120
00121 #endif