SST/macro
global_struct.h
Go to the documentation of this file.
1 /*
2  * This file is part of SST/macroscale:
3  * The macroscale architecture simulator from the SST suite.
4  * Copyright (c) 2009 Sandia Corporation.
5  * This software is distributed under the BSD License.
6  * Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
7  * the U.S. Government retains certain rights in this software.
8  * For more information, see the LICENSE file in the top
9  * SST/macroscale directory.
10  */
11 
12 #ifndef SSTMAC_SOFTWARE_PROCESS_GLOBAL_STRUCT_H_INCLUDED
13 #define SSTMAC_SOFTWARE_PROCESS_GLOBAL_STRUCT_H_INCLUDED
14 
16 
17 namespace sstmac {
18 namespace sw {
19 
20 template<typename T>
22 {
24  public:
25  explicit
27  }
28 
29  explicit
31  parent(init) {
32  }
33 
34  operator T*() {
35  return &parent::get_val();
36  }
37 
38  operator const T*() const {
39  return &parent::get_val();
40  }
41 
42  template<typename U>
43  T&
45  T*& myval = parent::get_val();
46  myval = (T*) b;
47  return myval;
48  }
49 
50  T&
51  operator=(T* b) {
52  T*& myval = parent::get_val();
53  myval = b;
54  return myval;
55  }
56 
57  template<typename U>
58  T&
59  operator=(const U &b) {
60  T& myval = parent::get_val();
61  myval = (T) b;
62  return myval;
63  }
64 
65  T*&
67  T*& myval = &parent::get_val();
68  return myval;
69  }
70 
71  operator T() {
72  T& myval = parent::get_val();
73  return myval;
74  }
75 
76 
77 
78  //this assumes you've overloaded the * operator in the struct
79  T&
81  T myval = parent::get_val();
82  return *(myval);
83  }
84 
85 };
86 
87 template<typename T>
89 {
91  public:
92  explicit
94  }
95 
96  explicit
98  parent(init) {
99  }
100 
101  operator T*() {
102  return parent::get_val();
103  }
104 
105  operator const T*() const {
106  return parent::get_val();
107  }
108 
109  template<typename U>
110  T*&
112  T*& myval = parent::get_val();
113  myval = (T*) b;
114  return myval;
115  }
116 
117  T*&
118  operator=(T* b) {
119  T*& myval = parent::get_val();
120  myval = b;
121  return myval;
122  }
123 
124  template<typename U>
125  T*&
126  operator=(U* b) {
127  T*& myval = parent::get_val();
128  myval = (T*) b;
129  return myval;
130  }
131 
132  T*&
134  T*& myval = parent::get_val();
135  return myval;
136  }
137 
138 };
139 }
140 }
141 #endif
142 
T & operator=(const sstmac_global_struct< U > &b)
Definition: global_struct.h:44
sstmac_global_builtin< T > parent
Definition: global_struct.h:23
sstmac_global_builtin< T * > parent
Definition: global_struct.h:90
parallel_runtime * init()
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
T *& operator=(const sstmac_global_struct< U > &b)