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

StrictPolicyDelegateImpl.hh

Go to the documentation of this file.
00001 /*
00002  * StrictPolicyDelegateImpl.hh
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 StrictPolicyDelegateImpl.hh
00014  *
00015  * Header file for the StrictPolicyDelegateImpl class.
00016  */
00017 
00018 #ifndef _strict_policy_delegate_impl_hh
00019 #define _strict_policy_delegate_impl_hh
00020 
00021 #include "DelegateS.h"
00022 #include "DelegateMixin.hh"
00023 
00024 /**
00025  * Base class for objects that wish to act as a delegate of a
00026  * BrokerPolicies::StrictPolicy object.
00027  *
00028  * @param T The main object type.
00029  * @param T_var The object's _var type.
00030  */
00031 class StrictPolicyDelegateImpl :
00032     public virtual DelegateMixin<BrokerPolicies::StrictPolicy,
00033                                  BrokerPolicies::StrictPolicy_var>,
00034     public virtual POA_BrokerDelegates::StrictPolicyDelegate
00035 {
00036 
00037 public:
00038 
00039     /**
00040      * Construct a StrictPolicyDelegateImpl object.
00041      */
00042     StrictPolicyDelegateImpl(void)
00043     {
00044     };
00045 
00046     /**
00047      * Deconstruct a StrictPolicyDelegateImpl object.
00048      */
00049     virtual ~StrictPolicyDelegateImpl(void)
00050     {
00051     };
00052 
00053     /** @copydoc Broker::Policy::Name */
00054     virtual char *Name(void)
00055         throw (CORBA::SystemException)
00056     {
00057         if( CORBA::is_nil(this->dm_RemoteObject.in()) )
00058         {
00059             throw CORBA::BAD_INV_ORDER();
00060         }
00061         return this->dm_RemoteObject->Name();
00062     };
00063     
00064     /** @copydoc Broker::Policy::AddTask */
00065     virtual void AddTask(Broker::Task_ptr new_task,
00066                          const Broker::ScheduleParameters &sp)
00067         throw (CORBA::SystemException,
00068                Broker::DuplicateScheduleParameter,
00069                Broker::InvalidScheduleParameter,
00070                Broker::MissingScheduleParameter)
00071     {
00072         if( CORBA::is_nil(this->dm_RemoteObject.in()) )
00073         {
00074             throw CORBA::BAD_INV_ORDER();
00075         }
00076         this->dm_RemoteObject->AddTask(new_task, sp);
00077     };
00078     
00079     /** @copydoc Broker::Policy::RemoveTask */
00080     virtual void RemoveTask(Broker::Task_ptr added_task)
00081         throw (CORBA::SystemException)
00082     {
00083         if( CORBA::is_nil(this->dm_RemoteObject.in()) )
00084         {
00085             throw CORBA::BAD_INV_ORDER();
00086         }
00087         this->dm_RemoteObject->RemoveTask(added_task);
00088     };
00089     
00090     /** @copydoc Broker::Policy::Activate */
00091     virtual void Activate(const Broker::TaskList &tasks)
00092         throw (CORBA::SystemException)
00093     {
00094         if( CORBA::is_nil(this->dm_RemoteObject.in()) )
00095         {
00096             throw CORBA::BAD_INV_ORDER();
00097         }
00098         this->dm_RemoteObject->Activate(tasks);
00099     };
00100     
00101     /** @copydoc Broker::Policy::Deactivate */
00102     virtual void Deactivate(void)
00103         throw (CORBA::SystemException)
00104     {
00105         if( CORBA::is_nil(this->dm_RemoteObject.in()) )
00106         {
00107             throw CORBA::BAD_INV_ORDER();
00108         }
00109         this->dm_RemoteObject->Deactivate();
00110     };
00111     
00112     /** @copydoc Broker::Policy::ChangeTaskCPU */
00113     virtual Broker::CPUReserve ChangeTaskCPU(Broker::RealTimeTask_ptr task,
00114                                              const Broker::CPUReserve &advice)
00115         throw (CORBA::SystemException, Broker::InvalidState)
00116     {
00117         if( CORBA::is_nil(this->dm_RemoteObject.in()) )
00118         {
00119             throw CORBA::BAD_INV_ORDER();
00120         }
00121         return this->dm_RemoteObject->ChangeTaskCPU(task, advice);
00122     };
00123 
00124     /** @copydoc Broker::Policy::GetMaxCPUAllocation */
00125     virtual CORBA::Float GetMaxCPUAllocation(void)
00126         throw (CORBA::SystemException)
00127     {
00128         if( CORBA::is_nil(this->dm_RemoteObject.in()) )
00129         {
00130             throw CORBA::BAD_INV_ORDER();
00131         }
00132         return this->dm_RemoteObject->GetMaxCPUAllocation();
00133     };
00134     
00135     /** @copydoc Broker::Policy::SetMaxCPUAllocation */
00136     virtual void SetMaxCPUAllocation(CORBA::Float amount)
00137         throw (CORBA::SystemException)
00138     {
00139         if( CORBA::is_nil(this->dm_RemoteObject.in()) )
00140         {
00141             throw CORBA::BAD_INV_ORDER();
00142         }
00143         this->dm_RemoteObject->SetMaxCPUAllocation(amount);
00144     };
00145 
00146     /** @copydoc Broker::Policy::GetTaskList */
00147     virtual Broker::TaskList *GetTaskList(void)
00148         throw (CORBA::SystemException)
00149     {
00150         if( CORBA::is_nil(this->dm_RemoteObject.in()) )
00151         {
00152             throw CORBA::BAD_INV_ORDER();
00153         }
00154         return this->dm_RemoteObject->GetTaskList();
00155     };
00156 
00157     /** @copydoc BrokerPolicies::StrictPolicy::SetTaskPriority */
00158     virtual void SetTaskPriority(Broker::Task_ptr task, CORBA::Short priority)
00159         throw (CORBA::SystemException)
00160     {
00161         if( CORBA::is_nil(this->dm_RemoteObject.in()) )
00162         {
00163             throw CORBA::BAD_INV_ORDER();
00164         }
00165         this->dm_RemoteObject->SetTaskPriority(task, priority);
00166     };
00167 
00168     /** @copydoc BrokerPolicies::StrictPolicy::GetTaskPriority */
00169     virtual CORBA::Short GetTaskPriority(Broker::Task_ptr task)
00170         throw (CORBA::SystemException)
00171     {
00172         if( CORBA::is_nil(this->dm_RemoteObject.in()) )
00173         {
00174             throw CORBA::BAD_INV_ORDER();
00175         }
00176         return this->dm_RemoteObject->GetTaskPriority(task);
00177     };
00178 
00179 };
00180 
00181 #endif

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