route.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_ROUTE_H
00020 #define ARCHON_X3D_SAI_ROUTE_H
00021 
00022 #include <archon/x3d/server/event.H>
00023 
00024 #include <archon/x3d/sai/session.H>
00025 
00026 namespace Archon
00027 {
00028   namespace X3D
00029   {
00030     namespace SAI
00031     {
00032       using namespace Utilities;
00033   
00037       struct ExternalRouteHead: virtual RefObjectBase
00038       {
00039         const BackRef<Session> session;
00040         const unsigned long cookie;
00041 
00042       protected:
00043         ExternalRouteHead(Ref<Session> session, unsigned long cookie):
00044           session(session), cookie(cookie) {}
00045 
00046         unsigned long getHeadCountNoLock() { return getUseCountNoLock(); }
00047       };
00048 
00049       struct ExternalRoute: RouteTail, ExternalRouteHead
00050       {
00055         struct AccessException: Exception
00056         {
00057           AccessException(string l): Exception(l) {}
00058         };
00059 
00060         void cascadeEvent(const Event *e) const;
00061 
00062         static void add(Ref<NodeBase> sourceNode, const FieldBase *sourceField,
00063                         Ref<Session> session, unsigned long cookie)
00064           throw(AccessException);
00065 
00066         static bool del(Ref<NodeBase> sourceNode, const FieldBase *sourceField,
00067                         Ref<Session> session, unsigned long cookie);
00068 
00069         void refDispose(Mutex::Lock &l);
00070 
00071         ~ExternalRoute();
00072 
00073       private:
00074         ExternalRoute(Ref<NodeBase> sourceNode, const FieldBase *sourceField,
00075                       Ref<Session> session, unsigned long cookie);
00076 
00077         bool match(const RouteTail *) const;
00078       };
00079     }
00080   }
00081 }
00082 
00083 #endif // ARCHON_X3D_SAI_ROUTE_H
00084 

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