21 #ifndef MESSAGEINTERFACE_H 22 #define MESSAGEINTERFACE_H 29 #include "CF/ExtendedEvent.h" 31 #include "CorbaUtils.h" 35 #include <COS/CosEventChannelAdmin.hh> 45 #ifdef BEGIN_AUTOCOMPLETE_IGNORE 49 class Consumer_i :
public virtual POA_CosEventChannelAdmin::ProxyPushConsumer {
53 void push(
const CORBA::Any& data);
55 void connect_push_supplier(CosEventComm::PushSupplier_ptr push_supplier);
57 void disconnect_push_consumer();
64 class SupplierAdmin_i :
public virtual POA_CosEventChannelAdmin::SupplierAdmin {
68 CosEventChannelAdmin::ProxyPushConsumer_ptr obtain_push_consumer();
70 CosEventChannelAdmin::ProxyPullConsumer_ptr obtain_pull_consumer();
75 unsigned int instance_counter;
84 #ifdef BEGIN_AUTOCOMPLETE_IGNORE 85 ,
public virtual POA_ExtendedEvent::MessageEvent
100 template <
class Class,
class MessageStruct>
101 void registerMessage (
const std::string&
id, Class* target,
void (Class::*func)(
const std::string&,
const MessageStruct&))
106 template <
class Target,
class Func>
113 void connectPort(CORBA::Object_ptr connection,
const char* connectionId);
123 CosEventChannelAdmin::ProxyPushConsumer_ptr
extendConsumers(std::string consumer_id);
127 void fireCallback (
const std::string&
id,
const CORBA::Any& data);
135 void addSupplier (
const std::string& connectionId, CosEventComm::PushSupplier_ptr supplier);
137 CosEventComm::PushSupplier_ptr
removeSupplier (
const std::string& connectionId);
141 std::map<std::string, CosEventChannelAdmin::EventChannel_ptr>
_connections;
151 virtual void operator() (
const std::string& value,
const CORBA::Any& data) = 0;
162 template <
class Class,
class M>
166 typedef void (Class::*
MemberFn)(
const std::string&,
const M&);
168 virtual void operator() (
const std::string& value,
const CORBA::Any& data)
171 if (data >>= message) {
195 typedef std::map<std::string, CosEventComm::PushSupplier_var>
SupplierTable;
205 #ifdef BEGIN_AUTOCOMPLETE_IGNORE 206 ,
public virtual POA_CF::Port
215 void connectPort(CORBA::Object_ptr connection,
const char* connectionId);
218 void push(
const CORBA::Any& data);
220 CosEventChannelAdmin::ProxyPushConsumer_ptr
removeConsumer(std::string consumer_id);
221 void extendConsumers(std::string consumer_id, CosEventChannelAdmin::ProxyPushConsumer_ptr proxy_consumer);
224 template <
typename Message>
226 const Message* begin(&message);
227 const Message* end(&begin[1]);
232 template <
class Sequence>
238 template <
typename Iterator>
241 CF::Properties properties;
242 properties.length(std::distance(first, last));
243 for (CORBA::ULong ii = 0; first != last; ++ii, ++first) {
249 typedef typename std::iterator_traits<Iterator>::value_type value_type;
250 properties[ii].id =
const_cast<value_type&
>(*first).getId().c_str();
251 properties[ii].value <<= *first;
262 std::map<std::string, CosEventChannelAdmin::ProxyPushConsumer_var>
consumers;
263 std::map<std::string, CosEventChannelAdmin::EventChannel_ptr>
_connections;
267 #endif // MESSAGEINTERFACE_H Class & target_
Definition: MessageInterface.h:186
std::map< std::string, MessageCallback * > CallbackTable
Definition: MessageInterface.h:190
ossie::notification< void(const std::string &, const CORBA::Any &)> generic_callbacks_
Definition: MessageInterface.h:193
MessageCallback()
Definition: MessageInterface.h:155
CosEventChannelAdmin::ConsumerAdmin_ptr for_consumers()
void disconnectPort(const char *connectionId)
virtual void operator()(const std::string &value, const CORBA::Any &data)
Definition: MessageInterface.h:168
MessageSupplierPort(std::string port_name)
virtual void operator()(const std::string &value, const CORBA::Any &data)=0
CallbackTable callbacks_
Definition: MessageInterface.h:191
MemberFn func_
Definition: MessageInterface.h:187
Consumer_i * removeConsumer(std::string consumer_id)
std::string getDirection() const
Definition: MessageInterface.h:163
Definition: Port_impl.h:364
Definition: MessageInterface.h:83
void(Class::* MemberFn)(const std::string &, const M &)
Definition: MessageInterface.h:166
void connectPort(CORBA::Object_ptr connection, const char *connectionId)
MessageConsumerPort(std::string port_name)
boost::mutex portInterfaceAccess
Definition: MessageInterface.h:261
void registerMessage(Target target, Func func)
Definition: MessageInterface.h:107
std::map< std::string, CosEventChannelAdmin::EventChannel_ptr > _connections
Definition: MessageInterface.h:141
CosEventComm::PushSupplier_ptr removeSupplier(const std::string &connectionId)
CosEventChannelAdmin::ProxyPushConsumer_ptr extendConsumers(std::string consumer_id)
virtual ~MessageSupplierPort(void)
virtual ~MessageCallback()
Definition: MessageInterface.h:152
CosEventChannelAdmin::ProxyPushConsumer_ptr removeConsumer(std::string consumer_id)
Definition: MessageInterface.h:204
std::string getRepid() const
SupplierAdmin_i * supplier_admin
Definition: MessageInterface.h:143
Definition: MessageInterface.h:148
std::map< std::string, CosEventComm::PushSupplier_var > SupplierTable
Definition: MessageInterface.h:195
void connectPort(CORBA::Object_ptr connection, const char *connectionId)
void push(const CORBA::Any &data)
void extendConsumers(std::string consumer_id, CosEventChannelAdmin::ProxyPushConsumer_ptr proxy_consumer)
void registerMessage(const std::string &id, Class *target, void(Class::*func)(const std::string &, const MessageStruct &))
Definition: MessageInterface.h:101
std::map< std::string, Consumer_i * > consumers
Definition: MessageInterface.h:140
void sendMessages(Iterator first, Iterator last)
Definition: MessageInterface.h:239
void disconnectPort(const char *connectionId)
boost::mutex portInterfaceAccess
Definition: MessageInterface.h:139
std::string getRepid() const
void fireCallback(const std::string &id, const CORBA::Any &data)
virtual ~MessageConsumerPort(void)
Definition: MessageInterface.h:92
SupplierTable suppliers_
Definition: MessageInterface.h:196
void addSupplier(const std::string &connectionId, CosEventComm::PushSupplier_ptr supplier)
Definition: Port_impl.h:320
std::map< std::string, CosEventChannelAdmin::EventChannel_ptr > _connections
Definition: MessageInterface.h:263
CosEventChannelAdmin::SupplierAdmin_ptr for_suppliers()
void sendMessages(const Sequence &messages)
Definition: MessageInterface.h:233
MemberCallback(Class &target, MemberFn func)
Definition: MessageInterface.h:178
std::map< std::string, CosEventChannelAdmin::ProxyPushConsumer_var > consumers
Definition: MessageInterface.h:262
void sendMessage(const Message &message)
Definition: MessageInterface.h:225