listener.H

00001 /*
00002  * This file is part of the "Archon" framework.
00003  * (http://files3d.sourceforge.net)
00004  *
00005  * Copyright © 2002 by Kristian Spangsege and Brian Kristiansen.
00006  *
00007  * Permission to use, copy, modify, and distribute this software and
00008  * its documentation under the terms of the GNU General Public License is
00009  * hereby granted. No representations are made about the suitability of
00010  * this software for any purpose. It is provided "as is" without express
00011  * or implied warranty. See the GNU General Public License
00012  * (http://www.gnu.org/copyleft/gpl.html) for more details.
00013  *
00014  * The characters in this file are ISO8859-1 encoded.
00015  *
00016  * The documentation in this file is in "Doxygen" style
00017  * (http://www.doxygen.org).
00018  */
00019 #ifndef ARCHON_X3D_SAI_LISTENER_H
00020 #define ARCHON_X3D_SAI_LISTENER_H
00021 
00022 #include <archon/util/time.H>
00023 
00024 #include <archon/x3d/server/server.H>
00025 
00026 #include <archon/x3d/sai/exception.H>
00027 #include <archon/x3d/sai/session.H>
00028 
00029 namespace Archon
00030 {
00031   namespace X3D
00032   {
00033     namespace SAI
00034     {
00035       using namespace Utilities;
00036 
00037       struct Listener: Server::Listener
00038       {
00039         Listener(Ref<Server> server,
00040                  Time applicationHeartbeat,
00041                  int corbaEndpointPort);
00042       
00043         ~Listener();
00044 
00045         Orb &getOrb() { return orb; }
00046 
00047         struct NameServerException: Exception
00048         {
00049           NameServerException(string l, string m): Exception(l, m) {}
00050         };
00051 
00052         void startServingClientRequests(Ref<GroupingNode> applicationContainer)
00053           throw(NameServerException);
00054 
00055         void removeSession(Ref<Session>);
00056 
00057         const BackRef<Server> server;
00058 
00059         Ref<GroupingNode> getApplicationContainer()
00060         {
00061           Mutex::Lock lock(mutex);
00062           return applicationContainer;
00063         }
00064 
00065       private:
00066         void refForwardDestroy();
00067 
00068         Mutex mutex;
00069 
00070         const Time applicationHeartbeat;
00071 
00079         Ref<GroupingNode> applicationContainer;
00080 
00081         Orb orb;
00082 
00083         struct Servant;
00084         PortableServer::ObjectId_var servantId;
00085         bool active;
00086 
00090         void activate() throw(NameServerException);
00091 
00095         void deactivate();
00096 
00097         CORBA::ULong getNodeTypeBitsInId();
00098         CORBA::ULong getNodeType(const char *);
00099         CORBA::ULong getImmediateField(CORBA::ULong, const char *);
00100         x3d::sai::Session_ptr createSession(x3d::sai::Application_ptr);
00101 
00102         list<Ref<Session> > sessions;
00103       };
00104     }
00105   }
00106 }
00107 
00108 #endif // ARCHON_X3D_SAI_LISTENER_H

Generated on Sun Jul 30 22:55:48 2006 for Archon by  doxygen 1.4.4