SimpleRobotBrainComponent.H
00001 #ifndef SIMPLEROBOTBRAINCOMPONENT_H_
00002 #define SIMPLEROBOTBRAINCOMPONENT_H_
00003
00004 #include <string>
00005 #include <IceE/IceE.h>
00006 #include "miniIce/SimpleRobotSimEvents.h"
00007 #include "miniIce/IceStorm.h"
00008
00009
00010 #define DEFAULT_STARTING_PORT 2121
00011 #define DEFAULT_TIMEOUT 1000
00012
00013
00014
00015 class SimpleRobotBrainComponent : public RobotSimEvents::Events
00016 {
00017 public:
00018 SimpleRobotBrainComponent(char * iceStormIP, char * myName, Ice::CommunicatorPtr ic);
00019 virtual ~SimpleRobotBrainComponent();
00020
00021 bool registerSubscription(const std::string& MessageTopic);
00022 bool registerPublisher(const std::string& MessageTopic);
00023 bool publish(const std::string& MessageTopic, RobotSimEvents::EventMessagePtr msg);
00024 void start();
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 virtual void run() = 0;
00036
00037 virtual void registerTopics() = 0;
00038
00039 virtual void updateMessage(const RobotSimEvents::EventMessagePtr& eMsg,
00040 const Ice::Current&) {};
00041
00042
00043 private:
00044 Ice::CommunicatorPtr itsIc;
00045 Ice::ObjectAdapterPtr itsAdapter;
00046 Ice::ObjectPrx itsObjectPrx;
00047 IceStorm::TopicManagerPrx itsTopicManagerPrx;
00048
00049 std::map<std::string, IceStorm::TopicPrx> itsTopicSubscriptions;
00050 std::map<std::string, RobotSimEvents::EventsPrx> itsTopicPublishers;
00051
00052 };
00053
00054 #endif