torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Apply.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_APPLY_HPP
17 #define TORC_GENERIC_APPLY_HPP
18 
26 #include "torc/generic/Value.hpp"
27 
28 namespace torc { namespace generic { class LogicalResponse; } }
29 
30 namespace torc {
31 namespace generic {
32 
33 /**
34  * @brief This class is used within simulate to describe input stimuli and expected
35  * responces over a certain time interval
36  */
37 class Apply : public Commentable, public Visitable, public SelfReferencing<Apply>,
38  public UserDataContainer {
39 
40  friend class FactoryType<Apply> ;
41 
42 public:
43  /**
44  * Convenience class to visit apply .
45  */
47 
48  virtual void accept(BaseVisitor& inoutVisitor) throw (Error);
49 
50  /**
51  * Convenience class to create apply .
52  */
53  class Factory : public FactoryType<Apply> {
54  public:
56  /**
57  * Create an apply.
58  *
59  * @param[in] inNoOfCycle int32_t No of cycles for this apply.
60  * @param[in] inCycleDuration Value Duration of each cycle.
61  * @param[in] inLogicResponces List of LogicResponces.
62  * @param[in] inSimulate Pointer to parented (Simulate) object [optional].
63  * If not mentioned apply will not be added to simulate.
64  *
65  * @return Pointer to created apply.
66  */
67  ApplySharedPtr virtual newApplyPtr(const int32_t& inNoOfCycle, const Value& inCycleDuration,
68  const std::list<LogicalResponseSharedPtr>& inLogicResponces,
69  const SimulateSharedPtr& inSimulate = SimulateSharedPtr()) throw (Error);
70  };
71 
72  /**
73  * Get the no of cycles
74  * @return int32_t No of cycles
75  */
76  inline const int32_t getNoOfCycle() const;
77 
78  /**
79  * Set the no of cycles
80  * @param[in] inValue int32_t No of cycles
81  */
82  void setNoOfCycle(const int32_t& inValue);
83 
84  /**
85  * Get the duration of each cycle
86  * @return Duration of each cycle
87  */
88  inline const Value getCycleDuration() const;
89 
90  /**
91  * Set the duration of each cycle
92  * @param[in] value Duration of each cycle
93  */
94  void setCycleDuration(const Value& value);
95 
96  /**
97  * Get the list of LogicResponce.
98  *
99  * @param[out] outLogicResponces List of LogicResponce (s) to be appended to
100  */
101  inline void getLogicResponses(std::list<LogicalResponseSharedPtr>& outLogicResponces) const;
102 
103  /**
104  * Set the list of LogicResponce.
105  *
106  * @param[in] inLogicResponces List of LogicResponce (s) to be appended to
107  */
108  void setLogicResponses(const std::list<LogicalResponseSharedPtr>& inLogicResponces);
109 
110  /**
111  * Add a LogicResponce to the list of LogicResponce.
112  *
113  * @param[in] inLogicResponce Pointer to LogicResponce to be appended to
114  */
115  void addLogicResponse(const LogicalResponseSharedPtr& inLogicResponce);
116 
117  ~Apply() throw ();
118 
119 protected:
120  Apply();
121 
122 private:
123  Apply(const Apply& source);
124 
125  Apply& operator=(const Apply& source);
126 
127  int32_t mNoOfCycle;
130 
131 };
132 
133 /**
134  * Get the no of cycles
135  * @return int32_t No of cycles
136  */
137 inline const int32_t Apply::getNoOfCycle() const {
138  return mNoOfCycle;
139 }
140 
141 /**
142  * Get the duration of each cycle
143  * @return Duration of each cycle
144  */
145 inline const Value Apply::getCycleDuration() const {
146  return mCycleDuration;
147 }
148 
149 /**
150  * Get the list of LogicResponce.
151  *
152  * @param[out] outLogicResponces List of LogicResponce (s) to be appended to
153  */
154 inline void Apply::getLogicResponses(std::list<LogicalResponseSharedPtr>& outLogicResponces) const {
155  outLogicResponces.insert(outLogicResponces.end(), mLogicResponses.begin(),
156  mLogicResponses.end());
157 }
158 
159 } // namespace generic
160 } // namespace torc
161 
162 #endif // TORC_GENERIC_APPLY_HPP
An acyclic inoutVisitor implementation.
Definition: VisitorType.hpp:57
void setLogicResponses(const std::list< LogicalResponseSharedPtr > &inLogicResponces)
Definition: Apply.cpp:83
int32_t mNoOfCycle
Definition: Apply.hpp:127
This class is used within simulate to describe input stimuli and expected responces over a certain ti...
Definition: Apply.hpp:37
virtual ApplySharedPtr newApplyPtr(const int32_t &inNoOfCycle, const Value &inCycleDuration, const std::list< LogicalResponseSharedPtr > &inLogicResponces, const SimulateSharedPtr &inSimulate=SimulateSharedPtr())
Definition: Apply.cpp:34
void setNoOfCycle(const int32_t &inValue)
Definition: Apply.cpp:66
const Value getCycleDuration() const
Definition: Apply.hpp:145
Represents all classes that can hold user comments.
Definition: Commentable.hpp:36
Represents class that can hold userData.
boost::shared_ptr< Simulate > SimulateSharedPtr
void addLogicResponse(const LogicalResponseSharedPtr &inLogicResponce)
Definition: Apply.cpp:101
VisitorType< Apply > Visitor
Definition: Apply.hpp:46
The Error object thrown by different methods of EdifOM.
Definition: Error.hpp:41
boost::shared_ptr< LogicalResponse > LogicalResponseSharedPtr
A base class for Visitor.
Definition: VisitorType.hpp:31
std::list< LogicalResponseSharedPtr > mLogicResponses
Definition: Apply.hpp:129
boost::shared_ptr< Apply > ApplySharedPtr
const int32_t getNoOfCycle() const
Definition: Apply.hpp:137
virtual void accept(BaseVisitor &inoutVisitor)
Definition: Apply.cpp:53
void setCycleDuration(const Value &value)
Definition: Apply.cpp:74
void getLogicResponses(std::list< LogicalResponseSharedPtr > &outLogicResponces) const
Definition: Apply.hpp:154
A placeholder for a factory method.
Definition: FactoryType.hpp:35
An object that receives an inoutVisitor.
Definition: Visitable.hpp:38