torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LogicValue.cpp
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 
19 
20 namespace torc {
21 namespace generic {
22 
23 /**
24  * Create a LogicValue.
25  *
26  * @param[in] inName Name of the LogicValue to be created.
27  * @param[in] inAttributes Pointer to LogicValueAttributes object.
28  * @param[in] inOriginalName Original name of the LogicValue [optional].
29  * @param[in] inSimulationInfo Pointer to parented(SimulationInfo) object.
30  * If not mentioned LogicValue will not be added to SimulationInfo.
31  *
32  * @return Pointer to created LogicValue.
33  */
35  const LogicValueAttributesSharedPtr& inAttributes, const std::string& inOriginalName,
36  const SimulationInfoSharedPtr& inSimulationInfo) throw (Error) {
37  try {
38  LogicValueSharedPtr newLogicValue;
39  create(newLogicValue);
40  newLogicValue->setName(inName);
41  newLogicValue->setAttributes(inAttributes);
42  newLogicValue->setOriginalName(inOriginalName);
43  if(inSimulationInfo) {
44  inSimulationInfo->addLogicValue(newLogicValue);
45  }
46  return newLogicValue;
47  } catch(Error& e) {
48  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
49  throw;
50  }
51 }
52 
53 /**
54  * Set the attributes of the LogicValue. Attributes include voltageMap, currentMap,
55  * booleanMap, compound, weak, strong, dominates etc.
56  *
57  * @param[in] inSource Pointer to LogicValueAttributes object.
58  */
60  mAttributes = inSource;
61 }
62 
63 void LogicValue::accept(BaseVisitor& inoutVisitor) throw (Error) {
64  try {
65  runVisitor(*this, inoutVisitor);
66  } catch(Error& e) {
67  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
68  throw;
69  }
70 }
71 
74  SelfReferencing<LogicValue>(), mAttributes() {}
75 
77 
78 } // namespace generic
79 } // namespace torc
LogicValueAttributesSharedPtr mAttributes
Definition: LogicValue.hpp:115
boost::shared_ptr< LogicValue > LogicValueSharedPtr
An object that has a parent.
Represents objects that have properties.
Represents all classes that can hold user comments.
Definition: Commentable.hpp:36
This class is used to hold all information about the logic values used within a library.
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
void runVisitor(_Tp &inoutVisited, BaseVisitor &inoutVisitor)
Definition: VisitorType.hpp:78
std::string string
The Error object thrown by different methods of EdifOM.
Definition: Error.hpp:41
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
An object that receives an inoutVisitor.
Definition: Visitable.hpp:38
void setCurrentLocation(const std::string &inFunction, const std::string &inFile, uint32_t inLine)
Definition: Error.cpp:73