stlemitter.h
Go to the documentation of this file.
1 #ifndef STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
2 #define STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
3 
4 #if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
5 #pragma once
6 #endif
7 
8 
9 #include <vector>
10 #include <list>
11 #include <set>
12 #include <map>
13 
14 namespace YAML_PM
15 {
16  template<typename Seq>
17  inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) {
18  emitter << BeginSeq;
19  for(typename Seq::const_iterator it=seq.begin();it!=seq.end();++it)
20  emitter << *it;
21  emitter << EndSeq;
22  return emitter;
23  }
24 
25  template<typename T>
26  inline Emitter& operator << (Emitter& emitter, const std::vector<T>& v) {
27  return EmitSeq(emitter, v);
28  }
29 
30  template<typename T>
31  inline Emitter& operator << (Emitter& emitter, const std::list<T>& v) {
32  return EmitSeq(emitter, v);
33  }
34 
35  template<typename T>
36  inline Emitter& operator << (Emitter& emitter, const std::set<T>& v) {
37  return EmitSeq(emitter, v);
38  }
39 
40  template <typename K, typename V>
41  inline Emitter& operator << (Emitter& emitter, const std::map<K, V>& m) {
42  typedef typename std::map <K, V> map;
43  emitter << BeginMap;
44  for(typename map::const_iterator it=m.begin();it!=m.end();++it)
45  emitter << Key << it->first << Value << it->second;
46  emitter << EndMap;
47  return emitter;
48  }
49 }
50 
51 #endif // STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
YAML_PM
Definition: aliasmanager.h:11
YAML_PM::BeginMap
@ BeginMap
Definition: emittermanip.h:55
YAML_PM::EndSeq
@ EndSeq
Definition: emittermanip.h:50
YAML_PM::Value
@ Value
Definition: emittermanip.h:58
YAML_PM::EmitSeq
Emitter & EmitSeq(Emitter &emitter, const Seq &seq)
Definition: stlemitter.h:17
YAML_PM::operator<<
Emitter & operator<<(Emitter &emitter, const std::string &v)
Definition: emitter.h:148
YAML_PM::Emitter
Definition: emitter.h:23
YAML_PM::BeginSeq
@ BeginSeq
Definition: emittermanip.h:49
YAML_PM::EndMap
@ EndMap
Definition: emittermanip.h:56
YAML_PM::Key
@ Key
Definition: emittermanip.h:57


mp2p_icp
Author(s):
autogenerated on Fri Dec 20 2024 03:46:00