/* * ALMA - Atacama Large Millimiter Array * (c) European Southern Observatory, 2003 * *This library is free software; you can redistribute it and/or *modify it under the terms of the GNU Lesser General Public *License as published by the Free Software Foundation; either *version 2.1 of the License, or (at your option) any later version. * *This library is distributed in the hope that it will be useful, *but WITHOUT ANY WARRANTY; without even the implied warranty of *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *Lesser General Public License for more details. * *You should have received a copy of the GNU Lesser General Public *License along with this library; if not, write to the Free Software *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "baciROdiscImpl_T.h" #include "baciPcommonImpl_T.i" #include "baciROcommonImpl_T.i" template baci::ROdiscImpl::ROdiscImpl(const ACE_CString& name, BACIComponent *component_p, DevIO *devIO, bool flagdeldevIO, int initalize) : baci::ROcommonImpl(name, component_p, devIO, flagdeldevIO) { ACS_TRACE("baci::ROdiscImpl<>::ROdiscImpl"); /*TBD: fix BACI type in MonitorEventDisp if (this->monitorEventDispatcher_mp!=0 && this->alarmTimerTrig_m!=0) { alarmSystemMonitor_mp = new AlarmSystemMonitorDisc(this, this->monitorEventDispatcher_mp); }//if */ this->initialization_m = initalize; } template baci::ROdiscImpl::ROdiscImpl(bool init, const ACE_CString& name, BACIComponent *component_p, DevIO *devIO, bool flagdeldevIO, int initalize) : ROcommonImpl(init, name, component_p, devIO, flagdeldevIO)/*, alarmSystemMonitor_mp(0)*/ { ACS_TRACE("baci::ROdiscImpl<>::ROdiscImpl"); /* initalization will be done in subclass if (this->monitorEventDispatcher_mp!=0 && this->alarmTimerTrig_m!=0) { alarmSystemMonitor_mp = new AlarmSystemMonitorDisc(this, this->monitorEventDispatcher_mp); }//if */ this->initialization_m = initalize; }//ROdiscImpl template baci::ROdiscImpl::~ROdiscImpl() { //TBD: ACS_TRACE("baci::ROdiscImpl<>::~ROdiscImpl"); /* if (alarmSystemMonitor_mp) { delete alarmSystemMonitor_mp; alarmSystemMonitor_mp = 0; } */ }//~ROdiscImp /* ---------------------- [ CORBA interface ] ---------------------- */ template ACS::Subscription_ptr baci::ROdiscImpl::new_subscription_Alarm (TAlarm *cb, const ACS::CBDescIn & desc ) { //TBD: this could be done just in the constructor if (this->alarmTimerTrig_m==0) { ACS_LOG(LM_RUNTIME_CONTEXT, "baci::ROdiscImpl<>::new_subscription_Alarm", (LM_ERROR, "Can not create alarm dispatcher for %s because alarm_timer_trig=0", this->getProperty()->getName())); throw CORBA::NO_RESOURCES(); }// if (this->monitorEventDispatcher_mp==0) { CBDescIn descIn; descIn.id_tag = 0; this->monitorEventDispatcher_mp = new MonitorEventDispatcher(descIn, this->alarmTimerTrig_m, this->property_mp); if (this->monitorEventDispatcher_mp==0) throw CORBA::NO_RESOURCES(); } AlarmEventStrategyDisc * eventStrategy_p = new AlarmEventStrategyDisc(cb, desc, this->alarmTimerTrig_m, this, this->monitorEventDispatcher_mp); if (eventStrategy_p==0) throw CORBA::NO_RESOURCES(); this->monitorEventDispatcher_mp->subscribe(eventStrategy_p); ACS::Subscription_var subscription = ACS::Subscription::_narrow(eventStrategy_p->getCORBAReference()); return subscription._retn(); }