torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
WaveValue.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 WaveValue.
25  *
26  * @param[in] inName Name of the WaveValue to be created.
27  * @param[in] inDeltaTimeDuration Value Delta time duration
28  * between the values contained in the logic waveform.
29  * @param[in] inLogicWaveForm Logic wave form for this WaveValue.
30  * @param[in] inSimulate Pointer to parented (Simulate) object [optional].
31  * If not mentioned WaveValue will not be added to simulate.
32  *
33  * @return Pointer to created WaveValue.
34  */
36  const Value& inDeltaTimeDuration, const LogicElementSharedPtr inLogicWaveForm,
37  const SimulateSharedPtr& inSimulate) throw (Error) {
38  try {
39  WaveValueSharedPtr newWaveValue;
40  create(newWaveValue);
41  newWaveValue->setName(inName);
42  newWaveValue->setDeltaTimeDuration(inDeltaTimeDuration);
43  newWaveValue->setLogicWaveform(inLogicWaveForm);
44  if(inSimulate) {
45  inSimulate->addWaveValue(newWaveValue);
46  }
47  return newWaveValue;
48  } catch(Error& e) {
49  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
50  throw;
51  }
52 }
53 
54 WaveValue::WaveValue() : Nameable(), SelfReferencing<WaveValue>(), mDeltaTimeDuration(),
55  mLogicWaveform() {}
56 
57 WaveValue::~WaveValue() throw () {}
58 
59 void WaveValue::accept(BaseVisitor& inoutVisitor) throw (Error) {
60  try {
61  runVisitor(*this, inoutVisitor);
62  } catch(Error& e) {
63  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
64  throw;
65  }
66 }
67 
68 /**
69  * Set the delta time duration between the values contained in the logic waveform.
70  * @param[in] Value Delta time duration between the values contained in the logic waveform.
71  */
73  mDeltaTimeDuration = value;
74 }
75 
76 /**
77  * Set the logic waveform.
78  *
79  * @param[in] inSource Pointer to logic element object.
80  */
82  mLogicWaveform = inSource;
83 }
84 
85 } // namespace generic
86 } // namespace torc
boost::shared_ptr< WaveValue > WaveValueSharedPtr
boost::shared_ptr< LogicElement > LogicElementSharedPtr
virtual WaveValueSharedPtr newWaveValuePtr(const std::string &inName, const Value &inDeltaTimeDuration, const LogicElementSharedPtr inLogicWaveForm, const SimulateSharedPtr &inSimulate=SimulateSharedPtr())
Definition: WaveValue.cpp:35
boost::shared_ptr< Simulate > SimulateSharedPtr
void runVisitor(_Tp &inoutVisited, BaseVisitor &inoutVisitor)
Definition: VisitorType.hpp:78
std::string string
LogicElementSharedPtr mLogicWaveform
Definition: WaveValue.hpp:107
The Error object thrown by different methods of EdifOM.
Definition: Error.hpp:41
A base class for Visitor.
Definition: VisitorType.hpp:31
This class is used within simulate to describe input stimuli and expected responces over a certain ti...
Definition: WaveValue.hpp:35
An object that has a name.
Definition: Nameable.hpp:34
void setLogicWaveform(const LogicElementSharedPtr &inSource)
Definition: WaveValue.cpp:81
void setDeltaTimeDuration(const Value &value)
Definition: WaveValue.cpp:72
virtual void accept(BaseVisitor &inoutVisitor)
Definition: WaveValue.cpp:59
void setCurrentLocation(const std::string &inFunction, const std::string &inFile, uint32_t inLine)
Definition: Error.cpp:73