00001 // Torc - Copyright 2011 University of Southern California. All Rights Reserved. 00002 // $HeadURL: https://torc-isi.svn.sourceforge.net/svnroot/torc-isi/branches/staging/0.9/src/torc/generic/om/LogicValue.hpp $ 00003 // $Id: LogicValue.hpp 10 2011-10-12 18:40:16Z nsteiner $ 00004 00005 // This program is free software: you can redistribute it and/or modify it under the terms of the 00006 // GNU General Public License as published by the Free Software Foundation, either version 3 of the 00007 // License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 00010 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 00011 // the GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License along with this program. If 00014 // not, see <http://www.gnu.org/licenses/>. 00015 00016 #ifndef TORC_GENERIC_OM_LOGICVALUE_HPP 00017 #define TORC_GENERIC_OM_LOGICVALUE_HPP 00018 00019 #include "torc/generic/om/PointerTypes.hpp" 00020 #include "torc/generic/om/Nameable.hpp" 00021 #include "torc/generic/om/Renamable.hpp" 00022 #include "torc/generic/om/Commentable.hpp" 00023 #include "torc/generic/om/ParentedObject.hpp" 00024 #include "torc/generic/om/PropertyContainer.hpp" 00025 #include "torc/generic/om/UserDataContainer.hpp" 00026 #include "torc/generic/om/Visitable.hpp" 00027 #include "torc/generic/om/VisitorType.hpp" 00028 #include "torc/generic/om/SelfReferencing.hpp" 00029 #include "torc/generic/util/Error.hpp" 00030 #include "torc/generic/om/FactoryType.hpp" 00031 00032 namespace torc { namespace generic { class LogicValueAttributes; } } 00033 namespace torc { namespace generic { class SimulationInfo; } } 00034 00035 00036 namespace torc { 00037 00038 namespace generic { 00039 00040 /** 00041 * @brief This class is used within simulationInfo construct to define a 00042 * logic value to use for modeling in the logicModel view. 00043 */ 00044 class LogicValue : 00045 public Nameable, 00046 public Renamable, 00047 public Commentable, 00048 public Visitable, 00049 public ParentedObject<SimulationInfo>, 00050 public PropertyContainer, 00051 public UserDataContainer, 00052 public SelfReferencing<LogicValue> { 00053 00054 friend class FactoryType<LogicValue>; 00055 00056 public: 00057 00058 /** 00059 * Convenience class to visit a LogicValue. 00060 */ 00061 typedef VisitorType<LogicValue> Visitor; 00062 00063 /** 00064 * Convenience class to create a LogicValue. 00065 */ 00066 class Factory: public FactoryType<LogicValue> 00067 { 00068 public: 00069 using FactoryType<LogicValue>::create; 00070 /** 00071 * Create a LogicValue. 00072 * 00073 * @param[in] inName Name of the LogicValue to be created. 00074 * @param[in] inAttributes Pointer to LogicValueAttributes object. 00075 * @param[in] inOriginalName Original name of the LogicValue [optional]. 00076 * @param[in] inSimulationInfo Pointer to parented(SimulationInfo) object. 00077 * If not mentioned LogicValue will not be added to SimulationInfo. 00078 * 00079 * @return Pointer to created LogicValue. 00080 */ 00081 virtual LogicValueSharedPtr 00082 newLogicValuePtr( const std::string & inName, 00083 const LogicValueAttributesSharedPtr & inAttributes, 00084 const std::string &inOriginalName = std::string(), 00085 const SimulationInfoSharedPtr & inSimulationInfo 00086 = SimulationInfoSharedPtr() ) throw(Error); 00087 }; 00088 00089 /** 00090 * Recive a visitor to this class. The visit method of the visitor is called 00091 * and a reference to this object is passed as a parameter. It has to be noted however, 00092 * that a dynamic_cast is performed inside this method. If the cast fails, 00093 * an appropriate exception is thrown by this method. This sitation can arise when 00094 * the passed Visitor object does not inherit from the appropriate visitor specialization. 00095 * See Visitor documentation for more details. 00096 * 00097 * @param[in,out] inoutVisitor A reference to the visitor object 00098 * @exception Error Visitor type inappropriate for visiting this object 00099 * or any other error thrown by the Visitor::throw() method. 00100 */ 00101 virtual void 00102 accept(BaseVisitor & inoutVisitor) throw(Error); 00103 00104 /** 00105 * Get the attributes of the LogicValue. Attributes include voltageMap, currentMap, 00106 * booleanMap, compound, weak, strong, dominates etc. 00107 * 00108 * @return Pointer to LogicValueAttributes object. 00109 */ 00110 inline const LogicValueAttributesSharedPtr 00111 getAttributes() const throw(); 00112 00113 /** 00114 * Set the attributes of the LogicValue. Attributes include voltageMap, currentMap, 00115 * booleanMap, compound, weak, strong, dominates etc. 00116 * 00117 * @param[in] inSource Pointer to LogicValueAttributes object. 00118 */ 00119 void setAttributes(const LogicValueAttributesSharedPtr & inSource) throw(); 00120 00121 virtual 00122 ~LogicValue() throw(); 00123 00124 protected: 00125 LogicValue(); 00126 00127 private: 00128 LogicValueAttributesSharedPtr mAttributes; 00129 00130 }; 00131 00132 /** 00133 * Get the attributes of the LogicValue. Attributes include voltageMap, currentMap, 00134 * booleanMap, compound, weak, strong, dominates etc. 00135 * 00136 * @return Pointer to LogicValueAttributes object. 00137 */ 00138 inline const LogicValueAttributesSharedPtr 00139 LogicValue::getAttributes() const throw() { 00140 return mAttributes; 00141 } 00142 00143 } // namespace torc::generic 00144 00145 } // namespace torc 00146 #endif // TORC_GENERIC_OM_LOGICVALUE_HPP