00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00026 #ifndef IH_SENF_Packets_ListBParser_
00027 #define IH_SENF_Packets_ListBParser_ 1
00028
00029
00030 #include "ListParser.ih"
00031
00032
00033
00034 namespace senf {
00035 namespace detail {
00036
00041 template <class ElementParser, class AuxPolicy>
00042 struct ListBParser_Policy
00043 : public AuxPolicy
00044 {
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 struct container_policy;
00071
00072 typedef PacketParserBase::data_iterator data_iterator;
00073 typedef PacketParserBase::state_type state_type;
00074 typedef PacketParserBase::size_type size_type;
00075
00076 typedef ElementParser element_type;
00077 typedef ListParser< ListBParser_Policy > parser_type;
00078 typedef ListParser_Container< container_policy > container_type;
00079
00080 static const size_type init_bytes = AuxPolicy::aux_bytes;
00081
00082 ListBParser_Policy();
00083 template <class Arg> ListBParser_Policy(Arg const & arg);
00084
00085 size_type bytes (data_iterator i, state_type s) const;
00086 size_type size (data_iterator i, state_type s) const;
00087 void init (data_iterator i, state_type s) const;
00088
00090 struct container_policy
00091 : public AuxPolicy::WrapperPolicy
00092 {
00093 typedef PacketParserBase::data_iterator data_iterator;
00094 typedef PacketParserBase::state_type state_type;
00095 typedef PacketParserBase::size_type size_type;
00096
00097 typedef ListBParser_Policy<ElementParser, AuxPolicy> parser_policy;
00098 typedef typename parser_policy::element_type element_type;
00099 typedef typename parser_policy::parser_type parser_type;
00100 typedef typename parser_policy::container_type container_type;
00101
00102 static const size_type init_bytes = parser_policy::init_bytes;
00103
00104 container_policy(parser_policy const & p);
00105
00106 size_type bytes (data_iterator i, state_type s) const;
00107 size_type size (data_iterator i, state_type s) const;
00108 void init (data_iterator i, state_type s);
00109
00110 void construct (container_type & c) const;
00111 void destruct (container_type & c) const;
00112 void erase (container_type & c, data_iterator p);
00113 void insert (container_type & c, data_iterator p);
00114 void update (container_type const & c) const;
00115
00117 struct iterator_data {};
00118
00119 data_iterator setBegin (container_type const & c, iterator_data & d) const;
00120 data_iterator setEnd (container_type const & c, iterator_data & d) const;
00121 void setFromPosition (container_type const & c, iterator_data & d,
00122 data_iterator p) const;
00123
00124 data_iterator next (container_type const & c, iterator_data & d) const;
00125 data_iterator raw (container_type const & c, iterator_data const & d) const;
00126
00127 size_type n_;
00128 mutable size_type container_size_;
00129 };
00130 };
00131
00132 #ifndef DOXYGEN
00133
00134 template <class ElementParser, class AuxPolicy>
00135 struct ListParserPolicy<ElementParser, AuxPolicy, senf::detail::auxtag::bytes>
00136 {
00137 typedef ListBParser_Policy<ElementParser, AuxPolicy> type;
00138 };
00139
00140 template <class ElementParser, class AuxPolicy, class Transform>
00141 struct ListParserPolicy<ElementParser, AuxPolicy,
00142 senf::detail::auxtag::transform<Transform,
00143 senf::detail::auxtag::bytes> >
00144 {
00145 typedef ListBParser_Policy< ElementParser,
00146 TransformAuxParserPolicy<AuxPolicy, Transform> > type;
00147 };
00148
00149 #endif
00150
00151 }}
00152
00153
00154 #endif
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165