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

factory_library.h

Go to the documentation of this file.
00001 /*
00002  * factory_library.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 factory_library.h
00014  *
00015  * Header file that presents a common interface for shared libraries.  The
00016  * interface is basically a single function, flFactoryMethodV, that can perform
00017  * a variety of tasks for the caller.
00018  *
00019  * @see cbhey.cc
00020  * @see BrokerFactory.cc
00021  * @see PolicyFactory.cc
00022  * @see DelegateFactory.cc
00023  */
00024 
00025 #ifndef _factory_library_h
00026 #define _factory_library_h
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00032 #include <stdarg.h>
00033 
00034 /**
00035  * Sub-operations for the primary library function below.
00036  */
00037 typedef enum {
00038     FLO_MIN,    /**< The minimum legal value. */
00039     FLO_QUERY,  /**< Ask the library if it contains support for something. */
00040     FLO_HEY,    /**< Ask the library to handle a 'hey' request. */
00041     FLO_MAX     /**< The maximum legal value. */
00042 } factory_library_op_t;
00043 
00044 /**
00045  * Argument tags for the factory_method_t functions.
00046  */
00047 enum {
00048     FMA_TAG_DONE,       /**< () - Terminate the tag list. */
00049     FMA_ORB,            /**< (CORBA::ORB_ptr) - Pointer to an ORB. */
00050     FMA_POA,            /**< (PortableServer::POA_ptr) - Pointer to a POA. */
00051     FMA_HeyParser,      /**< (HeyParser *) - Pointer to an active HeyParser. */
00052     FMA_HeyServerHint,  /**< (const char *) - Hint for the type of server. */
00053     FMA_StandardOut,    /**< (ostream *) - Standard output stream. */
00054     FMA_StandardError,  /**< (ostream *) - Standard error stream. */
00055     FMA_USER_BASE = 0x1000,     /**< Base for user tags. */
00056 };
00057 
00058 /**
00059  * Function type for the primary library function interface.
00060  *
00061  * @param op The sub-operation to execute.
00062  * @param tag The first tag in the tag list.
00063  * @param args The remaining tags in the tag list.
00064  * @return Zero if the operation succeeded, an errno value otherwise.
00065  */
00066 typedef int (*factory_method_t)(factory_library_op_t op,
00067                                 int tag,
00068                                 va_list args);
00069 
00070 /**
00071  * The symbol name for the primary library function.
00072  */
00073 #define FACTORY_METHOD_SYMBOL flFactoryMethodV
00074 
00075 /**
00076  * The primary library function.  This function provides a generic interface
00077  * to the capabilities of a shared library.
00078  *
00079  * @param op The sub-operation to execute.
00080  * @param tag The first tag in the tag list.
00081  * @param args The remaining tags in the tag list.
00082  * @return Zero if the operation succeeded, an errno value otherwise.
00083  */
00084 int FACTORY_METHOD_SYMBOL(factory_library_op_t op,
00085                           int tag,
00086                           va_list args);
00087 
00088 /**
00089  * Wrapper function that calls a given factory_method_t with the arguments
00090  * given on the stack.
00091  *
00092  * @param fm The primary library function to pass the request to.
00093  * @param op The sub-operation to execute.
00094  * @param tag The first tag in the tag list.
00095  * @return Zero if the operation succeeded, an errno value otherwise.
00096  */
00097 int flFactoryMethod(factory_method_t fm,
00098                     factory_library_op_t op,
00099                     int tag,
00100                     ...);
00101 
00102 #ifdef __cplusplus
00103 }
00104 #endif
00105 
00106 #endif

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