00001 #ifndef _IT_BUS_ELEMENT_LIST_T_H_
00002 #define _IT_BUS_ELEMENT_LIST_T_H_
00003
00004
00005
00006
00007 #include <it_bus/element_list.h>
00008 #include <it_bus/min_max_list_t.h>
00009 #include <it_bus/qname.h>
00010
00011 namespace IT_Reflect
00012 {
00013 template <class ListT, class T>
00014 class ElementListImplT;
00015 }
00016
00017 namespace IT_Bus
00018 {
00022 template<typename T>
00023 class ElementListT : public MinMaxListT<T>, public virtual ElementList
00024 {
00025 public:
00026 typedef IT_Reflect::ElementListImplT<ElementListT<T>, T>
00027 IT_ReflectionType;
00028
00032 ElementListT(
00033 const QName& item_name,
00034 const size_t min_occurs,
00035 const size_t max_occurs,
00036 const size_t list_size = 0
00037 ) : MinMaxListT<T>(min_occurs, max_occurs, list_size),
00038 m_item_name(item_name)
00039 {
00040
00041 }
00042
00046 ElementListT(
00047 const T & elem,
00048 const QName& item_name,
00049 const size_t min_occurs,
00050 const size_t max_occurs,
00051 const size_t list_size = 0
00052 ) : MinMaxListT<T>(elem, min_occurs, max_occurs, list_size),
00053 m_item_name(item_name)
00054 {
00055
00056 }
00057
00061 ElementListT(
00062 const size_t min_occurs = 0,
00063 const size_t max_occurs = 1,
00064 const size_t list_size = 0,
00065 const QName& item_name = QName::EMPTY_QNAME
00066 ) : MinMaxListT<T>(min_occurs, max_occurs, list_size),
00067 m_item_name(item_name)
00068 {
00069
00070 }
00071
00077 virtual void
00078 read_element(
00079 size_t pos,
00080 ComplexTypeReader & reader
00081 ) IT_THROW_DECL((DeserializationException))
00082 {
00083 MinMaxListT<T>::read_list_member(pos, m_item_name, reader);
00084 }
00085
00091 virtual void
00092 write_element(
00093 size_t pos,
00094 ComplexTypeWriter & writer
00095 ) const IT_THROW_DECL((SerializationException))
00096 {
00097 MinMaxListT<T>::write_list_member(pos, get_item_name(), writer);
00098 }
00099
00105 void
00106 set_item_name(
00107 const QName& item_name
00108 )
00109 {
00110 m_item_name = item_name;
00111 }
00112
00116 const QName &
00117 get_item_name() const
00118 {
00119 return m_item_name;
00120 }
00121
00127 size_t
00128 get_min_occurs() const
00129 {
00130 return MinMaxListT<T>::get_min_occurs();
00131 }
00132
00138 void
00139 set_min_occurs(
00140 size_t min_occurs
00141 )
00142 {
00143 MinMaxListT<T>::set_min_occurs(min_occurs);
00144 }
00145
00151 size_t
00152 get_max_occurs() const
00153 {
00154 return MinMaxListT<T>::get_max_occurs();
00155 }
00156
00162 void
00163 set_max_occurs(
00164 size_t max_occurs
00165 )
00166 {
00167 MinMaxListT<T>::set_max_occurs(max_occurs);
00168 }
00169
00175 void
00176 set_size(
00177 size_t new_size
00178 )
00179 {
00180 MinMaxListT<T>::set_size(new_size);
00181 }
00182
00188 size_t
00189 get_size() const
00190 {
00191 return MinMaxListT<T>::get_size();
00192 }
00193
00199 ElementListT&
00200 operator=(
00201 const IT_Vector<T> & rhs
00202 )
00203 {
00204 MinMaxListT<T>::operator=(rhs);
00205 return *this;
00206 }
00207
00213 ElementListT&
00214 operator=(
00215 const ElementListT & rhs
00216 )
00217 {
00218 *this = IT_DYNAMIC_CAST(const MinMaxListT<T>&, rhs);
00219 return *this;
00220 }
00221
00229 virtual AnyType&
00230 copy(
00231 const AnyType& rhs
00232 )
00233 {
00234 *this = IT_DYNAMIC_CAST(const ElementListT&, rhs);
00235 return *this;
00236 }
00237
00238 private:
00239 QName m_item_name;
00240 };
00241 }
00242
00243 #endif