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

PartitionPolicyImpl.hh

Go to the documentation of this file.
00001 /*
00002  * PartitionPolicyImpl.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 PartitionPolicyImpl.hh
00014  *
00015  * Header file for the PartitionPolicyImpl class.
00016  */
00017 
00018 #ifndef _partition_policy_impl_hh
00019 #define _partition_policy_impl_hh
00020 
00021 #include "BrokerC.h"
00022 #include "BrokerS.h"
00023 
00024 #include "StrictPolicyS.h"
00025 
00026 #include "listNode.h"
00027 
00028 /**
00029  * An implementation of the PartitionPolicy interface.
00030  */
00031 class PartitionPolicyImpl : public virtual POA_BrokerPolicies::PartitionPolicy
00032 {
00033 
00034 public:
00035 
00036     /**
00037      * Construct a PartitionPolicyImpl object with the given values.
00038      *
00039      * @param name The name of this object as registered with the
00040      * NamingService.
00041      */
00042     PartitionPolicyImpl(const char *name);
00043 
00044     /**
00045      * Deconstruct the policy.
00046      */
00047     virtual ~PartitionPolicyImpl(void);
00048 
00049     /** @copydoc Broker::Policy::Name */
00050     virtual char *Name(void)
00051         throw (CORBA::SystemException);
00052     
00053     /** @copydoc Broker::Policy::AddTask */
00054     virtual void AddTask(Broker::Task_ptr new_task,
00055                          const Broker::ScheduleParameters &sp)
00056         throw (CORBA::SystemException,
00057                Broker::DuplicateScheduleParameter,
00058                Broker::InvalidScheduleParameter,
00059                Broker::MissingScheduleParameter);
00060     /** @copydoc Broker::Policy::RemoveTask */
00061     virtual void RemoveTask(Broker::Task_ptr added_task)
00062         throw (CORBA::SystemException);
00063     
00064     /** @copydoc Broker::Policy::GetTaskList */
00065     virtual Broker::TaskList *GetTaskList(void)
00066         throw (CORBA::SystemException);
00067 
00068     /** @copydoc Broker::Policy::Activate */
00069     virtual void Activate(const Broker::TaskList &tasks)
00070         throw (CORBA::SystemException);
00071     /** @copydoc Broker::Policy::Deactivate */
00072     virtual void Deactivate(void)
00073         throw (CORBA::SystemException);
00074     
00075     /** @copydoc Broker::Policy::ChangeTaskCPU */
00076     virtual Broker::CPUReserve ChangeTaskCPU(Broker::RealTimeTask_ptr task,
00077                                              const Broker::CPUReserve &advice)
00078         throw (CORBA::SystemException, Broker::InvalidState);
00079 
00080     /** @copydoc Broker::Policy::GetMaxCPUAllocation */
00081     virtual CORBA::Float GetMaxCPUAllocation(void)
00082         throw (CORBA::SystemException);
00083     /** @copydoc Broker::Policy::SetMaxCPUAllocation */
00084     virtual void SetMaxCPUAllocation(CORBA::Float amount)
00085         throw (CORBA::SystemException);
00086 
00087     /** @copydoc BrokerPolicies::PartitionPolicy::DefaultPolicy */
00088     virtual void DefaultPolicy(Broker::Policy_ptr policy)
00089         throw (CORBA::SystemException);
00090 
00091     /** @copydoc BrokerPolicies::PartitionPolicy::DefaultPolicy */
00092     virtual Broker::Policy_ptr DefaultPolicy(void)
00093         throw (CORBA::SystemException);
00094 
00095     /** @copydoc BrokerPolicies::PartitionPolicy::SetTaskPolicy */
00096     virtual void SetTaskPolicy(Broker::Task_ptr task,
00097                                Broker::Policy_ptr bp)
00098         throw (CORBA::SystemException);
00099 
00100     /** @copydoc BrokerPolicies::PartitionPolicy::GetTaskPolicy */
00101     virtual Broker::Policy_ptr GetTaskPolicy(Broker::Task_ptr task)
00102         throw (CORBA::SystemException);
00103 
00104 private:
00105 
00106     /**
00107      * List node used to track tasks that this policy is managing.
00108      */
00109     struct TaskData {
00110         struct lnMinNode td_Link;
00111         Broker::RealTimeTask_var td_Task;
00112         Broker::ScheduleParameters_var td_ScheduleParameters;
00113         Broker::Policy_var td_Policy;
00114     };
00115 
00116     /**
00117      * Repair the task list by removing any dead/unreachable objects.
00118      */
00119     void RepairTaskList(void);
00120 
00121     /**
00122      * Find the TaskData node that corresponds to the given task.
00123      *
00124      * @param task The Broker::RealTimeTask object to look up.
00125      * @return The TaskData list node that has the given task object.
00126      * @exception Broker::Internal If no TaskData node exists for the given
00127      *            task.
00128      */
00129     struct TaskData *FindTaskData(Broker::RealTimeTask_ptr task);
00130     
00131     /** The maximum percentage of CPU time that we are allowed to allocate. */
00132     float pp_MaxUsedCPU;
00133 
00134     /** The name of this object as registered with the NamingService. */
00135     CORBA::String_var pp_Name;
00136 
00137     /** The default subpolicy to use for newly added tasks. */
00138     Broker::Policy_var pp_DefaultPolicy;
00139 
00140     /** A list of TaskData objects */
00141     struct lnMinList pp_List;
00142     
00143 };
00144 
00145 #endif

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