00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "config.h"
00019
00020 #include <string.h>
00021 #include <sys/time.h>
00022
00023 #include <iostream>
00024 #include <fstream>
00025 #include <iomanip>
00026
00027 #include "QuoAdvocate.hh"
00028
00029 QuoAdvocate::QuoAdvocate(void)
00030 {
00031 }
00032
00033 QuoAdvocate::~QuoAdvocate()
00034 {
00035 }
00036
00037 void QuoAdvocate::SetDelegateAttributeObject(const char *name,
00038 const CORBA::Object_ptr value)
00039 throw (CORBA::SystemException)
00040 {
00041 if( name == NULL )
00042 {
00043 throw CORBA::BAD_PARAM();
00044 }
00045 else if( (strcasecmp(name, "status-sc") == 0) ||
00046 (strcasecmp(name, "status_sc") == 0) ||
00047 (strcasecmp(name, "status sc") == 0) )
00048 {
00049 this->eta_Status = quo::ValueSC::
00050 _duplicate(quo::ValueSC::_narrow(value));
00051 }
00052 else if( (strcasecmp(name, "advice-sc") == 0) ||
00053 (strcasecmp(name, "advice_sc") == 0) ||
00054 (strcasecmp(name, "advice sc") == 0) )
00055 {
00056 this->eta_Advice = quo::ValueSC::
00057 _duplicate(quo::ValueSC::_narrow(value));
00058 }
00059 else
00060 {
00061 this->RealTimeTaskDelegateImpl::SetDelegateAttributeObject(name,
00062 value);
00063 }
00064 }
00065
00066 CORBA::Any_ptr QuoAdvocate::GetDelegateAttribute(const char *name)
00067 throw (CORBA::SystemException)
00068 {
00069 CORBA::Any_var retval;
00070
00071 if( name == NULL )
00072 {
00073 throw CORBA::BAD_PARAM();
00074 }
00075 else if( (strcasecmp(name, "status-sc") == 0) ||
00076 (strcasecmp(name, "status_sc") == 0) ||
00077 (strcasecmp(name, "status sc") == 0) )
00078 {
00079 retval = new CORBA::Any();
00080 (*retval) <<= this->eta_Status.in();
00081 }
00082 else if( (strcasecmp(name, "advice-sc") == 0) ||
00083 (strcasecmp(name, "advice_sc") == 0) ||
00084 (strcasecmp(name, "advice sc") == 0) )
00085 {
00086 retval = new CORBA::Any();
00087 (*retval) <<= this->eta_Advice.in();
00088 }
00089 else
00090 {
00091 retval = this->RealTimeTaskDelegateImpl::GetDelegateAttribute(name);
00092 }
00093 return( retval._retn() );
00094 }
00095
00096 Broker::CPUReserve QuoAdvocate::PassCPU(Broker::RealTimeTask_ptr rtt,
00097 const Broker::CPUReserve &status,
00098 const Broker::CPUReserve &advice,
00099 const Broker::KeyedReportParameters &krp)
00100 throw (CORBA::SystemException)
00101 {
00102 if( CORBA::is_nil(this->dm_RemoteObject.in()) )
00103 {
00104 throw CORBA::BAD_INV_ORDER();
00105 }
00106
00107 if( !CORBA::is_nil(this->eta_Status.in()) )
00108 {
00109 this->eta_Status->longValue(status.Compute);
00110 }
00111 if( !CORBA::is_nil(this->eta_Advice.in()) )
00112 {
00113 this->eta_Advice->longValue(advice.Compute);
00114 }
00115 return this->RealTimeTaskDelegateImpl::PassCPU(rtt, status, advice, krp);
00116 }