torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::generic::Event::Factory Class Reference

#include <Event.hpp>

+ Inheritance diagram for torc::generic::Event::Factory:
+ Collaboration diagram for torc::generic::Event::Factory:

Public Types

typedef Event Type
 
typedef SelfReferencing< Type >
::Pointer 
Pointer
 
typedef SelfReferencing< Type >
::WeakPointer 
WeakPointer
 

Public Member Functions

virtual EventSharedPtr newEventPtr (const Event::Type &inEventType, const std::list< PortSharedPtr > &inPorts, const std::list< PortReferenceSharedPtr > &inPortReferences, const std::list< NetSharedPtr > &inNets, const LogicElementSharedPtr &inTransition=LogicElementSharedPtr(), const PortListSharedPtr &inPortList=PortListSharedPtr(), const Value &inOffsetTime=Value()) throw (Error)
 
virtual void create (Pointer &outPointer) throw (Error)
 

Detailed Description

Convenience class to create an Event.

Definition at line 67 of file Event.hpp.

Member Typedef Documentation

A pointer to an object of type Type

Definition at line 45 of file FactoryType.hpp.

typedef Event torc::generic::FactoryType< Event >::Type
inherited

A rename of the parameter type

Definition at line 40 of file FactoryType.hpp.

A weak pointer to an object of type Type

Definition at line 50 of file FactoryType.hpp.

Member Function Documentation

virtual void torc::generic::FactoryType< Event >::create ( Pointer outPointer)
throw (Error
)
inlinevirtualinherited

Create an object of the Type specification of Factory. If the object has a boost::weak_ptr to itself, it is the task of this method to set this after the object is created.

Returns
A pointer to the freshly created object.

Definition at line 58 of file FactoryType.hpp.

58  {
59  try {
60  Pointer temp(new _Tp()); //Do not remove
61  outPointer = temp;
62  WeakPointer weakPtr(outPointer);
63  outPointer->setWeakThis(weakPtr);
64  } catch(std::exception& e) //May receive std::bad_alloc
65  {
66  //TBD::ERROR
67  }
68  }
SelfReferencing< Type >::WeakPointer WeakPointer
Definition: FactoryType.hpp:50
SelfReferencing< Type >::Pointer Pointer
Definition: FactoryType.hpp:45
EventSharedPtr torc::generic::Event::Factory::newEventPtr ( const Event::Type inEventType,
const std::list< PortSharedPtr > &  inPorts,
const std::list< PortReferenceSharedPtr > &  inPortReferences,
const std::list< NetSharedPtr > &  inNets,
const LogicElementSharedPtr inTransition = LogicElementSharedPtr(),
const PortListSharedPtr inPortList = PortListSharedPtr(),
const Value inOffsetTime = Value() 
)
throw (Error
)
virtual

Create an event.

Parameters
[in]inEventTypeEvent type.
[in]inPortsList of ports to this composition.
[in]inPortReferencesList of port references to this composition.
[in]inNetsList of nets to this composition.
[in]inTransitionPointer to logic state value(transition/becomes) [optional]. If no transition are specified, then the default meaning is any logic state change.
[in]inPortListConnected Port list to this event [optional].
[in]inOffsetTimeOffset time retative to an event [optional]. This is must for OffsetEvent, but optional for normal Event.
Returns
Pointer to created event.

Definition at line 38 of file Event.cpp.

42  {
43  try {
44  EventSharedPtr newEvent;
45  create(newEvent);
46  newEvent->setType(inEventType);
47  std::list<PortSharedPtr>::const_iterator portIt = inPorts.begin();
48  for(; portIt != inPorts.end(); portIt++) {
49  newEvent->addPort(*portIt);
50  }
51 
52  std::list<PortReferenceSharedPtr>::const_iterator portRefIt = inPortReferences.begin();
53  for(; portRefIt != inPortReferences.end(); portRefIt++) {
54  newEvent->addPortReference(*portRefIt);
55  }
56 
57  std::list<NetSharedPtr>::const_iterator netIt = inNets.begin();
58  for(; netIt != inNets.end(); netIt++) {
59  newEvent->addNet(*netIt);
60  }
61  if(inTransition) {
62  newEvent->setTransition(inTransition);
63  }
64  if(inPortList) {
65  newEvent->setPortList(inPortList);
66  }
67  if(Event::eTypeOffsetEvent == inEventType) {
68  if(inOffsetTime.getIsSet()) {
69  newEvent->setOffsetTime(inOffsetTime);
70  }
71  }
72  return newEvent;
73  } catch(Error& e) {
74  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
75  throw;
76  }
77 }
virtual void create(Pointer &outPointer)
Definition: FactoryType.hpp:58
boost::shared_ptr< Event > EventSharedPtr

+ Here is the call graph for this function:


The documentation for this class was generated from the following files: