torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ForbiddenEvent.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_FORBIDDENEVENT_HPP
17 #define TORC_GENERIC_FORBIDDENEVENT_HPP
18 
24 #include "torc/generic/Value.hpp"
25 
26 #include <list>
27 
28 namespace torc { namespace generic { class Event; } }
29 
30 namespace torc {
31 namespace generic {
32 
33 /**
34  * @brief ForbiddenEvent class lists events which are forbidden
35  * during a period of times which is specified by time interval.
36  * Time interval is used to describe an interval between two times.
37  * Times can be described by events or offset events.
38  *
39  */
40 class ForbiddenEvent : public Visitable, public SelfReferencing<ForbiddenEvent> {
41  friend class FactoryType<ForbiddenEvent> ;
42 
43 public:
44  /**
45  * Convenience class to visit an ForbiddenEvent.
46  */
48 
49  virtual void accept(BaseVisitor& inoutVisitor) throw (Error);
50 
51  /**
52  * Convenience class to create an ForbiddenEvent.
53  */
54  class Factory : public FactoryType<ForbiddenEvent> {
55  public:
57  /**
58  * Create a ForbiddenEvent.
59  *
60  * @param[in] inStartTimeInterval Pointer to start event/offsetEvent of timeInterval.
61  * @param[in] inEndTimeInterval Pointer to end event/offsetEvent of timeInterval.
62  * @param[in] inEvents List of events which are forbidden during a period of time
63  * specified by TimeInterval(StartTimeInterval and EndTimeInterval).
64  * @param[in] inTiming Pointer to parented object (Timing) [optional].
65  * If not mentioned PathDelay will not be added to timing.
66  * @param[in] inDuration Duration of timeInterval, if end event is absent [optional].
67  *
68  * @return Pointer to created ForbiddenEvent.
69  */
71  const EventSharedPtr& inStartTimeInterval, const EventSharedPtr& inEndTimeInterval,
72  const std::list<EventSharedPtr>& inEvents, const TimingSharedPtr& inTiming =
73  TimingSharedPtr(), const Value& inDuration = Value()) throw (Error);
74  };
75 
76  /**
77  * Get the pointer to start event/offsetEvent of timeInterval
78  * @return Pointer to start event/offsetEvent of timeInterval
79  */
80  inline const EventSharedPtr getStartTimeInterval() const;
81 
82  /**
83  * Set the pointer to start event/offsetEvent of timeInterval
84  * @param[in] inSource Pointer to start event/offsetEvent of timeInterval
85  */
86  void setStartTimeInterval(const EventSharedPtr& inSource);
87 
88  /**
89  * Get the pointer to end event/offsetEvent of timeInterval
90  * @return Pointer to end event/offsetEvent of timeInterval
91  */
92  inline const EventSharedPtr getEndTimeInterval() const;
93 
94  /**
95  * Set the pointer to end event/offsetEvent of timeInterval
96  * @param[in] inSource Pointer to end event/offsetEvent of timeInterval
97  */
98  void setEndTimeInterval(const EventSharedPtr& inSource);
99 
100  /**
101  * Get the duration of timeInterval, if end event is absent.
102  * @return Value duration of timeInterval, if end event is absent.
103  */
104  inline const Value getDuration() const;
105 
106  /**
107  * Set the duration of timeInterval, if end event is absent.
108  * @param[in] inValue Duration of timeInterval, if end event is absent.
109  */
110  void setDuration(const Value& inValue);
111 
112  /**
113  * Get all the events of this forbiddenEvent.
114  *
115  * @param[out] outEvents List of events to be appended to
116  */
117  inline void getEvents(std::list<EventSharedPtr>& outEvents) const;
118 
119  /**
120  * Set all the events of this forbiddenEvent.
121  *
122  * @param[in] inEvents List of events to be appended to
123  */
124  void setEvents(const std::list<EventSharedPtr>& inEvents);
125 
126  /**
127  * Add an event to the list of events
128  *
129  * @param[in] inSource Pointer to event to be appended to
130  */
131  void addEvent(const EventSharedPtr& inSource);
132 
133  virtual ~ForbiddenEvent() throw ();
134 
135 protected:
136  ForbiddenEvent();
137 
138 private:
139  ForbiddenEvent(const ForbiddenEvent& source);
140 
141  ForbiddenEvent& operator=(const ForbiddenEvent& source);
142 
147 
148 };
149 
150 /**
151  * Get the pointer to start event/offsetEvent of timeInterval
152  * @return Pointer to start event/offsetEvent of timeInterval
153  */
154 inline const EventSharedPtr ForbiddenEvent::getStartTimeInterval() const {
155  return mStartTimeInterval;
156 }
157 
158 /**
159  * Get the pointer to end event/offsetEvent of timeInterval
160  * @return Pointer to end event/offsetEvent of timeInterval
161  */
163  return mEndTimeInterval;
164 }
165 
166 /**
167  * Get the duration of timeInterval, if end event is absent.
168  * @return Value duration of timeInterval, if end event is absent.
169  */
170 inline const Value ForbiddenEvent::getDuration() const {
171  return mDuration;
172 }
173 
174 /**
175  * Get all the events of this forbiddenEvent.
176  *
177  * @param[out] outEvents List of events to be appended to
178  */
179 inline void ForbiddenEvent::getEvents(std::list<EventSharedPtr>& outEvents) const {
180  outEvents.insert(outEvents.end(), mEvents.begin(), mEvents.end());
181 }
182 
183 } // namespace generic
184 } // namespace torc
185 
186 #endif // TORC_GENERIC_FORBIDDENEVENT_HPP
An acyclic inoutVisitor implementation.
Definition: VisitorType.hpp:57
void setEvents(const std::list< EventSharedPtr > &inEvents)
void setStartTimeInterval(const EventSharedPtr &inSource)
const EventSharedPtr getStartTimeInterval() const
VisitorType< ForbiddenEvent > Visitor
void setDuration(const Value &inValue)
The Error object thrown by different methods of EdifOM.
Definition: Error.hpp:41
virtual void accept(BaseVisitor &inoutVisitor)
A base class for Visitor.
Definition: VisitorType.hpp:31
const Value getDuration() const
void setEndTimeInterval(const EventSharedPtr &inSource)
boost::shared_ptr< ForbiddenEvent > ForbiddenEventSharedPtr
ForbiddenEvent class lists events which are forbidden during a period of times which is specified by ...
boost::shared_ptr< Event > EventSharedPtr
const EventSharedPtr getEndTimeInterval() const
std::list< EventSharedPtr > mEvents
virtual ForbiddenEventSharedPtr newForbiddenEventPtr(const EventSharedPtr &inStartTimeInterval, const EventSharedPtr &inEndTimeInterval, const std::list< EventSharedPtr > &inEvents, const TimingSharedPtr &inTiming=TimingSharedPtr(), const Value &inDuration=Value())
void addEvent(const EventSharedPtr &inSource)
boost::shared_ptr< Timing > TimingSharedPtr
A placeholder for a factory method.
Definition: FactoryType.hpp:35
void getEvents(std::list< EventSharedPtr > &outEvents) const
An object that receives an inoutVisitor.
Definition: Visitable.hpp:38