Main Page | Modules | Alphabetical List | Class List | File List | Class Members

dsme-disti-adapter.hh

Go to the documentation of this file.
00001 
00002 #ifndef __DSME_DISTI_ADAPTER_HH__
00003 #define __DSME_DISTI_ADAPTER_HH__
00004 
00014 #include <accdata.hh>
00015 #include <accvector.hh>
00016 #include <accdevexception.hh>
00017 
00018 
00019 
00020 using std::auto_ptr;
00021 
00022 namespace DeviceAccess
00023 {
00024 namespace EqModDSME
00025 {
00026 
00037 class E_API DISTIDataAdapter
00038 {
00039 public:
00040 
00041   static auto_ptr<const DISTIDataAdapter> createRcvP(const DeviceAccess::AccData& data)
00042   {
00043     if (data.size()>2) {
00044       throw(AccDevException(ODA_MOREDATA,ODA_OK,ACCDEV_ERRORLOCATION));
00045     }
00046     DeviceAccess::AccData& mutual_data = const_cast<DeviceAccess::AccData&>(data);
00047     return auto_ptr<const DISTIDataAdapter>(new DISTIDataAdapter(mutual_data,0));
00048   }
00049         
00050   static auto_ptr<DISTIDataAdapter> createSndP(DeviceAccess::AccData& data)
00051   {
00052     data.assign(2,SWord());
00053 
00054     auto_ptr<DISTIDataAdapter> p(new DISTIDataAdapter(data,0));
00055     p->init();
00056     return p;
00057   }
00058 
00060   SWord distfront() const {
00061     return (*_ptr)[_offset+0].convert(SWord());
00062   }
00063 
00065   void distfront(SWord val) {
00066     (*_ptr)[_offset+0] = val;
00067   }
00068 
00070   SWord distback() const {
00071     return (*_ptr)[_offset+1].convert(SWord());
00072   }
00073 
00075   void distback(SWord val) {
00076     (*_ptr)[_offset+1] = val;
00077   }
00078 
00079 
00081   DISTIDataAdapter(DeviceAccess::AccData& data, size_t offset=0) : _ptr(&data), _offset(offset)
00082   {
00083   }
00084 
00086   void init() {
00087 
00088   }
00089 
00090 
00091 
00092 private:
00093   DeviceAccess::AccData* _ptr;
00094   size_t _offset;
00095 };
00096 
00098 typedef DISTIDataAdapter ReadDISTIDataAdapter;
00099 
00101 typedef auto_ptr<ReadDISTIDataAdapter> ReadDISTIDataP;
00102 
00106 } // namespace EqModDSME
00107 } // namespace DeviceAccess
00108 
00109 #endif

Generated on Tue Apr 21 16:51:44 2009 for DSME-Equipment Model for Septum stepper driver. by doxygen 1.3.5