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::SetDelegateAttribute(const char *name,
00038 const CORBA::Any &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 quo::ValueSC_ptr scp;
00050
00051 if( value >>= scp )
00052 {
00053 this->eta_Status = quo::ValueSC::_duplicate(scp);
00054 }
00055 else
00056 {
00057 throw CORBA::BAD_PARAM();
00058 }
00059 }
00060 else if( (strcasecmp(name, "advice-sc") == 0) ||
00061 (strcasecmp(name, "advice_sc") == 0) ||
00062 (strcasecmp(name, "advice sc") == 0) )
00063 {
00064 quo::ValueSC_ptr scp;
00065
00066 if( value >>= scp )
00067 {
00068 this->eta_Advice = quo::ValueSC::_duplicate(scp);
00069 }
00070 else
00071 {
00072 throw CORBA::BAD_PARAM();
00073 }
00074 }
00075 else
00076 {
00077 this->RealTimeTaskDelegateImpl::SetDelegateAttribute(name, value);
00078 }
00079 }
00080
00081 CORBA::Any_ptr QuoAdvocate::GetDelegateAttribute(const char *name)
00082 throw (CORBA::SystemException)
00083 {
00084 CORBA::Any_var retval;
00085
00086 if( name == NULL )
00087 {
00088 throw CORBA::BAD_PARAM();
00089 }
00090 else if( (strcasecmp(name, "status-sc") == 0) ||
00091 (strcasecmp(name, "status_sc") == 0) ||
00092 (strcasecmp(name, "status sc") == 0) )
00093 {
00094 retval = new CORBA::Any();
00095 (*retval) <<= this->eta_Status;
00096 }
00097 else if( (strcasecmp(name, "advice-sc") == 0) ||
00098 (strcasecmp(name, "advice_sc") == 0) ||
00099 (strcasecmp(name, "advice sc") == 0) )
00100 {
00101 retval = new CORBA::Any();
00102 (*retval) <<= this->eta_Advice;
00103 }
00104 else
00105 {
00106 retval = this->RealTimeTaskDelegateImpl::GetDelegateAttribute(name);
00107 }
00108 return( retval._retn() );
00109 }
00110
00111 void QuoAdvocate::ReportCPU(Broker::RealTimeTask_ptr rtt,
00112 CORBA::ULong status,
00113 CORBA::ULong advice)
00114 throw (CORBA::SystemException)
00115 {
00116 if( CORBA::is_nil(this->dm_RemoteObject) )
00117 {
00118 throw CORBA::BAD_INV_ORDER();
00119 }
00120
00121 if( !CORBA::is_nil(this->eta_Status.in()) )
00122 {
00123 this->eta_Status->longValue(status);
00124 }
00125 if( !CORBA::is_nil(this->eta_Advice.in()) )
00126 {
00127 this->eta_Advice->longValue(advice);
00128 }
00129 this->RealTimeTaskDelegateImpl::ReportCPU(rtt, status, advice);
00130 }