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

dsme-posirel-adapter.hh

Go to the documentation of this file.
00001 
00002 #ifndef __DSME_POSIREL_ADAPTER_HH__
00003 #define __DSME_POSIREL_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 POSIRELDataAdapter
00038 {
00039 public:
00040 
00041   static auto_ptr<const POSIRELDataAdapter> createRcvP(const DeviceAccess::AccData& data)
00042   {
00043     if (data.size()>1) {
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 POSIRELDataAdapter>(new POSIRELDataAdapter(mutual_data,0));
00048   }
00049         
00050   static auto_ptr<POSIRELDataAdapter> createSndP(DeviceAccess::AccData& data)
00051   {
00052     data.assign(1,SWord());
00053 
00054     auto_ptr<POSIRELDataAdapter> p(new POSIRELDataAdapter(data,0));
00055     p->init();
00056     return p;
00057   }
00058 
00060   SWord relmov() const {
00061     return (*_ptr)[_offset+0].convert(SWord());
00062   }
00063 
00065   void relmov(SWord val) {
00066     (*_ptr)[_offset+0] = val;
00067   }
00068 
00069 
00071   POSIRELDataAdapter(DeviceAccess::AccData& data, size_t offset=0) : _ptr(&data), _offset(offset)
00072   {
00073   }
00074 
00076   void init() {
00077 
00078   }
00079 
00080 
00081 
00082 private:
00083   DeviceAccess::AccData* _ptr;
00084   size_t _offset;
00085 };
00086 
00088 typedef POSIRELDataAdapter WritePOSIRELDataAdapter;
00089 
00091 typedef auto_ptr<const WritePOSIRELDataAdapter> WritePOSIRELDataP;
00092 
00096 } // namespace EqModDSME
00097 } // namespace DeviceAccess
00098 
00099 #endif

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