Commit 29d06be9 authored by Thomas Braun's avatar Thomas Braun
Browse files

src/server: Factor NoSyncModelTangoMonitor out

parent 9f527df1
Loading
Loading
Loading
Loading
+0 −23
Original line number Diff line number Diff line
@@ -45,29 +45,6 @@ class AutoTangoMonitor
    omni_thread::ensure_self auto_self;
};

//---------------------------------------------------------------------------------------------------------------------
//
// class :
//        NoSyncModelTangoMonitor
//
// description :
//        This class is only a helper class used to get a TangoMonitor object during its construction and to
//        it during its destruction only if the device server process is in NO_SYNC synchronisation model
//
//--------------------------------------------------------------------------------------------------------------------

class NoSyncModelTangoMonitor
{
  public:
    NoSyncModelTangoMonitor(Tango::DeviceImpl *dev);

    ~NoSyncModelTangoMonitor();

  private:
    TangoMonitor *mon;
    omni_thread::ensure_self auto_self;
};

} // namespace Tango

#endif /* AUTO_TANGO_MONITOR */
+2 −0
Original line number Diff line number Diff line
@@ -60,6 +60,8 @@ set(SERVER_HEADERS UserDefaultAttrProp.h
    KillThread.h
    MultiAttribute.h
    MultiAttrProp.h
    NoSyncModelTangoMonitor.h
    NotifdEventSupplier.h
    UserDefaultPipeProp.h
    UserDefaultFwdAttrProp.h
    PollObj.h
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <tango/server/ImageAttr.h>
#include <tango/server/MultiAttribute.h>
#include <tango/server/MultiClassAttribute.h>
#include <tango/server/NoSyncModelTangoMonitor.h>
#include <tango/server/PipeProperty.h>
#include <tango/server/PollObj.h>
#include <tango/server/SpectrumAttr.h>
+42 −0
Original line number Diff line number Diff line
/*
 * SPDX-FileCopyrightText: 2004 Copyright contributors to the cppTango project
 *
 * SPDX-License-Identifier: LGPL-3.0-or-later
 */

#ifndef TANGO_SERVER_NOSYNCMODELTANGOMONITOR_H
#define TANGO_SERVER_NOSYNCMODELTANGOMONITOR_H

#include <tango/common/omnithread_wrapper.h>

namespace Tango
{
class DeviceImpl;
class TangoMonitor;

//---------------------------------------------------------------------------------------------------------------------
//
// class :
//        NoSyncModelTangoMonitor
//
// description :
//        This class is only a helper class used to get a TangoMonitor object during its construction and to
//        it during its destruction only if the device server process is in NO_SYNC synchronisation model
//
//--------------------------------------------------------------------------------------------------------------------

class NoSyncModelTangoMonitor
{
  public:
    NoSyncModelTangoMonitor(Tango::DeviceImpl *dev);

    ~NoSyncModelTangoMonitor();

  private:
    TangoMonitor *mon;
    omni_thread::ensure_self auto_self;
};

} // namespace Tango

#endif /* AUTO_TANGO_MONITOR */
+0 −32
Original line number Diff line number Diff line
@@ -103,36 +103,4 @@ AutoTangoMonitor::AutoTangoMonitor(const std::shared_ptr<Tango::TangoMonitor> &m
{
}

//---------------------------------------------------------------------------------------------------------------
//
// class :
//        NoSyncModelTangoMonitor
//
// description :
//        This class is only a helper class used to get a TangoMonitor object during its construction and to
//        it during its destruction only if the device server process is in NO_SYNC synchronisation model
//
//---------------------------------------------------------------------------------------------------------------
NoSyncModelTangoMonitor::NoSyncModelTangoMonitor(Tango::DeviceImpl *dev)
{
    SerialModel ser = Util::instance()->get_serial_model();
    if(ser == NO_SYNC)
    {
        mon = &(dev->only_one);
        mon->get_monitor();
    }
    else
    {
        mon = nullptr;
    }
}

NoSyncModelTangoMonitor::~NoSyncModelTangoMonitor()
{
    if(mon != nullptr)
    {
        mon->rel_monitor();
    }
}

} // namespace Tango
Loading