Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GYROSCOMMSINTERFACE_HPP_
00017 #define GYROSCOMMSINTERFACE_HPP_
00018
00019 #include <LABUSTTypes.h>
00020 #include <string>
00021 #include <labust/xml/GyrosReader.hpp>
00022 #include <labust/xml/GyrosWriter.hpp>
00023 #include <labust/xml/GyrosMatrix.hpp>
00024 #include <boost/smart_ptr.hpp>
00025
00026 #include <labust/plugins/Factory.hpp>
00027 #include <labust/plugins/DLLoad.hpp>
00028 #include <labust/xml/xmlfwd.hpp>
00029
00030 namespace LABUST
00031 {
00032 namespace COMMUNICATION
00033 {
00034
00035 namespace COMMERRORS
00036 {
00037
00038 enum CommError
00039 {
00040 notImplemented = -2,
00041 undefined = -1,
00042 noError = 0,
00043 noData = 1,
00044 callbackRegistered,
00045 communicationFailed,
00046 commsMisconfigured
00047 };
00048 }
00049
00053 class CommEntity
00054 {
00055 public:
00064 virtual int AcceptData(std::vector<labust::xml::GyrosReader> &data) = 0;
00065 private:
00066
00067 };
00068
00078 class GyrosCommsInterface
00079 {
00080 public:
00081
00082 GyrosCommsInterface():
00083 connected(false)
00084 {};
00085
00086
00087
00088
00089 virtual ~GyrosCommsInterface()
00090 {
00091 }
00092
00103 virtual COMMERRORS::CommError Send(const labust::xml::GyrosWriter &data, bool wait = false) = 0;
00104
00115 virtual COMMERRORS::CommError Send(const std::vector<labust::xml::GyrosWriter> &data, bool wait = false) = 0;
00116
00128 virtual COMMERRORS::CommError Receive(std::vector<labust::xml::GyrosReader> &data, bool wait = false) = 0;
00129
00137 virtual const void* GetCommObject(void)
00138 {
00139 return NULL;
00140 };
00141
00151 virtual void RegisterCallbackObject(CommEntity *entity)
00152 {
00153 this->callbackObject = entity;
00154 };
00155
00160 virtual void unRegisterCallbackObject()
00161 {
00162 this->callbackObject = NULL;
00163 };
00164
00165 inline const bool Connected()
00166 {
00167 return connected;
00168 }
00169 protected:
00170
00175 CommEntity *callbackObject;
00176
00177 bool connected;
00178 private:
00179
00180
00181
00182 GyrosCommsInterface(const GyrosCommsInterface& orig);
00183 GyrosCommsInterface & operator =(const GyrosCommsInterface &);
00184 };
00185
00186
00187 typedef boost::shared_ptr<GyrosCommsInterface> GyrosCommsInterfacePtr;
00188
00189
00190
00191 typedef labust::plugins::TmplPluginFactory<
00192 GyrosCommsInterface,
00193 const labust::xml::Reader&,
00194 const std::string&> CommsFactory;
00195
00196 typedef CommsFactory::AbstractFactory* CommsFactoryPtr;
00197
00198 typedef labust::plugins::DLLoad<LABUST::COMMUNICATION::CommsFactory> CommsPlugin;
00199 typedef boost::shared_ptr<CommsPlugin> CommsPluginPtr;
00200
00201
00202 };
00203 };
00204 #endif