INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities

FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities

Full Software Listings

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

snapshotloggers.h

00001 #ifndef ORCALOGFACTORY_SNAPSHOTLOGGERS_H
00002 #define ORCALOGFACTORY_SNAPSHOTLOGGERS_H
00003 
00004 #include <orcaifaceimpl/consumerImpl.h>
00005 #include <IceUtil/Mutex.h>
00006 #include <orcalog/snapshotloggerfactory.h>
00007 #include <orcalogfactory/logwriters.h>
00008 #include <orcaifaceimpl/pathfollower2d.h>
00009 
00010 namespace orcalogfactory {
00011 
00012 //
00013 // A set of SnapshotLoggers: ie loggers which run continuously after
00014 //                           initialisation, buffering up data, then dump the buffer on command.
00015 //
00016 
00018 
00020 
00021 typedef orcalog::GenericSnapshotLogger<orca::Cpu, orca::CpuConsumer, orca::CpuData,
00022                                        CpuLogWriter> CpuSnapshotLogger;
00023 
00025 
00026 class DriveBicycleSnapshotLogger : public orcalog::GenericSnapshotLogger<orca::DriveBicycle,
00027                                                                          orca::DriveBicycleConsumer,
00028                                                                          orca::DriveBicycleData,
00029                                                                          DriveBicycleLogWriter>
00030 {
00031 public:
00032     DriveBicycleSnapshotLogger( const orcaice::Context &context ) :
00033         orcalog::GenericSnapshotLogger<orca::DriveBicycle,
00034                                        orca::DriveBicycleConsumer,
00035                                        orca::DriveBicycleData,
00036                                        DriveBicycleLogWriter>( context ) {};
00037 private:
00038     void doSpecialisedSnapshotPreparation( DriveBicycleLogWriter &logWriter )
00039         {
00040             // may throw
00041             orca::DriveBicyclePrx objectPrx;
00042             orcaice::connectToInterfaceWithTag( logWriter.logWriterInfo().context,
00043                                                 objectPrx,
00044                                                 logWriter.logWriterInfo().interfaceTag );
00045             logWriter.write( objectPrx->getDescription() );
00046         }
00047 };
00048 
00050 
00051 typedef orcalog::GenericSnapshotLogger<orca::Imu, orca::ImuConsumer, orca::ImuData,
00052                           ImuLogWriter> ImuSnapshotLogger;
00053 
00055 
00056 class Localise2dSnapshotLogger : public orcalog::GenericSnapshotLogger<orca::Localise2d,
00057                                                                        orca::Localise2dConsumer,
00058                                                                        orca::Localise2dData,
00059                                                                        Localise2dLogWriter>
00060 {
00061 public:
00062     Localise2dSnapshotLogger( const orcaice::Context &context ) :
00063         orcalog::GenericSnapshotLogger<orca::Localise2d,
00064                                        orca::Localise2dConsumer,
00065                                        orca::Localise2dData,
00066                                        Localise2dLogWriter>( context ) {};
00067 private:
00068     void doSpecialisedSnapshotPreparation( Localise2dLogWriter &logWriter )
00069         {
00070             // may throw
00071             orca::Localise2dPrx objectPrx;
00072             orcaice::connectToInterfaceWithTag( logWriter.logWriterInfo().context,
00073                                                 objectPrx,
00074                                                 logWriter.logWriterInfo().interfaceTag );
00075             logWriter.write( objectPrx->getDescription() );
00076         }
00077 };
00078 
00080 
00081 class Localise3dSnapshotLogger : public orcalog::GenericSnapshotLogger<orca::Localise3d,
00082                                                                        orca::Localise3dConsumer,
00083                                                                        orca::Localise3dData,
00084                                                                        Localise3dLogWriter>
00085 {
00086 public:
00087     Localise3dSnapshotLogger( const orcaice::Context &context ) :
00088         orcalog::GenericSnapshotLogger<orca::Localise3d,
00089                                        orca::Localise3dConsumer,
00090                                        orca::Localise3dData,
00091                                        Localise3dLogWriter>( context ) {};
00092 private:
00093     void doSpecialisedSnapshotPreparation( Localise3dLogWriter &logWriter )
00094         {
00095             // may throw
00096             orca::Localise3dPrx objectPrx;
00097             orcaice::connectToInterfaceWithTag( logWriter.logWriterInfo().context,
00098                                                 objectPrx,
00099                                                 logWriter.logWriterInfo().interfaceTag );
00100             logWriter.write( objectPrx->getDescription() );
00101         }
00102 };
00103 
00105 
00106 class Odometry2dSnapshotLogger : public orcalog::GenericSnapshotLogger<orca::Odometry2d,
00107                                                                        orca::Odometry2dConsumer,
00108                                                                        orca::Odometry2dData,
00109                                                                        Odometry2dLogWriter>
00110 {
00111 public:
00112     Odometry2dSnapshotLogger( const orcaice::Context &context ) :
00113         orcalog::GenericSnapshotLogger<orca::Odometry2d,
00114                                        orca::Odometry2dConsumer,
00115                                        orca::Odometry2dData,
00116                                        Odometry2dLogWriter>( context ) {};
00117 private:
00118     void doSpecialisedSnapshotPreparation( Odometry2dLogWriter &logWriter )
00119         {
00120             // may throw
00121             orca::Odometry2dPrx objectPrx;
00122             orcaice::connectToInterfaceWithTag( logWriter.logWriterInfo().context,
00123                                                 objectPrx,
00124                                                 logWriter.logWriterInfo().interfaceTag );
00125             logWriter.write( objectPrx->getDescription() );
00126         }
00127 };
00128 
00130 
00131 class Odometry3dSnapshotLogger : public orcalog::GenericSnapshotLogger<orca::Odometry3d,
00132                                                                        orca::Odometry3dConsumer,
00133                                                                        orca::Odometry3dData,
00134                                                                        Odometry3dLogWriter>
00135 {
00136 public:
00137     Odometry3dSnapshotLogger( const orcaice::Context &context ) :
00138         orcalog::GenericSnapshotLogger<orca::Odometry3d,
00139                                        orca::Odometry3dConsumer,
00140                                        orca::Odometry3dData,
00141                                        Odometry3dLogWriter>( context ) {};
00142 private:
00143     void doSpecialisedSnapshotPreparation( Odometry3dLogWriter &logWriter )
00144         {
00145             // may throw
00146             orca::Odometry3dPrx objectPrx;
00147             orcaice::connectToInterfaceWithTag( logWriter.logWriterInfo().context,
00148                                                 objectPrx,
00149                                                 logWriter.logWriterInfo().interfaceTag );
00150             logWriter.write( objectPrx->getDescription() );
00151         }
00152 };
00153 
00155 
00156 typedef orcalog::GenericSnapshotLogger<orca::PolarFeature2d, orca::PolarFeature2dConsumer, orca::PolarFeature2dData,
00157                                        PolarFeature2dLogWriter> PolarFeature2dSnapshotLogger;
00158 
00160 
00161 typedef orcalog::GenericSnapshotLogger<orca::Power, orca::PowerConsumer, orca::PowerData,
00162                                        PowerLogWriter> PowerSnapshotLogger;
00163 
00165 
00166 typedef orcalog::GenericSnapshotLogger<orca::Wifi, orca::WifiConsumer, orca::WifiData,
00167                                        WifiLogWriter> WifiSnapshotLogger;
00168 
00170 
00171 class GpsSnapshotLogger : public orcalog::GenericSnapshotLogger<orca::Gps,
00172                                                                 orca::GpsConsumer,
00173                                                                 orca::GpsData,
00174                                                                 GpsLogWriter>
00175 {
00176 public:
00177     GpsSnapshotLogger( const orcaice::Context &context ) :
00178         orcalog::GenericSnapshotLogger<orca::Gps,
00179                                        orca::GpsConsumer,
00180                                        orca::GpsData,
00181                                        GpsLogWriter>( context ) {};
00182 private:
00183     void doSpecialisedSnapshotPreparation( GpsLogWriter &logWriter )
00184         {
00185             // may throw
00186             orca::GpsPrx objectPrx;
00187             orcaice::connectToInterfaceWithTag( logWriter.logWriterInfo().context,
00188                                                 objectPrx,
00189                                                 logWriter.logWriterInfo().interfaceTag );
00190             logWriter.write( objectPrx->getDescription() );
00191         }
00192 };
00194 
00195 class LaserScanner2dSnapshotLogger : 
00196               public orcaifaceimpl::ConsumerImpl<orca::RangeScanner2d,
00197                                                  orca::RangeScanner2dConsumer,
00198                                                  orca::RangeScanner2dDataPtr>, 
00199               public orcalog::SnapshotLogger
00200 {
00201 public:
00202 
00203     LaserScanner2dSnapshotLogger( const orcaice::Context &context );
00204 
00205     virtual void dataEvent(const orca::RangeScanner2dDataPtr& data );
00206 
00207     virtual void init( const std::string &format, double timeWindowSec );
00208 
00209     virtual void subscribe( const std::string &interfaceTag )
00210         { subscribeWithTag( interfaceTag ); };
00211 
00212     virtual void prepareForSnapshot( const orcalog::LogWriterInfo &logWriterInfo,
00213                                       orcalog::MasterFileWriter    &masterFileWriter );
00214     virtual void finaliseSnapshot();
00215 
00216     virtual unsigned int snapshotBufferSize() const
00217         { return snapshotLogBuffer_->bufferSize(); }
00218     virtual const orca::Time &oldestArrivalTime() const
00219         { return snapshotLogBuffer_->oldestArrivalTime(); }
00220     virtual void writeOldestObjToLogAndDiscard()
00221         { snapshotLogBuffer_->writeOldestObjToLogAndDiscard(*logWriter_); }
00222 
00223 private:
00224 
00225     bool                                      isTakingSnapshot_;
00226     std::auto_ptr< orcalog::SnapshotLogBuffer<orca::LaserScanner2dDataPtr,
00227                                               LaserScanner2dLogWriter> > snapshotLogBuffer_;
00228     std::auto_ptr<LaserScanner2dLogWriter>    logWriter_;
00229     IceUtil::Mutex                            mutex_;
00230 
00231 };
00232 
00234 
00235 class PathFollower2dSnapshotLogger : 
00236               public orcaifaceimpl::ConsumerImpl<orca::PathFollower2d,
00237                                                  orca::PathFollower2dConsumer,
00238                                                  orca::PathFollower2dData,
00239                                                  orcaifaceimpl::PathFollower2dConsumerTypeI>, 
00240               public orcalog::SnapshotLogger
00241 {
00242 public:
00243 
00244     PathFollower2dSnapshotLogger( const orcaice::Context &context );
00245 
00246     virtual void dataEvent(const orca::PathFollower2dData& data );
00247 
00248     virtual void init( const std::string &format, double timeWindowSec );
00249 
00250     virtual void subscribe( const std::string &interfaceTag )
00251         { subscribeWithTag( interfaceTag ); };
00252 
00253     virtual void prepareForSnapshot( const orcalog::LogWriterInfo &logWriterInfo,
00254                                       orcalog::MasterFileWriter    &masterFileWriter );
00255     virtual void finaliseSnapshot();
00256 
00257     virtual unsigned int snapshotBufferSize() const
00258         { return snapshotLogBuffer_->bufferSize(); }
00259     virtual const orca::Time &oldestArrivalTime() const
00260         { return snapshotLogBuffer_->oldestArrivalTime(); }
00261     virtual void writeOldestObjToLogAndDiscard()
00262         { snapshotLogBuffer_->writeOldestObjToLogAndDiscard(*logWriter_); }
00263 
00264 private:
00265 
00266     bool                                      isTakingSnapshot_;
00267     std::auto_ptr< orcalog::SnapshotLogBuffer<orca::PathFollower2dData,
00268                                               PathFollower2dLogWriter> > snapshotLogBuffer_;
00269     std::auto_ptr<PathFollower2dLogWriter>    logWriter_;
00270     IceUtil::Mutex                            mutex_;
00271 
00272 };
00273 
00274 
00275 } // namespace
00276 
00277 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5