00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
00044 if( name == NULL )
00045 {
00046 throw CORBA::BAD_PARAM();
00047 }
00048
00049
00050 retval = FactoryLibrary_ltdl::OpenLibrary(name);
00051
00052
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
00072 retval = new edu::utah::pces::FactoryLibraryList(list_size);
00073 retval->length(list_size);
00074
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
00089 kill(0, SIGTERM);
00090 }