Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

RealTimeTaskImpl.cc

Go to the documentation of this file.
00001 /*
00002  * RealTimeTaskImpl.cc
00003  *
00004  * Copyright (c) 2003, 2004 The University of Utah and the Flux Group.
00005  * All rights reserved.
00006  *
00007  * This file is licensed under the terms of the GNU Public License.  
00008  * See the file "license.terms" for restrictions on redistribution 
00009  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00010  */
00011 
00012 /**
00013  * @file RealTimeTaskImpl.cc
00014  *
00015  * Implementation of the RealTimeTaskImpl class.
00016  */
00017 
00018 #include "config.h"
00019 
00020 #include <string.h>
00021 
00022 #include <iostream>
00023 #include <fstream>
00024 #include <iomanip>
00025 
00026 #include <assert_pp.h>
00027 #include <time_util.h>
00028 #include <instrumentation.h>
00029 
00030 #include "RealTimeTaskImpl.hh"
00031 
00032 using namespace std;
00033 
00034 #if !defined(__XSTRING)
00035 /**
00036  * Convert a macro argument to a string.
00037  *
00038  * @param x The macro to expand to a string.
00039  */
00040 #define __XSTRING(x) __STRING(x)
00041 #endif
00042 
00043 RealTimeTaskImpl::RealTimeTaskImpl(const Broker::TaskParameters &tp)
00044     throw (CORBA::SystemException,
00045            Broker::DuplicateTaskParameter,
00046            Broker::InvalidTaskParameter,
00047            Broker::MissingTaskParameter)
00048 {
00049     unsigned int lpc;
00050 
00051     /* Process the arguments */
00052     for( lpc = 0; lpc < tp.length(); lpc++ )
00053     {
00054         if( strcasecmp(tp[lpc].name.in(), "name") == 0 )
00055         {
00056             const char *name;
00057 
00058             if( this->rtti_Name != NULL )
00059             {
00060                 throw Broker::DuplicateTaskParameter("name");
00061             }
00062             else if( tp[lpc].value >>= name )
00063             {
00064                 this->rtti_Name = name;
00065             }
00066             else
00067             {
00068                 throw Broker::InvalidTaskParameter("'name' not a string",
00069                                                    tp[lpc]);
00070             }
00071         }
00072     }
00073     
00074     /* Make sure we have everything we need. */
00075     if( this->rtti_Name == NULL )
00076     {
00077         throw Broker::MissingTaskParameter("name");
00078     }
00079 }
00080 
00081 RealTimeTaskImpl::~RealTimeTaskImpl()
00082 {
00083 }
00084 
00085 char *RealTimeTaskImpl::Name(void)
00086     throw (CORBA::SystemException)
00087 {
00088     CORBA::String_var retval;
00089 
00090     retval = this->rtti_Name;
00091     return( retval._retn() );
00092 }
00093 
00094 void RealTimeTaskImpl::SetManager(Broker::Manager_ptr manager)
00095     throw (CORBA::SystemException)
00096 {
00097     this->rtti_Manager = Broker::Manager::_duplicate(manager);
00098 }
00099 
00100 Broker::CPUReserve
00101 RealTimeTaskImpl::PassCPU(Broker::RealTimeTask_ptr rtt,
00102                           const Broker::CPUReserve &status,
00103                           const Broker::CPUReserve &advice,
00104                           const Broker::KeyedReportParameters &krp)
00105     throw (CORBA::SystemException)
00106 {
00107     if( CORBA::is_nil(this->rtti_Manager.in()) )
00108     {
00109         throw CORBA::BAD_INV_ORDER();
00110     }
00111     if( CORBA::is_nil(rtt) )
00112     {
00113         throw CORBA::BAD_PARAM();
00114     }
00115     
00116     return( this->rtti_Manager->ChangeTaskCPU(rtt, advice) );
00117 }

Generated on Fri Oct 22 07:50:24 2004 for CPU Broker by  doxygen 1.3.9.1