torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LogicValue.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_LOGICVALUE_HPP
17 #define TORC_GENERIC_LOGICVALUE_HPP
18 
29 #include "torc/generic/Error.hpp"
31 
32 namespace torc { namespace generic { class LogicValueAttributes; } }
33 namespace torc { namespace generic { class SimulationInfo; } }
34 
35 namespace torc {
36 namespace generic {
37 
38 /**
39  * @brief This class is used within simulationInfo construct to define a
40  * logic value to use for modeling in the logicModel view.
41  */
42 class LogicValue : public Nameable, public Renamable, public Commentable, public Visitable,
43  public ParentedObject<SimulationInfo>, public PropertyContainer, public UserDataContainer,
44  public SelfReferencing<LogicValue> {
45 
46  friend class FactoryType<LogicValue> ;
47 
48 public:
49 
50  /**
51  * Convenience class to visit a LogicValue.
52  */
54 
55  /**
56  * Convenience class to create a LogicValue.
57  */
58  class Factory : public FactoryType<LogicValue> {
59  public:
61  /**
62  * Create a LogicValue.
63  *
64  * @param[in] inName Name of the LogicValue to be created.
65  * @param[in] inAttributes Pointer to LogicValueAttributes object.
66  * @param[in] inOriginalName Original name of the LogicValue [optional].
67  * @param[in] inSimulationInfo Pointer to parented(SimulationInfo) object.
68  * If not mentioned LogicValue will not be added to SimulationInfo.
69  *
70  * @return Pointer to created LogicValue.
71  */
72  virtual LogicValueSharedPtr newLogicValuePtr(const std::string& inName,
73  const LogicValueAttributesSharedPtr& inAttributes, const std::string& inOriginalName
74  = std::string(),
75  const SimulationInfoSharedPtr& inSimulationInfo = SimulationInfoSharedPtr())
76  throw (Error);
77  };
78 
79  /**
80  * Receive a visitor to this class. The visit method of the visitor is called
81  * and a reference to this object is passed as a parameter. It has to be noted however,
82  * that a dynamic_cast is performed inside this method. If the cast fails,
83  * an appropriate exception is thrown by this method. This situation can arise when
84  * the passed Visitor object does not inherit from the appropriate visitor specialization.
85  * See Visitor documentation for more details.
86  *
87  * @param[in,out] inoutVisitor A reference to the visitor object
88  * @exception Error Visitor type inappropriate for visiting this object
89  * or any other error thrown by the Visitor::throw() method.
90  */
91  virtual void accept(BaseVisitor& inoutVisitor) throw (Error);
92 
93  /**
94  * Get the attributes of the LogicValue. Attributes include voltageMap, currentMap,
95  * booleanMap, compound, weak, strong, dominates etc.
96  *
97  * @return Pointer to LogicValueAttributes object.
98  */
99  inline const LogicValueAttributesSharedPtr getAttributes() const;
100 
101  /**
102  * Set the attributes of the LogicValue. Attributes include voltageMap, currentMap,
103  * booleanMap, compound, weak, strong, dominates etc.
104  *
105  * @param[in] inSource Pointer to LogicValueAttributes object.
106  */
107  void setAttributes(const LogicValueAttributesSharedPtr& inSource);
108 
109  virtual ~LogicValue() throw ();
110 
111 protected:
112  LogicValue();
113 
114 private:
116 
117 };
118 
119 /**
120  * Get the attributes of the LogicValue. Attributes include voltageMap, currentMap,
121  * booleanMap, compound, weak, strong, dominates etc.
122  *
123  * @return Pointer to LogicValueAttributes object.
124  */
125 inline const LogicValueAttributesSharedPtr LogicValue::getAttributes() const {
126  return mAttributes;
127 }
128 
129 } // namespace generic
130 } // namespace torc
131 
132 #endif // TORC_GENERIC_LOGICVALUE_HPP
LogicValueAttributesSharedPtr mAttributes
Definition: LogicValue.hpp:115
boost::shared_ptr< LogicValue > LogicValueSharedPtr
An acyclic inoutVisitor implementation.
Definition: VisitorType.hpp:57
An object that has a parent.
Represents objects that have properties.
Represents all classes that can hold user comments.
Definition: Commentable.hpp:36
Represents class that can hold userData.
This class is used within simulationInfo construct to define a logic value to use for modeling in the...
Definition: LogicValue.hpp:42
std::string string
The Error object thrown by different methods of EdifOM.
Definition: Error.hpp:41
const LogicValueAttributesSharedPtr getAttributes() const
Definition: LogicValue.hpp:125
A base class for Visitor.
Definition: VisitorType.hpp:31
boost::shared_ptr< SimulationInfo > SimulationInfoSharedPtr
virtual LogicValueSharedPtr newLogicValuePtr(const std::string &inName, const LogicValueAttributesSharedPtr &inAttributes, const std::string &inOriginalName=std::string(), const SimulationInfoSharedPtr &inSimulationInfo=SimulationInfoSharedPtr())
Definition: LogicValue.cpp:34
void setAttributes(const LogicValueAttributesSharedPtr &inSource)
Definition: LogicValue.cpp:59
An object that has a name.
Definition: Nameable.hpp:34
virtual void accept(BaseVisitor &inoutVisitor)
Definition: LogicValue.cpp:63
Represents objects that can be renamed.
boost::shared_ptr< LogicValueAttributes > LogicValueAttributesSharedPtr
VisitorType< LogicValue > Visitor
Definition: LogicValue.hpp:53
A placeholder for a factory method.
Definition: FactoryType.hpp:35
An object that receives an inoutVisitor.
Definition: Visitable.hpp:38