acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
strid_map.h
1#pragma once
2
3
4#include "acme/prototype/collection/string_map.h"
5
6//template < class PAYLOAD, typename ARG_VALUE = typename argument_of < PAYLOAD >::type >
7//using strid_map = atom_map_base < PAYLOAD,ARG_VALUE > ;
8
9template < class T >
10class CLASS_DECL_ACME string_to_pointer :
11 public string_to_ptr_base
12{
13public:
14
15
16 class pair
17 {
18 public:
19
20 template < typename TYPE > inline pair(TYPE *);
21
22 const string first;
23
24 T * second;
25
26 };
27
28
29 bool find(string key, T * & rValue) const
30 {
31 return string_to_ptr_base::find(key, rValue);
32 }
33 const pair *find(string key) const
34 {
35 return reinterpret_cast < const string_to_pointer::pair * > (string_to_ptr_base::find(key));
36 }
37 pair *find(string key)
38 {
39 return reinterpret_cast < string_to_pointer::pair * > (string_to_ptr_base::find(key));
40 }
41
42
43 T ** defer_get(string key)
44 {
45
46 return (T**) string_to_ptr_base::defer_get(key);
47
48 }
49
50
51 T * get(string key)
52 {
53
54 T ** p = (T **) string_to_ptr_base::defer_get(key);
55
56 if (p == nullptr)
57 {
58
59 return nullptr;
60
61 }
62 else
63 {
64
65 return (T *)*p;
66
67 }
68
69 }
70
71
72
73 // find and add if not there
74 T * & operator[](string key)
75 {
76 return (T * &) string_to_ptr_base::operator[](key);
77 }
78
79
80// pair * get_start()
81// {
82// return (pair *) string_to_ptr_base::get_start();
83// }
84//
85// pair * get_next(pair * & rPpair)
86// {
87// return (pair *) string_to_ptr_base::get_next((string_to_ptr_base::pair * &) rPpair);
88// }
89
90};
91
92
93
94#define stridsp(ca) strid_map < ::pointer<ca >>
95
Definition _template_forward_declaration.h:327
Definition strid_map.h:17
Definition strid_map.h:12