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         //This is what you must implement
00028         // There is no threading as these are intended to be SIMPLE
00029         // so you must put a while(true) loop inside this method to
00030         // keep executing you.
00031         // There is no sleeping like in RobotBrainComponent, if you
00032         // want that feature then implement it in your inherited
00033         // object, as not all of us want it on the robot.
00034         // That's about it :)
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 /*SIMPLEROBOTBRAINCOMPONENT_H_*/
Generated on Sun May 8 08:41:21 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3