orca-robotics


INTRODUCTION
Overview
Download and Install
Documentation

REPOSITORY
Interfaces
Drivers
Libraries
Utilities
Software Map

DEVELOPER
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

multiimplementation.h

00001 #ifndef HYDRO_DLLTEST_MULTI_IMPLEMENTATION_H
00002 #define HYDRO_DLLTEST_MULTI_IMPLEMENTATION_H
00003 
00004 #include "interface.h"
00005 #include <string>
00006 #include <hydroportability/sharedlib.h>
00007 
00008 namespace dlltest {
00009 
00010 class SOEXPORT TwoImplementation : public Interface
00011 {
00012 public:
00013     TwoImplementation() : number_(2) {};
00014     virtual int number() const;
00015 
00016 private:
00017     int number_;
00018 };
00019 
00020 class SOEXPORT ThreeImplementation : public Interface
00021 {
00022 public:
00023     ThreeImplementation() : number_(3) {};
00024     virtual int number() const;
00025 
00026 private:
00027     int number_;
00028 };
00029 
00030 // Helper class to instantiate drivers
00031 class SOEXPORT MyFactory : public Factory
00032 {
00033 public:
00034     virtual Interface* create( int number ) const
00035     {
00036         switch ( number )
00037         { 
00038             case 2 :
00039                 return new TwoImplementation;
00040             case 3 :
00041                 return new ThreeImplementation;
00042             default :
00043                 throw std::string("Unsupported implementation type");
00044         }
00045     }
00046 };
00047 
00048 } // namespace
00049 
00050 // Used for dynamically loading driver
00051 extern "C" {
00052     SOEXPORT dlltest::Factory *createFactory();
00053 }
00054 
00055 #endif
 

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


Generated for Orca Robotics by  doxygen 1.4.5