Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

CorbaService.h

Go to the documentation of this file.
00001 /***************** <Tweek heading BEGIN do not edit this line> ****************
00002  * Tweek
00003  *
00004  * -----------------------------------------------------------------
00005  * File:          $RCSfile: CorbaService.h,v $
00006  * Date modified: $Date: 2003/02/26 16:01:09 $
00007  * Version:       $Revision: 1.6 $
00008  * -----------------------------------------------------------------
00009  ***************** <Tweek heading END do not edit this line> *****************/
00010 
00011 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
00012  *
00013  * VR Juggler is (C) Copyright 1998-2003 by Iowa State University
00014  *
00015  * Original Authors:
00016  *   Allen Bierbaum, Christopher Just,
00017  *   Patrick Hartling, Kevin Meinert,
00018  *   Carolina Cruz-Neira, Albert Baker
00019  *
00020  * This library is free software; you can redistribute it and/or
00021  * modify it under the terms of the GNU Library General Public
00022  * License as published by the Free Software Foundation; either
00023  * version 2 of the License, or (at your option) any later version.
00024  *
00025  * This library is distributed in the hope that it will be useful,
00026  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00027  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00028  * Library General Public License for more details.
00029  *
00030  * You should have received a copy of the GNU Library General Public
00031  * License along with this library; if not, write to the
00032  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00033  * Boston, MA 02111-1307, USA.
00034  *
00035  *************** <auto-copyright.pl END do not edit this line> ***************/
00036 
00037 #ifndef _TWEEK_CORBA_SERVICE_H_
00038 #define _TWEEK_CORBA_SERVICE_H_
00039 
00040 #include <tweek/tweekConfig.h>
00041 
00042 #include <string>
00043 #include <list>
00044 #include TWEEK_INCLUDE_CORBA_H
00045 
00046 #include <vpr/vpr.h>
00047 #include <vpr/Thread/Thread.h>
00048 #include <tweek/CORBA/SubjectManager.h>
00049 
00050 
00051 namespace tweek
00052 {
00053 
00058 class CorbaService
00059 {
00060 public:
00076    CorbaService(const std::string& nsHost, vpr::Uint16 nsPort = 2809,
00077                 const std::string& iiopVersion = std::string("1.0"),
00078                 const std::string& subContextId = std::string(""));
00079 
00088    ~CorbaService()
00089    {
00090       shutdown();
00091 
00092       if ( mOrbThread != NULL )
00093       {
00094          delete mOrbThread;
00095          mOrbThread = NULL;
00096          delete mOrbFunctor;
00097          mOrbFunctor = NULL;
00098       }
00099    }
00100 
00101    vpr::ReturnStatus init(int& argc, char* argv[]);
00102 
00113    void shutdown(bool waitForCompletion = true);
00114 
00122    bool isValid() const
00123    {
00124       return ! (CORBA::is_nil(mORB) || CORBA::is_nil(mRootPOA));
00125    }
00126 
00127    const std::string& getNameServiceURI() const
00128    {
00129       return mNameServiceURI;
00130    }
00131 
00132    const CosNaming::NamingContext_var getLocalContext()
00133    {
00134       return mLocalContext;
00135    }
00136 
00149    std::list<tweek::SubjectManager_var> getSubjectManagerList();
00150 
00155    void setSubjectManager(tweek::SubjectManager_var mgr)
00156    {
00157       this->mSubjectManager = mgr;
00158    }
00159 
00168    tweek::SubjectManager_var getSubjectManager() const
00169    {
00170       return mSubjectManager;
00171    }
00172 
00184    PortableServer::ObjectId_var registerObject(PortableServer::ServantBase* servant,
00185                                                const std::string& name);
00186 
00194    void unregisterObject(PortableServer::ObjectId_var id);
00195 
00200    void run();
00201 
00202 private:
00203    vpr::ReturnStatus initRootPOA();
00204 
00214    void addSubjectManagers(const CosNaming::BindingList& bindingList,
00215                            std::list<tweek::SubjectManager_var>& mgrList);
00216 
00217    vpr::ThreadRunFunctor<tweek::CorbaService>* mOrbFunctor;
00218    vpr::Thread* mOrbThread;
00219 
00220    std::string mNsHost;
00221    vpr::Uint16 mNsPort;
00222    std::string mNameServiceURI;
00223 
00224    CORBA::ORB_var          mORB;
00225    PortableServer::POA_var mRootPOA;
00226 //   PortableServer::POA_var mChildPOA;
00227 
00228    std::string                  mSubContextId;
00229    CosNaming::NamingContext_var mRootContext;
00230    CosNaming::NamingContext_var mLocalContext;
00231 
00232    tweek::SubjectManager_var mSubjectManager;
00233 };
00234 
00235 } // End of Tweek namespace
00236 
00237 
00238 #endif /* _TWEEK_CORBA_SERVICE_H_ */

Generated on Sun May 2 14:41:03 2004 for Tweek by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002