00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef PCAP_LIST_OF_TRACES_HH_
00023 # define PCAP_LIST_OF_TRACES_HH_
00024
00025 # include <cstddef>
00026 # include <string>
00027 # include <utility>
00028 # include <vector>
00029
00030 # include <wipal/tool/list_of_iterables.hh>
00031 # include <wipal/pcap/descriptor.hh>
00032
00033 namespace pcapxx
00034 {
00035
00036 template <class Desc = descriptor<>, class Bottom = tool::bottom>
00037 struct list_of_traces:
00038 public tool::list_of_iterables<Desc,
00039 WP_GET_EXACT(Bottom,
00040 list_of_traces<Desc, Bottom>)>
00041 {
00042 typedef WP_GET_EXACT(Bottom, list_of_traces<Desc, Bottom>) exact_type;
00043 typedef tool::list_of_iterables<Desc, exact_type> super_type;
00044
00045 enum
00046 {
00047 trace_name_sep = ':',
00048 addr_sep = '=',
00049 escape_char = '\\'
00050 };
00051
00052 list_of_traces(const std::string& trace_names = "");
00053 list_of_traces(const list_of_traces& other);
00054
00055 list_of_traces&
00056 operator = (const list_of_traces& rhs);
00057
00058 const std::string& file_name() const;
00059 const tool::opt::list& metadata() const;
00060
00061 void expect(typename Desc::link_type l) const;
00062
00063 protected:
00064 static
00065 std::pair<std::string, size_t>
00066 parse_word(const std::string& trace_names,
00067 const size_t start,
00068 const std::set<char>& stop_seps);
00069
00070 static
00071 std::pair<std::vector<std::string>, std::string>
00072 parse(const std::string& trace_names);
00073
00074 void
00075 update_metadata(list_of_traces* p);
00076
00077 private:
00078 tool::opt::list meta_;
00079 };
00080
00081 }
00082
00083 namespace tool
00084 {
00085
00086 template <class Desc, class Bottom>
00087 struct types< pcapxx::list_of_traces<Desc, Bottom> >:
00088 public types< list_of_iterables<Desc,
00089 WP_GET_EXACT(Bottom,
00090 pcapxx::list_of_traces<Desc,
00091 Bottom>)> >
00092 {
00093 };
00094
00095 }
00096
00097 # include "list_of_traces.hxx"
00098
00099 #endif // ! PCAP_LIST_OF_TRACES_HH_