script.H

Go to the documentation of this file.
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 
00020 #ifndef ARCHON_X3D_SCRIPT_H
00021 #define ARCHON_X3D_SCRIPT_H
00022 
00029 #include <archon/x3d/server/custom_field.H>
00030 #include <archon/x3d/server/network.H>
00031 #include <archon/x3d/server/parse_xml.H>
00032 
00033 namespace Archon
00034 {
00035   namespace X3D
00036   {
00037     struct Parser;
00038 
00042     struct ScriptNode: virtual ChildNode
00043     {
00044       static const NodeType *type;
00045 
00046     protected:
00047       ScriptNode() {}
00048     };
00049 
00064     struct Script: ScriptNode, UrlObject, CustomFieldNode, XML::CDATANode
00065     {
00066       static Ref<NodeBase> instantiate(BackRef<ExecutionContext> c)
00067       {
00068         return new Script(c);
00069       }
00070 
00071       static const NodeType *type;
00072       const NodeType *getType() const { return type; }
00073 
00074       Script(BackRef<ExecutionContext> c);
00075 
00076       bool getDirectOutput() const { return directOutput; }
00077       bool getMustEvaluate() const { return mustEvaluate; }
00078 
00079 
00080       struct Engine: virtual RefObjectBase
00081       {
00087         virtual void handleEvent(int fieldIndex, Time timestamp) = 0;
00088       };
00089 
00090     private:
00091       friend void initializeScriptComponent();
00092 
00093       bool directOutput; // [] FALSE
00094       bool mustEvaluate; // [] FALSE
00095 
00096       Loader::UriType getUriType() const
00097       {
00098         return Loader::uriType_Script;
00099       }
00100 
00101       void update();
00102       void onRealized(); // Overriding from NodeBase
00103       void onLoaded(); // Overriding from UrlObject
00104       void clear(); // Overriding from UrlObject
00105 
00106       // Overriding from CustomFieldNode
00107       void handleEvent(int fieldIndex, Time timestamp);
00108 
00109       void handleCDATA(string, Time stamp); // Overriding from CDATANode
00110 
00111       Ref<Engine> engine;
00112     };
00113   }
00114 }
00115 
00116 #endif // ARCHON_X3D_SCRIPT_H

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