Example #1
0
void BACIComponent::setRTSleepTime(const ACS::TimeInterval& _actionThreadSleepTime)
{
  ACS_TRACE("baci::BACIComponent::setRTSleepTime");
  actionThreadSleepTime_m=(_actionThreadSleepTime<minRTSleepTime_m) ? (minRTSleepTime_m):(_actionThreadSleepTime);
  if (actionThread_mp!=BACIThread::NullBACIThread)
      {
      actionThread_mp->setSleepTime(actionThreadSleepTime_m);
      }
}
Example #2
0
void BACIComponent::setMTResponseTime(const ACS::TimeInterval& _monitorThreadResponseTime)
{
  ACS_TRACE("baci::BACIComponent::setMTResponseTime");
  monitorThreadResponseTime_m=_monitorThreadResponseTime;
  if (monitorThread_mp!=BACIThread::NullBACIThread)
      {
      monitorThread_mp->setResponseTime(monitorThreadResponseTime_m);
      }
}
Example #3
0
void BACIComponent::setRTResponseTime(const ACS::TimeInterval& _actionThreadResponseTime)
{
  ACS_TRACE("baci::BACIComponent::setRTResponseTime");
  actionThreadResponseTime_m=_actionThreadResponseTime;
  if (actionThread_mp!=BACIThread::NullBACIThread)
      {
      actionThread_mp->setResponseTime(actionThreadResponseTime_m);
      }
}
/////////////////////////////////////////////////
// MethodTestComponent
/////////////////////////////////////////////////
    MethodTestComponent::MethodTestComponent(const ACE_CString& name,
					     maci::ContainerServices *containerServices) :
    BasePerfCompImpl(name, containerServices),
    m_charSeq(0)
{
    ACS_TRACE("::MethodTestComponent::MethodTestComponent");
    
    m_charSeq = new perftest::charSeq(0);
    m_charSeq->length(0);
}
int
BulkDataReceiverCbDistr1::cbStop()
{
    ACS_TRACE("BulkDataReceiverCbDistr1::cbStop"); 

    if(flowNumber_m == 1)
	ACS_SHORT_LOG((LM_INFO, "RECEIVER 1 flow 1 total length: %d", count1_m)); 

    return 0;
}
    TestACSThread(const ACE_CString& name,
			       const ACS::TimeInterval& responseTime,
			       const ACS::TimeInterval& sleepTime,
			       bool del,
			       const long thrFlags,
			       const size_t stackSize) :
	ACS::Thread(name, responseTime, sleepTime, del, thrFlags, stackSize)
	{
	    ACS_TRACE("TestACSThread::TestACSThread");
	}
Example #7
0
void BACIMonitor::resume()
{
  ACS_TRACE("baci::BACIMonitor::resume");
  ACS_DEBUG_PARAM("baci::BACIMonitor::resume", "'%s' resumed", name_m.c_str());
  if (suspended_m==true) {
    suspended_m=false;
    monitorStateChanged();
    property_mp->updateMonitorStates();
  }
}
Example #8
0
void BACIComponent::removeCallback(int callbackID)
{
  ACS_TRACE("baci::BACIComponent::removeCallback");
  ThreadSyncGuard guard(&callbackTableMutex_m);
  if (callbackTable_m.isAllocated(callbackID)==true)
    {
      BACICallback* callback_p = callbackTable_m[callbackID];
      callbackTable_m.deallocate(callbackID);
      delete callback_p;
    }
}
void 
ErrorComponent::outCompletion(ACSErr::Completion_out comp)
{
        ACS_TRACE("ErrorComponent::outCompletion");
        ACSErrTypeOK::ACSErrOKCompletion c;
        comp = c.returnCompletion(false);
    
            //comp=new ACSErr::Completion();
        //comp=new ACSErrTypeCommon::GenericErrorCompletion(__FILE__, __LINE__,"ErrorComponent::outCompletion");

}
Example #10
0
	SetterThread(const ACE_CString& name,
			ENUMPROP_TEST::enumpropTestDevice* dev,
			const ACS::TimeInterval& responseTime=ThreadBase::defaultResponseTime,
			const ACS::TimeInterval& sleepTime=ThreadBase::defaultSleepTime) :
	ACS::Thread(name, responseTime, sleepTime)
	{
	    ACS_TRACE("SetterThread::SetterThread");
	    dev_m = ENUMPROP_TEST::enumpropTestDevice::_duplicate(dev);

	    ACS_SHORT_LOG((LM_INFO, "%s: Created thread", getName().c_str()));
	}
Example #11
0
/* ----------------------------------------------------------------*/
CounterSupplierImpl::~CounterSupplierImpl()
{
    // ACS_TRACE is used for debugging purposes
    ACS_TRACE("::CounterSupplier::~CounterSupplier");

    if (m_CounterSupplier_p != NULL) {
    	m_CounterSupplier_p->disconnect();
    	m_CounterSupplier_p = NULL;
    }

    ACS_DEBUG_PARAM("::CounterSupplier::~CounterSupplier", "Destroying %s...", name());
}
Example #12
0
//-----------------------------------------------------------------------------
Consumer::Consumer(const char* channelName, CORBA::ORB_ptr orb, const char* acsNCDomainName) : 
    Helper(channelName,acsNCDomainName),
    consumerAdmin_m(0),
    proxySupplier_m(0),
    numEvents_m(0),
    reference_m(0),
    profiler_mp(0),
    orb_mp(0)
{
    ACS_TRACE("Consumer::Consumer");
    orb_mp = orb;
}
/************
 * Utility method to build a deep ErrorTrace
 ************/
void
ErrorComponent::buildErrorTrace(unsigned short depth) 
{
    ACS_TRACE("::ErrorComponent::buildErrorTrace");

    /*
     * If depth is 1, we are at the bottom and 
     * we just have to throw an exception.
     * Going up the recursive chain this will be
     * atteched to all other exceptions
     */
    if(depth == 1)
	{
	ACSErrTypeCommon::GenericErrorExImpl ex(__FILE__, __LINE__, 
						"ErrorComponent::buildErrorTrace");
	ex.setErrorDesc("Bottom of error trace");
	throw ex;
	}
	    
    /*
     * If depth > 1, make a recursive call.
     * We will have to get back an exception with a trace with
     * a depth shorter by 1 element.
     */
    if(depth > 1)
	{
	try
	    {
	    buildErrorTrace(depth-1);
	    }
	catch(ACSErrTypeCommon::GenericErrorExImpl &ex)
	    {
	    ACSErrTypeCommon::GenericErrorExImpl ex2(ex, 
						     __FILE__, __LINE__, 
						     "ErrorComponent::errorTrace");

	    ex2.setErrorDesc("Generated multi level exception level");
	    throw ex2;
	    }
	catch(...) // This should never happen!!!!
	    {
	    ACSErrTypeCommon::UnexpectedExceptionExImpl ex2(__FILE__, __LINE__, 
							    "ErrorComponent::errorTrace");
	    throw ex2.getUnexpectedExceptionEx();
	    }
	}
    /*
     * We should get here only if depth <= 0,
     * I.e. if there is not exception to throw.
     */
    return;
}
Example #14
0
//-----------------------------------------------------------------------------
void Consumer::removeSubscription(const char* type_name)
{
    ACS_TRACE("Consumer::removeSubscription");
    
    
    CosNotification::EventTypeSeq added(0);
    CosNotification::EventTypeSeq removed(1);
    added.length(0);
    removed.length(1);
    
    removed[0].domain_name = getChannelDomain();
    removed[0].type_name   = CORBA::string_dup(type_name);
    
    ACS_SHORT_LOG((LM_INFO, "Consumer::removeSubscription unsubscribing from '%s' events for the '%s' channel!",
		   static_cast<const char *>(added[0].type_name), channelName_mp));
    
    try
    {
    	consumerAdmin_m->subscription_change(added, removed);
    }
    catch(CORBA::SystemException &ex)
    {
    	ACSErrTypeCommon::CORBAProblemExImpl corbaProblemEx(__FILE__, __LINE__, "nc::Consumer::removeSubscription");
    	corbaProblemEx.setMinor(ex.minor());
    	corbaProblemEx.setCompletionStatus(ex.completed());
    	corbaProblemEx.setInfo(ex._info().c_str());
    	acsncErrType::RemoveSubscriptionProblemExImpl aspEx(corbaProblemEx, __FILE__,__LINE__,"nc::Consumer::removeSubscription");
    	aspEx.setEvent(static_cast<const char *>(added[0].type_name));
    	aspEx.setChannel(channelName_mp);
    	aspEx.log(LM_DEBUG);
    	throw aspEx;
    }
    catch(CORBA::Exception &ex)
    {
    	ACSErrTypeCommon::CORBAProblemExImpl corbaProblemEx(__FILE__, __LINE__, "nc::Consumer::removeSubscription");
    	corbaProblemEx.setInfo(ex._info().c_str());
    	acsncErrType::RemoveSubscriptionProblemExImpl aspEx(corbaProblemEx, __FILE__,__LINE__,"nc::Consumer::removeSubscription");
    	aspEx.setEvent(static_cast<const char *>(added[0].type_name));
    	aspEx.setChannel(channelName_mp);
    	aspEx.log(LM_DEBUG);
    	throw aspEx;
    }
    catch(...)
    {
    	ACSErrTypeCommon::UnknownExImpl unEx(__FILE__, __LINE__, "nc::Consumer::removeSubscription");
    	acsncErrType::RemoveSubscriptionProblemExImpl aspEx(unEx, __FILE__,__LINE__,"nc::Consumer::removeSubscription");
    	aspEx.setEvent(static_cast<const char *>(added[0].type_name));
    	aspEx.setChannel(channelName_mp);
    	aspEx.log(LM_DEBUG);
    	throw aspEx;
    }
}//removeSubscription
void bdNTSenderImplTest::paceData ()
{
	ACS_TRACE("bdNTSenderImplTest::paceData");
	unsigned char *data= new unsigned char[65000];
	for (unsigned int i=0; i<65000; i++)
		data[i]=i;
	getSenderStream("TestStream")->getFlow("FullResolutionDataFlow")->sendData(data, 65000);

	for (unsigned int i=0; i<65000; i++)
		data[i]=i%10;
	getSenderStream("TestStream")->getFlow("ChannelAverageDataFlow")->sendData(data, 65000);

}
/* ----------------------------------------------------------------*/
ACSErr::Completion *ErrorComponent::completionFromException(CORBA::Short depth) 
{
    ACS_TRACE("::ErrorComponent::completionFromException");
    // here we get LOCAL (C++) completion 
    CompletionImpl *er = createCompletion(depth);

    // returnCompletion() automatically deletes er
    //   NOTE: you can use returnCompletion() 
    //   just if completion is allocated on the heap. 
    //   If completion is allocated on the stack
    //   returnCompletion(false) has to be used. 
    return er->returnCompletion();
}//completionFromException
Example #17
0
void BACIMonitor::setTriggerOnValuePercent(bool enable)
{
  ACS_TRACE("baci::BACIMonitor::setTriggerOnValuePercent");
  if (triggerOnValuePercent_m!=enable) {
    triggerOnValuePercent_m=enable;
    if((triggerOnValue_m == true || triggerOnValuePercent_m == true) && triggerTime_m > 0)
      deltaValueAndTimerInteraction_m = true;
    else
      deltaValueAndTimerInteraction_m = false;
    monitorStateChanged();
    property_mp->updateMonitorStates();
  }
}
Example #18
0
//-----------------------------------------------------------------------------
Consumer::Consumer(const char* channelName, const char* acsNCDomainName) :
    Helper(channelName,acsNCDomainName),
    consumerAdmin_m(0),
    proxySupplier_m(0),
    numEvents_m(0),
    reference_m(0),
    profiler_mp(0),
    antennaName(""),
    orb_mp(0)
{
    ACS_TRACE("Consumer::Consumer");
    orb_mp = static_cast<CORBA::ORB_ptr>(0);
}
Example #19
0
void BACIMonitor::setTriggerValuePercent(const BACIValue& _triggerValuePercent) 
{
	//TODO
	ACS_TRACE("baci::BACIMonitor::setTriggerValuePercent");
	if ((_triggerValuePercent==triggerValuePercent_m)==false) {
		if (_triggerValuePercent < minTriggerValue_m) {
			triggerValue_m = minTriggerValue_m; 
		} else {
			triggerValuePercent_m=_triggerValuePercent;
		}
		monitorStateChanged();
	}
}
    TestACSThreadWithParameter(const ACE_CString& name,
			       char  *parmMsg,
			       const ACS::TimeInterval& responseTime,
			       const ACS::TimeInterval& sleepTime,
			       bool del,
			       const long thrFlags,
			       const size_t stackSize) :
	ACS::Thread(name, responseTime, sleepTime, del, thrFlags, stackSize)
	{
	    ACS_TRACE("TestACSThreadWithParameter::TestACSThreadWithParameter");
	    msg = parmMsg;
	    ACS_LOG(LM_SOURCE_INFO, "TestACSThreadWithParameter::TestACSThreadWithParameter",
		    (LM_INFO, "Thread parameter: %s", parmMsg));
	}
int
BulkDataReceiverCbDistr1::cbReceive(ACE_Message_Block * frame_p)
{
    ACS_TRACE("BulkDataReceiverCbDistr1::cbReceive"); 

    if(flowNumber_m == 1)
	{
        ACS_SHORT_LOG((LM_DEBUG, "RECEIVER 1 flowname 1: %s", flowname_m.c_str()));
        ACS_SHORT_LOG((LM_DEBUG, "RECEIVER 1 length data flowname 1: %d", frame_p->length()));
	count1_m += frame_p->length();
	}

    return 0;
}
Example #22
0
void BACIComponent::removeAction(int callbackID)
{
  ACS_TRACE("baci::BACIComponent::removeAction");
  ThreadSyncGuard guard(&actionQueueMutex_m);

  BACIActionQueue::iterator i = find_if(actionQueue_m.begin(), actionQueue_m.end(),
					IsActionEqual(callbackID));
  if (i!=actionQueue_m.end())
    {
      BACIAction* action = (BACIAction*)(*i);
      actionQueue_m.erase(i);
      delete action;
    }
}
Example #23
0
//-----------------------------------------------------------------------------
Helper::Helper(const char* channelName, const char* notifyServiceDomainName):
    namingContext_m(CosNaming::NamingContext::_nil()),
    notifyChannel_m(CosNotifyChannelAdmin::EventChannel::_nil()),
    channelName_mp(0),
    acsNCDomainName_mp(0),
    notificationServiceName_mp(0),
    orbHelper_mp(0),
    notifyFactory_m(0),
    notifyFactoryOld_m(0),
    channelID_m(0),
    okToLog_m(false)
{
    ACS_TRACE("Helper::Helper");
    //make a copy of the channel's name
    channelName_mp = CORBA::string_dup(channelName);
    // make a copy of the NS domain name (if given)
    if (notifyServiceDomainName)
    {
        acsNCDomainName_mp = CORBA::string_dup(notifyServiceDomainName);
    }
    else
    {
        acsNCDomainName_mp = CORBA::string_dup(acscommon::NAMESERVICE_BINDING_NC_DOMAIN_DEFAULT);
    }
    channelAndDomainName_m = BaseHelper::combineChannelAndDomainName(channelName_mp,acsNCDomainName_mp);

    //this is common to both suppliers and consumers, but what does it really
    //do?
    ifgop_m = CosNotifyChannelAdmin::AND_OP;

    //if this doesn't work
    if((BACI_CORBA::getInstance()==0) && (BACI_CORBA::InitCORBA(0, 0) == false))
	{
	ACS_SHORT_LOG((LM_ERROR,"Helper::Helper(%s,%s) unable to gain access to BACI_CORBA!",
		       channelName_mp,acsNCDomainName_mp));
	CORBAProblemExImpl err = CORBAProblemExImpl(__FILE__,__LINE__,"nc::Helper::Helper");
	throw err.getCORBAProblemEx();
	}

    //check the CDB to see if we use integration logs
    if(nc::CDBProperties::getIntegrationLogs(channelName_mp)==false)
	    {
	    okToLog_m = false;
	    }
	else
	    {
	    okToLog_m = true;
	    }
    callback_m = new ReconnectionCallback(this);
}
int
BulkDataReceiverCbDistr1::cbStart(ACE_Message_Block * userParam_p)
{
    ACS_TRACE("BulkDataReceiverCbDistr1::cbStart"); 

    if(flowNumber_m == 1)
	{
	ACS_SHORT_LOG((LM_INFO, "RECEIVER 1 flowname 1: %s", flowname_m.c_str()));
	ACS_SHORT_LOG((LM_INFO, "RECEIVER 1 length param flowname 1: %d", userParam_p->length()));

	count1_m = 0;
	}

    return 0;
}
Example #25
0
//-----------------------------------------------------------------------------
Supplier::Supplier(const char* channelName, 
	            CORBA::ORB_ptr orb_mp,
	            acscomponent::ACSComponentImpl* component,
	            const char* acsNCDomainName) :
    Helper(channelName, acsNCDomainName),
    SupplierAdmin_m(CosNotifyChannelAdmin::SupplierAdmin::_nil()),
    proxyConsumer_m(CosNotifyChannelAdmin::StructuredProxyPushConsumer::_nil()),
    reference_m(0),
    component_mp(component),
    typeName_mp(0),
    count_m(0),
    guardbl(10000000,50)
{
    ACS_TRACE("Supplier::Supplier");
    init(orb_mp);
}
Example #26
0
CORBA::Double Lx200EMCVelDevIO::read(ACS::Time &timestamp) throw (ACSErr::ACSbaseExImpl)
{
	char *_METHOD_=(char *)"Lx200EMCVelDevIO::read";
	if(this->axis == ALTITUDE_AXIS)
		if( this->slewRateElevation )
	      return ( (this->reversed) ? this->slewRateElevation*(-1) : this->slewRateElevation);
		else
			return 0.0;
   else
		if( this->slewRateAzimuth )
	      return ( (this->reversed) ? this->slewRateAzimuth*(-1) : this->slewRateAzimuth);
		else
			return 0.0;
	ACS_TRACE(_METHOD_);

}
Example #27
0
void SimpleExampleNCImpl::sendMessage() throw (::CORBA::SystemException)
{
    ACS_TRACE("SimpleExampleNCImpl::sendMessage");
    nc::SimpleSupplier *sup_p = 0;
    sup_p = new nc::SimpleSupplier(DDS_SIMPLE_EXAMPLE::CHANNEL_NAME, this);

    DDS_SIMPLE_EXAMPLE::simpleMessage m;
    m.seqnum=1;

    sup_p->publishData<DDS_SIMPLE_EXAMPLE::simpleMessage>(m);

    sleep(1);
    sup_p->disconnect();
    sup_p=0;

}
Example #28
0
void BACIMonitor::setTriggerValue(const BACIValue& _triggerValue) 
{
  ACS_TRACE("baci::BACIMonitor::setTriggerValue");
  if ((_triggerValue==triggerValue_m)==false) 
    {
      if (_triggerValue < minTriggerValue_m)
	  {
	  triggerValue_m = minTriggerValue_m; 
	  }
      else 
	  {
	  triggerValue_m=_triggerValue;
	  }
      monitorStateChanged();
    }
}
Example #29
0
bool BACIComponent::startAllThreads()
{
  ACS_TRACE("baci::BACIComponent::startAllThreads");

  if (!threadManager_mp)
    return false;

  // action thread
  if (actionThread_mp == BACIThread::NullBACIThread)
      {
      actionThread_mp=threadManager_mp->create(name_m+"::actionThread",
					       (void*)actionThreadWorker, (void*)this,
					       getRTResponseTime(), getRTSleepTime(),
					       THR_NEW_LWP | THR_DETACHED,
					       actionThreadStackSize_m);
      }
  if (actionThread_mp == BACIThread::NullBACIThread)
    {
      return false;
    }
  else
    {
      actionThread_mp->resume();
    }

  // monitor thread
  if (monitorThread_mp == BACIThread::NullBACIThread)
      {
      monitorThread_mp=threadManager_mp->create(name_m+"::monitorThread",
						(void*)monitorThreadWorker, (void*)this,
						getMTResponseTime(), getMTSleepTime(),
						THR_NEW_LWP | THR_DETACHED,
						monitoringThreadStackSize_m);
      }
  if (monitorThread_mp == BACIThread::NullBACIThread)
    {
      delete actionThread_mp;
      actionThread_mp = BACIThread::NullBACIThread;
      return false;
    }
  else
    {
      monitorThread_mp->resume();
    }

  return true;
}//startAllThreads
CompletionImpl *ErrorComponent::createCompletion(unsigned short depth)
{
   ACS_TRACE("::ErrorComponent::createCompletion");
   CompletionImpl *er;

    if( depth <= 0 )
	{
	er = new ACSErrTypeOK::ACSErrOKCompletion();
	}
    else
	{
	try
	    {
	    buildErrorTrace(depth-1);
            ACSErrTypeCommon::GenericErrorCompletion *erg =
                new ACSErrTypeCommon::GenericErrorCompletion(
                                                     __FILE__, __LINE__,
                                                     "ErrorComponent::createCompletion");
            erg->setErrorDesc("Building a Completion with an errorTrace");
            er = erg;
	    }
	catch(ACSErrTypeCommon::GenericErrorExImpl &ex)
	    {
	    // Here we build a completion from an exception: 
	    // we create a new completion where it is added the error trace from an exception.
	    ACSErrTypeCommon::GenericErrorCompletion *erg = 
		new ACSErrTypeCommon::GenericErrorCompletion(ex, 
						     __FILE__, __LINE__, 
						     "ErrorComponent::createCompletion");
	    erg->setErrorDesc("Building a Completion with a previous errorTrace");
	    er = erg;
	    }
	catch(...)
	    {
	    ACSErrTypeCommon::UnexpectedExceptionCompletion *erg = 
		new ACSErrTypeCommon::UnexpectedExceptionCompletion( 
						     __FILE__, __LINE__, 
						     "ErrorComponent::returncompletion");
	    er=erg;
	    }
	}  
    
    // we are in local case so caller has to do the memory managment 
    // i.e. release the memory of CompletionImpl !
    return er;
}//createCompletion