orca-robotics INTRODUCTION Overview Download and Install Quick Start Documentation Publications REPOSITORY Interfaces Components Libraries Utilities Software Map DEVELOPER Tutorials Examples Dev Guide Dashboard Wiki login/pass: orca/orca PEOPLE Contributors Users Project Download Mailing lists
|
networktracesender.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp 00005 * 00006 * This copy of Orca is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 00011 #ifndef NETWORKTRACESENDER_H 00012 #define NETWORKTRACESENDER_H 00013 00014 #include <IceStorm/IceStorm.h> 00015 #include <IceUtil/Mutex.h> 00016 #include <orca/tracer.h> 00017 #include <orcaice/context.h> 00018 00019 namespace orcaice { 00020 namespace detail { 00021 00022 // 00023 // Knows how to send trace messages to an IceStorm topic. 00024 // 00025 // Note that this does _not_ inherit from gbxsickacfr::gbxutilacfr::Tracer, it's simply 00026 // a convenience class for use by gbxsickacfr::gbxutilacfr::Tracer classes. 00027 // 00028 // @author Alex Brooks 00029 // 00030 class NetworkTraceSender 00031 { 00032 00033 public: 00034 00035 NetworkTraceSender( const std::string &topicName, 00036 IceUtil::Mutex &mutex, 00037 const orcaice::Context &context ); 00038 00039 // sub/unsub subscribers to the topic we're publishing to 00040 void subscribe( const ::orca::TracerConsumerPrx& subscriber ); 00041 void unsubscribe( const ::orca::TracerConsumerPrx& subscriber ); 00042 00043 // Returns: true = success. 00044 bool connectToIceStorm(); 00045 00046 void sendToNetwork( const orca::TracerData &tracerData ); 00047 00048 private: 00049 00050 IceStorm::TopicPrx topicPrx_; 00051 orca::TracerConsumerPrx publisher_; 00052 00053 std::string topicName_; 00054 00055 // We only have one communicator but may have multiple threads. 00056 IceUtil::Mutex &mutex_; 00057 00058 orcaice::Context context_; 00059 }; 00060 00061 } 00062 } 00063 00064 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)