Beispiel #1
0
void IoDevice::copyData(const IoDevice& org, const bool cc)
{
   BaseClass::copyData(org);
   if (cc) initData();

   // clear our old lists of adapters and devices
   setSlotAdapters(nullptr);
   setSlotDevices(nullptr);

   // ---
   // copy the list of I/O adapters
   // ---
   if (org.adapters != nullptr) {
      PairStream* copy = static_cast<PairStream*>(org.adapters->clone());
      setSlotAdapters(copy);
      copy->unref();
   }

   // ---
   // copy the list of I/O devices
   // ---
   if (org.devices != nullptr) {
      PairStream* copy = static_cast<PairStream*>(org.devices->clone());
      setSlotDevices(copy);
      copy->unref();
   }
}
Beispiel #2
0
//------------------------------------------------------------------------------
// copyData() -- copy member data
//------------------------------------------------------------------------------
void IoHandler::copyData(const IoHandler& org, const bool cc)
{
   BaseClass::copyData(org);
   if (cc) initData();

   // clear the I/O buffers and list of devices
   setSlotIoData(nullptr);
   setSlotDevices(nullptr);

   // ---
   // copy the I/O buffers
   // ---
   if (org.inData != nullptr && org.inData == org.outData) {
      // Common input/output buffer
      IoData* copy = static_cast<IoData*>(org.inData->clone());
      setSlotIoData(copy);
      copy->unref();
   }
   else {
      // Separate input/output buffers
      if (org.inData != nullptr) {
         IoData* copy = static_cast<IoData*>(org.inData->clone());
         setSlotInputData(copy);
         copy->unref();
      }
      if (org.outData != nullptr) {
         IoData* copy = static_cast<IoData*>(org.outData->clone());
         setSlotOutputData(copy);
         copy->unref();
      }
   }

   // ---
   // copy the list of I/O devices
   // ---
   if (org.devices != nullptr) {
      PairStream* copy = static_cast<PairStream*>(org.devices->clone());
      setSlotDevices(copy);
      copy->unref();
   }

   netInitialized = false;
   netInitFailed = false;

   rate = 50;
   pri = 0.0;

   if (thread != nullptr) {
      thread->terminate();
      thread = nullptr;
   }
}
Beispiel #3
0
void IoDevice::deleteData()
{
   setSlotAdapters(nullptr);
   setSlotDevices(nullptr);
}