39 #ifndef ORO_CORBA_DISPATCHER_HPP 40 #define ORO_CORBA_DISPATCHER_HPP 42 #include "../../os/MutexLock.hpp" 43 #include "../../Activity.hpp" 44 #include "../../base/ChannelElementBase.hpp" 45 #include "../../Logger.hpp" 46 #include "../../internal/List.hpp" 47 #include "../../types/GlobalsRepository.hpp" 49 #include "../../DataFlowInterface.hpp" 50 #include "../../TaskContext.hpp" 60 typedef std::map<DataFlowInterface*,CorbaDispatcher*>
DispatchMap;
75 :
Activity(defaultScheduler, defaultPriority, 0.0, 0, name),
80 CorbaDispatcher(
const std::string& name,
int scheduler,
int priority,
unsigned cpu_affinity)
81 :
Activity(scheduler, priority, 0.0, cpu_affinity, 0, name),
102 DispatchMap::iterator result = DispatchI.find(iface);
103 if ( result == DispatchI.end() ) {
106 result = DispatchI.find(iface);
107 if ( result != DispatchI.end() )
108 return result->second;
131 scheduler.
refresh(owner->getProperty(
"CorbaDispatcherScheduler")) ||
132 scheduler.
refresh(global_repository->getProperty(
"CorbaDispatcherScheduler"));
134 priority.
refresh(owner->getProperty(
"CorbaDispatcherPriority")) ||
135 priority.
refresh(global_repository->getProperty(
"CorbaDispatcherPriority"));
137 cpu_affinity.
refresh(owner->getProperty(
"CorbaDispatcherCpuAffinity")) ||
138 cpu_affinity.
refresh(global_repository->getProperty(
"CorbaDispatcherCpuAffinity"));
140 scheduler.
refresh(global_repository->getProperty(
"CorbaDispatcherScheduler"));
141 priority.
refresh(global_repository->getProperty(
"CorbaDispatcherPriority"));
142 cpu_affinity.
refresh(global_repository->getProperty(
"CorbaDispatcherCpuAffinity"));
145 DispatchI[iface] =
new CorbaDispatcher( name, scheduler, priority, cpu_affinity );
146 DispatchI[iface]->start();
147 return DispatchI[iface];
149 return result->second;
157 DispatchMap::iterator result = DispatchI.find(iface);
158 if ( result != DispatchI.end() ) {
160 delete result->second;
161 DispatchI.erase(result);
163 if ( DispatchI.empty() )
172 DispatchMap::iterator result = DispatchI.begin();
173 while ( result != DispatchI.end() ) {
174 delete result->second;
175 DispatchI.erase(result);
176 result = DispatchI.begin();
184 result = result || (c0 == c1);
188 bool has_element =
false;
196 RClist.
erase( chan );
211 RClist.
erase( chan );
static RTT_CORBA_API os::Mutex * mlock
CorbaDispatcher(const std::string &name)
virtual bool refresh(const base::PropertyBase *other)
static shared_ptr Instance()
CorbaDispatcher(const std::string &name, int scheduler, int priority, unsigned cpu_affinity)
boost::shared_ptr< GlobalsRepository > shared_ptr
void cancelChannel(base::ChannelElementBase::shared_ptr chan)
static CorbaDispatcher * Instance(DataFlowInterface *iface)
static void hasElement(base::ChannelElementBase::shared_ptr c0, base::ChannelElementBase::shared_ptr c1, bool &result)
std::map< DataFlowInterface *, CorbaDispatcher * > DispatchMap
virtual void transferSamples()=0
void apply(Function func)
void dispatchChannel(base::ChannelElementBase::shared_ptr chan)
static RTT_CORBA_API int defaultPriority
boost::intrusive_ptr< ChannelElementBase > shared_ptr
An Activity executes a RunnableInterface object in a (periodic) thread.
static RTT_CORBA_API int defaultCpuAffinity
An object oriented wrapper around a non recursive mutex.
internal::List< base::ChannelElementBase::shared_ptr > RCList
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
static void Release(DataFlowInterface *iface)
static Logger::LogFunction endlog()
bool append(value_t item)
static RTT_CORBA_API DispatchMap DispatchI
virtual const char * getName() const
virtual const std::string & getName() const
static RTT_CORBA_API int defaultScheduler
TaskContext * getOwner() const
MutexLock is a scope based Monitor, protecting critical sections with a Mutex object through locking ...