00001 /* 00002 * TaskFactory_T.hh 00003 * 00004 * Copyright (c) 2003 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 TaskFactory_T.hh 00014 * 00015 * Header file that provides a template for creating task factories. 00016 */ 00017 00018 #ifndef _task_factory_t_hh 00019 #define _task_factory_t_hh 00020 00021 #include "BrokerC.h" 00022 #include "BrokerS.h" 00023 00024 /** 00025 * Template for task factories that just construct a task with the 00026 * Broker::TaskParameters passed to Broker::TaskFactory::CreateTask. 00027 */ 00028 template <class T> class TaskFactoryTemplate : 00029 public POA_Broker::TaskFactory 00030 { 00031 00032 public: 00033 00034 /** 00035 * Empty constructor. 00036 */ 00037 TaskFactoryTemplate(const char *name) 00038 { 00039 }; 00040 00041 /** 00042 * Empty destructor. 00043 */ 00044 virtual ~TaskFactoryTemplate() 00045 { 00046 }; 00047 00048 /** @copydoc Broker::TaskFactory::CreateTask */ 00049 Broker::Task_ptr CreateTask(const Broker::TaskParameters &tp) 00050 throw (CORBA::SystemException, 00051 Broker::DuplicateTaskParameter, 00052 Broker::InvalidTaskParameter, 00053 Broker::MissingTaskParameter) 00054 { 00055 T *retval; 00056 00057 retval = new T(tp); 00058 return( retval->_this() ); 00059 } 00060 00061 }; 00062 00063 #endif