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

FactoryLibrary_ltdl.hh

Go to the documentation of this file.
00001 /*
00002  * FactoryLibrary_ltdl.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 FactoryLibrary_ltdl.hh
00014  *
00015  * Header file for the FactoryLibrary_ltdl class.
00016  */
00017 
00018 #ifndef _factory_library_impl_hh
00019 #define _factory_library_impl_hh
00020 
00021 #include <map.h>
00022 #include <string>
00023 
00024 #include "AllupS.h"
00025 
00026 #include "HeyParser.hh"
00027 
00028 #include "factory_library.h"
00029 #include "ltdl.h"
00030 
00031 /**
00032  * An edu::utah::pces::FactoryLibrary implementation that uses libltdl.
00033  *
00034  * @sa AllupImpl
00035  * @sa libtool
00036  */
00037 class FactoryLibrary_ltdl : public virtual POA_edu::utah::pces::FactoryLibrary
00038 {
00039 
00040 public:
00041 
00042     /**
00043      * Open a library with the given name.
00044      *
00045      * @param name The name of the library.
00046      * @return A CORBA object reference to this object.
00047      *
00048      * @exception edu::utah::pces::NoSuchLibrary if the library could not be
00049      * found or loaded.
00050      */
00051     static edu::utah::pces::FactoryLibrary_ptr OpenLibrary(const char *name)
00052         throw (edu::utah::pces::NoSuchLibrary,
00053                CORBA::SystemException);
00054     
00055     /**
00056      * Deconstruct a FactoryLibrary_ltdl object.
00057      */
00058     virtual ~FactoryLibrary_ltdl(void);
00059 
00060     /** @copydoc edu::utah::pces::FactoryLibrary::Name */
00061     virtual char *Name(void)
00062         throw (CORBA::SystemException);
00063 
00064     /** @copydoc edu::utah::pces::FactoryLibrary::Hey */
00065     virtual CORBA::Long Hey(const edu::utah::pces::ArgV &args,
00066                             CORBA::String_out o,
00067                             CORBA::String_out e)
00068         throw (CORBA::SystemException);
00069 
00070 private:
00071 
00072     /**
00073      * Map of library names to FactoryLibrary_ltdl objects.
00074      */
00075     static map<string, FactoryLibrary_ltdl *> open_libraries;
00076 
00077     /**
00078      * Cached reference to the ORB object.
00079      */
00080     static CORBA::ORB_var orb;
00081 
00082     /**
00083      * Construct a FactoryLibrary_ltdl object with the given values.
00084      *
00085      * @param name The name of the library.
00086      * @param library The libtool handle on the library.
00087      * @param fm The reference to the library's factory_method_t function.
00088      */
00089     FactoryLibrary_ltdl(const char *name,
00090                         lt_dlhandle library,
00091                         factory_method_t fm);
00092 
00093     /**
00094      * The name of the library being managed by this object.
00095      */
00096     CORBA::String_var fl_Name;
00097 
00098     /**
00099      * The number of times this library has been opened.
00100      */
00101     unsigned int fl_OpenCount;
00102 
00103     /**
00104      * Libtool handle on the shared library.
00105      */
00106     lt_dlhandle fl_Library;
00107 
00108     /**
00109      * Cached reference to the factory_method_t in the shared library.
00110      */
00111     factory_method_t fl_Method;
00112     
00113 };
00114 
00115 #endif

Generated on Mon Dec 1 16:29:06 2003 for CPU Broker by doxygen 1.3.4