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

AllupImpl.cc

Go to the documentation of this file.
00001 /*
00002  * AllupImpl.cc
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 AllupImpl.cc
00014  *
00015  * Implementation file for the AllupImpl class.
00016  */
00017 
00018 #include "config.h"
00019 
00020 #include <sys/types.h>
00021 #include <signal.h>
00022 
00023 #include <assert_pp.h>
00024 
00025 #include "AllupImpl.hh"
00026 
00027 #include "FactoryLibrary_ltdl.hh"
00028 
00029 AllupImpl::AllupImpl(void)
00030 {
00031 }
00032 
00033 AllupImpl::~AllupImpl(void)
00034 {
00035 }
00036 
00037 edu::utah::pces::FactoryLibrary_ptr AllupImpl::OpenLibrary(const char *name)
00038     throw (edu::utah::pces::NoSuchLibrary,
00039            CORBA::SystemException)
00040 {
00041     edu::utah::pces::FactoryLibrary_var retval;
00042 
00043     /* Check the input and */
00044     if( name == NULL )
00045     {
00046         throw CORBA::BAD_PARAM();
00047     }
00048 
00049     /* Try opening the library and */
00050     retval = FactoryLibrary_ltdl::OpenLibrary(name);
00051     
00052     /* ... then add it to the map, if it is not already there. */
00053     if( this->ai_Libraries.count(name) == 0 )
00054     {
00055         this->ai_Libraries[name] = edu::utah::pces::FactoryLibrary::
00056             _duplicate(retval);
00057     }
00058     
00059     return( retval._retn() );
00060 }
00061 
00062 edu::utah::pces::FactoryLibraryList *AllupImpl::Libraries(void)
00063     throw (CORBA::SystemException)
00064 {
00065     edu::utah::pces::FactoryLibraryList_var retval;
00066     library_map_t::const_iterator pos;
00067     size_t list_size;
00068     int lpc;
00069 
00070     list_size = this->ai_Libraries.size();
00071     /* Create a sequence large enough to hold all the opened libraries and */
00072     retval = new edu::utah::pces::FactoryLibraryList(list_size);
00073     retval->length(list_size);
00074     /* ... then fill it in. */
00075     for( pos = this->ai_Libraries.begin(), lpc = 0;
00076          pos != this->ai_Libraries.end();
00077          pos++, lpc++ )
00078     {
00079         retval[lpc] = edu::utah::pces::FactoryLibrary::
00080             _duplicate(pos->second.in());
00081     }
00082     return( retval._retn() );
00083 }
00084 
00085 void AllupImpl::Shutdown(void)
00086     throw (CORBA::SystemException)
00087 {
00088     /* XXX Not sure if kill is the best way to do this... */
00089     kill(0, SIGTERM);
00090 }

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