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

dsme-posiabss-adapter.hh

Go to the documentation of this file.
00001 
00002 #ifndef __DSME_POSIABSS_ADAPTER_HH__
00003 #define __DSME_POSIABSS_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 POSIABSSDataAdapter
00038 {
00039 public:
00040 
00041   static auto_ptr<const POSIABSSDataAdapter> createRcvP(const DeviceAccess::AccData& data)
00042   {
00043     if (data.size()>4) {
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 POSIABSSDataAdapter>(new POSIABSSDataAdapter(mutual_data,0));
00048   }
00049         
00050   static auto_ptr<POSIABSSDataAdapter> createSndP(DeviceAccess::AccData& data)
00051   {
00052     data.assign(4,SWord());
00053 
00054     auto_ptr<POSIABSSDataAdapter> p(new POSIABSSDataAdapter(data,0));
00055     p->init();
00056     return p;
00057   }
00058 
00060   SWord pos1() const {
00061     return (*_ptr)[_offset+0].convert(SWord());
00062   }
00063 
00065   void pos1(SWord val) {
00066     (*_ptr)[_offset+0] = val;
00067   }
00068 
00070   SWord pos2() const {
00071     return (*_ptr)[_offset+1].convert(SWord());
00072   }
00073 
00075   void pos2(SWord val) {
00076     (*_ptr)[_offset+1] = val;
00077   }
00078 
00080   SWord pos3() const {
00081     return (*_ptr)[_offset+2].convert(SWord());
00082   }
00083 
00085   void pos3(SWord val) {
00086     (*_ptr)[_offset+2] = val;
00087   }
00088 
00090   SWord pos4() const {
00091     return (*_ptr)[_offset+3].convert(SWord());
00092   }
00093 
00095   void pos4(SWord val) {
00096     (*_ptr)[_offset+3] = val;
00097   }
00098 
00099 
00101   POSIABSSDataAdapter(DeviceAccess::AccData& data, size_t offset=0) : _ptr(&data), _offset(offset)
00102   {
00103   }
00104 
00106   void init() {
00107 
00108   }
00109 
00110 
00111 
00112 private:
00113   DeviceAccess::AccData* _ptr;
00114   size_t _offset;
00115 };
00116 
00118 typedef POSIABSSDataAdapter ReadPOSIABSSDataAdapter;
00119 
00121 typedef auto_ptr<ReadPOSIABSSDataAdapter> ReadPOSIABSSDataP;
00122 
00126 } // namespace EqModDSME
00127 } // namespace DeviceAccess
00128 
00129 #endif

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