VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtContainerInitializers.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 20012 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <map>
13 #include <list>
14 #include <vector>
15 #include <deque>
16 
17 
26 #define DEFINE_MAP_CREATOR(PREFIX, MAP_CLASS) \
27 template<typename K, typename V> \
28 class PREFIX##MapCreator \
29 { \
30 public: \
31  PREFIX##MapCreator(const K& key, const V& val) \
32  { \
33  myMap[key] = val; \
34  } \
35  \
36  PREFIX##MapCreator<K, V>& operator()(const K& key, const V& val) \
37  { \
38  myMap[key] = val; \
39  return *this; \
40  } \
41  \
42  operator MAP_CLASS<K, V>() \
43  { \
44  return myMap; \
45  } \
46  \
47 private: \
48  MAP_CLASS<K, V> myMap; \
49 } \
50 
51 
62 #define DEFINE_SEQUENCE_CREATOR(PREFIX, SEQUENCE, SEQUENCE_CLASS) \
63 template<typename V> \
64 class PREFIX##SEQUENCE##Creator \
65 { \
66 public: \
67  PREFIX##SEQUENCE##Creator(const V& val) \
68  { \
69  mySequence.push_back(val); \
70  } \
71  \
72  PREFIX##SEQUENCE##Creator<V>& operator()(const V& val) \
73  { \
74  mySequence.push_back(val); \
75  return *this; \
76  } \
77  \
78  operator SEQUENCE_CLASS<V>() \
79  { \
80  return mySequence; \
81  } \
82  \
83 private: \
84  SEQUENCE_CLASS<V> mySequence; \
85 }; \
86 
87 
88 namespace makVrv
89 {
90 
97  DEFINE_MAP_CREATOR(Std, std::map);
98 
105  DEFINE_SEQUENCE_CREATOR(Std, List, std::list);
106 
113  DEFINE_SEQUENCE_CREATOR(Std, Vector, std::vector);
114 
121  DEFINE_SEQUENCE_CREATOR(Std, Deque, std::deque);
122 
123 }

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)