torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LogicValueAttributes.hpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 #ifndef TORC_GENERIC_LOGICVALUEATTRIBUTES_HPP
17 #define TORC_GENERIC_LOGICVALUEATTRIBUTES_HPP
18 
20 #include "torc/generic/Value.hpp"
21 #include "torc/generic/Error.hpp"
22 
23 #include <list>
24 
25 namespace torc { namespace generic { class LogicValue; } }
26 
27 namespace torc {
28 namespace generic {
29 
30 /**
31  * @brief This class is used within simulationInfo construct to define a logic value
32  * to use for modeling.
33  */
35 
36 public:
37  /**
38  * @brief This structure is for logicRef and libraryRef used in logicMapInput/logicMapOutput.
39  */
40  struct LogicMap {
41  /**
42  * @enum LogicMapType
43  * LogicMap type, logicMapInput, logicMapOutput
44  */
45  enum LogicMapType {
47  };
48 
52  };
53 
54  /**
55  * Get the logic value, which is used to indicate that the
56  * current logic value is stronger than the return logic value.
57  *
58  * @return Pointer to the logic value
59  */
60  inline const LogicValueSharedPtr getStrongLogicValue() const;
61 
62  /**
63  * Set the logic value, which is used to indicate that the
64  * current logic value is stronger than this logic value.
65  *
66  * @param[in] inSource Pointer to the logic value
67  */
68  void setStrongLogicValue(const LogicValueSharedPtr& inSource);
69 
70  /**
71  * Get the logic value, which is used to indicate that the
72  * current logic value is weaker than this logic value.
73  *
74  * @return Pointer to the logic value
75  */
76  inline const LogicValueSharedPtr getWeakLogicValue() const;
77 
78  /**
79  * Set the logic value, which is used to indicate that the
80  * current logic value is weaker than this logic value.
81  *
82  * @param[in] inSource Pointer to the logic value
83  */
84  void setWeakLogicValue(const LogicValueSharedPtr& inSource);
85 
86  /**
87  * Get the voltage value for this logic value.
88  *
89  * @return Value containing Value::MiNoMax
90  */
91  inline const Value::MiNoMax getVoltageMap() const;
92 
93  /**
94  * Set the voltage value for this logic value.
95  *
96  * @param[in] value Voltage value. Must be Value::MiNoMax
97  */
98  void setVoltageMap(const Value::MiNoMax& value);
99 
100  /**
101  * Get whether this object is defined with a inSource, or is undefined.
102  *
103  * @return True if initialized.
104  */
105  inline const bool getIsVoltageMapSet() const;
106 
107  /**
108  * Get the current value for this logic value.
109  *
110  * @return Value containing Value::MiNoMax
111  */
112  inline const Value::MiNoMax getCurrentMap() const;
113 
114  /**
115  * Set the current value for this logic value.
116  *
117  * @param[in] value Current value. Must be Value::MiNoMax
118  */
119  void setCurrentMap(const Value::MiNoMax& value);
120 
121  /**
122  * Get whether this object is defined with a inSource, or is undefined.
123  *
124  * @return True if initialized.
125  */
126  inline const bool getIsCurrentMapSet() const;
127 
128  /**
129  * Get the boolean value(true/false) for this logic value.
130  *
131  * @return Value containing Value::Boolean
132  */
133  inline const Value::Boolean getBooleanMap() const;
134 
135  /**
136  * Set the boolean value(true/false) for this logic value.
137  *
138  * @param[in] value Boolean value. Must be Value::Boolean
139  */
140  void setBooleanMap(const Value::Boolean& value);
141 
142  /**
143  * Get whether this object is defined with a inSource, or is undefined.
144  *
145  * @return True if initialized.
146  */
147  inline const bool getIsBooleanMapSet() const;
148 
149  /**
150  * Get the list of compound logic values for this logic value.
151  *
152  * @param[out] outLogicValues List of logic values to be appended to
153  */
154  inline void getCompoundLogicValues(std::list<LogicValueSharedPtr>& outLogicValues) const;
155 
156  /**
157  * Set the list of compound logic values for this logic value.
158  *
159  * @param[in] inSource List of logic values to be appended to
160  */
161  void setCompoundLogicValues(const std::list<LogicValueSharedPtr>& inSource) throw (Error);
162 
163  /**
164  * Get the list of logic values, which are dominated by the current logic value
165  *
166  * @param[out] outLogicValues List of logic values to be appended to
167  */
168  inline void getDominatedLogicValues(std::list<LogicValueSharedPtr>& outLogicValues) const;
169 
170  /**
171  * Set the list of logic values, which are dominated by the current logic value
172  *
173  * @param[in] inSource List of logic values to be appended to
174  */
175  void setDominatedLogicValues(const std::list<LogicValueSharedPtr>& inSource) throw (Error);
176 
177  /**
178  * Get whether the logic value is isolated or not.
179  *
180  * @return bool Whether the logic value is isolated or not.
181  */
182  inline const bool getIsIsolated() const;
183 
184  /**
185  * Set the logic value is isolated or not, default is false
186  *
187  * @param[in] inSource bool Whether the logic value is isolated or not.
188  */
189  void setIsIsolated(const bool& inSource);
190 
191  /**
192  * Get the list of logic maps.
193  *
194  * @param[out] outLogicMaps List of logic maps to be appended to
195  */
196  inline void getLogicMaps(std::list<LogicMap*>& outLogicMaps) const;
197 
198  /**
199  * Set the list of logic maps.
200  *
201  * @param[in] inSource List of logic maps to be appended to
202  */
203  void setLogicMaps(const std::list<LogicMap*>& inSource);
204 
205  /**
206  * Add a logic map to the list of logic maps. If an empty pointer is supplied,
207  * it returns without doing anything.
208  *
209  * @param[in] inLogicMap A pointer to a logic map object.
210  *
211  * @exception Error Logic map could not be added.
212  */
213  void addLogicMap(LogicMap*& inLogicMap) throw (Error);
214 
215  /**
216  * Get the list of logic values, which are resolved by the current logic value
217  *
218  * @param[out] outLogicValues List of logic values to be appended to
219  */
220  inline void getResolvedLogicValues(std::list<LogicValueSharedPtr>& outLogicValues) const;
221 
222  /**
223  * Set the list of logic values, which are resolved by the current logic value
224  *
225  * @param[in] inSource List of logic values to be appended to
226  */
227  void setResolvedLogicValues(const std::list<LogicValueSharedPtr>& inSource);
228 
230 
231  ~LogicValueAttributes() throw ();
232 
234 
235  LogicValueAttributes& operator=(const LogicValueAttributes& source);
236 
237 private:
238  Value::MiNoMax mVoltageMap;
240  Value::MiNoMax mCurrentMap;
242  Value::Boolean mBooleanMap;
248  std::list<LogicMap*> mLogicMaps;
251 
252 };
253 
254 /**
255  * Get the logic value, which is used to indicate that the
256  * current logic value is stronger than the return logic value.
257  *
258  * @return Pointer to the logic value
259  */
261  return mStrong;
262 }
263 
264 /**
265  * Get the logic value, which is used to indicate that the
266  * current logic value is weaker than this logic value.
267  *
268  * @return Pointer to the logic value
269  */
271  return mWeak;
272 }
273 
274 /**
275  * Get the voltage value for this logic value.
276  *
277  * @return Value containing Value::MiNoMax
278  */
280  return mVoltageMap;
281 }
282 
283 /**
284  * Get whether this object is defined with a inSource, or is undefined.
285  *
286  * @return True if initialized.
287  */
288 inline const bool LogicValueAttributes::getIsVoltageMapSet() const {
289  return mIsVoltageMapSet;
290 }
291 
292 /**
293  * Get the current value for this logic value.
294  *
295  * @return Value containing Value::MiNoMax
296  */
298  return mCurrentMap;
299 }
300 
301 /**
302  * Get whether this object is defined with a inSource, or is undefined.
303  *
304  * @return True if initialized.
305  */
306 inline const bool LogicValueAttributes::getIsCurrentMapSet() const {
307  return mIsCurrentMapSet;
308 }
309 
310 /**
311  * Get the boolean value(true/false) for this logic value.
312  *
313  * @return Value containing Value::Boolean
314  */
316  return mBooleanMap;
317 }
318 
319 /**
320  * Get whether this object is defined with a inSource, or is undefined.
321  *
322  * @return True if initialized.
323  */
324 inline const bool LogicValueAttributes::getIsBooleanMapSet() const {
325  return mIsBooleanMapSet;
326 }
327 
328 /**
329  * Get the list of compound logic values for this logic value.
330  *
331  * @param[out] outLogicValues List of logic values to be appended to
332  */
334  std::list<LogicValueSharedPtr>& outLogicValues) const {
335  outLogicValues.insert(outLogicValues.end(), mCompounds.begin(), mCompounds.end());
336 }
337 
338 /**
339  * Get the list of logic values, which are dominated by the current logic value
340  *
341  * @param[out] outLogicValues List of logic values to be appended to
342  */
344  std::list<LogicValueSharedPtr>& outLogicValues) const {
345  outLogicValues.insert(outLogicValues.end(), mDominates.begin(), mDominates.end());
346 }
347 
348 /**
349  * Get whether the logic value is isolated or not.
350  *
351  * @return bool Whether the logic value is isolated or not.
352  */
353 inline const bool LogicValueAttributes::getIsIsolated() const {
354  return mIsIsolated;
355 }
356 
357 /**
358  * Get the list of logic values, which are resolved by the current logic value
359  *
360  * @param[out] outLogicValues List of logic values to be appended to
361  */
363  std::list<LogicValueSharedPtr>& outLogicValues) const {
364  outLogicValues.insert(outLogicValues.end(), mResolves.begin(), mResolves.end());
365 }
366 
367 /**
368  * Get the list of logic maps.
369  *
370  * @param[out] outLogicMaps List of logic maps to be appended to
371  */
372 inline void LogicValueAttributes::getLogicMaps(std::list<LogicMap*>& outLogicMaps) const {
373  outLogicMaps.insert(outLogicMaps.end(), mLogicMaps.begin(), mLogicMaps.end());
374 }
375 
376 } // namespace generic
377 } // namespace torc
378 
379 #endif // TORC_GENERIC_LOGICVALUEATTRIBUTES_HPP
boost::shared_ptr< LogicValue > LogicValueSharedPtr
void setDominatedLogicValues(const std::list< LogicValueSharedPtr > &inSource)
void setCurrentMap(const Value::MiNoMax &value)
const Value::MiNoMax getCurrentMap() const
This structure is for logicRef and libraryRef used in logicMapInput/logicMapOutput.
void setLogicMaps(const std::list< LogicMap * > &inSource)
void setWeakLogicValue(const LogicValueSharedPtr &inSource)
void addLogicMap(LogicMap *&inLogicMap)
std::string string
void setVoltageMap(const Value::MiNoMax &value)
void setStrongLogicValue(const LogicValueSharedPtr &inSource)
The Error object thrown by different methods of EdifOM.
Definition: Error.hpp:41
std::list< LogicValueSharedPtr > mDominates
void setResolvedLogicValues(const std::list< LogicValueSharedPtr > &inSource)
const Value::Boolean getBooleanMap() const
void getDominatedLogicValues(std::list< LogicValueSharedPtr > &outLogicValues) const
void getLogicMaps(std::list< LogicMap * > &outLogicMaps) const
const LogicValueSharedPtr getWeakLogicValue() const
This class is used within simulationInfo construct to define a logic value to use for modeling...
const Value::MiNoMax getVoltageMap() const
void setBooleanMap(const Value::Boolean &value)
std::list< LogicValueSharedPtr > mResolves
void getResolvedLogicValues(std::list< LogicValueSharedPtr > &outLogicValues) const
const LogicValueSharedPtr getStrongLogicValue() const
void setIsIsolated(const bool &inSource)
void setCompoundLogicValues(const std::list< LogicValueSharedPtr > &inSource)
void getCompoundLogicValues(std::list< LogicValueSharedPtr > &outLogicValues) const
std::list< LogicValueSharedPtr > mCompounds