00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef ARCHON_X3D_PARSE_H
00021 #define ARCHON_X3D_PARSE_H
00022
00023 #include <string>
00024
00025 #include <archon/util/ref.H>
00026 #include <archon/util/logger.H>
00027
00028 #include <archon/x3d/server/core.H>
00029 #include <archon/x3d/server/group.H>
00030 #include <archon/x3d/server/scene.H>
00031
00032 namespace Archon
00033 {
00034 namespace X3D
00035 {
00036 using namespace std;
00037 using namespace Utilities;
00038
00039 struct CustomFieldNode;
00040 struct CustomFieldBase;
00041
00042 struct ProgressTracker
00043 {
00044 virtual void set(Ref<Scene>) = 0;
00045 virtual void progress(long chars_loaded) = 0;
00046 virtual void scene(const string &uri) = 0;
00047 virtual void image(const string &uri) = 0;
00048 virtual ~ProgressTracker() {}
00049 };
00050
00051 struct Parser
00052 {
00053 protected:
00054 virtual void warning(string message) { logger->log(message); }
00055
00056 Parser(Ref<ExecutionContext> context, Ref<GroupingNode> rootGroup, string sourceName, Logger *logger):
00057 context(context), rootGroup(rootGroup), sourceName(sourceName), logger(logger) {}
00058
00059 virtual ~Parser() {}
00060
00061 Ref<ExecutionContext> context;
00062
00068 Ref<GroupingNode> rootGroup;
00069
00073 string sourceName;
00074
00075 Logger *logger;
00076
00077 bool validateIdentifier(string);
00078 void addNamedNode(string, Ref<NodeBase>);
00079
00080 Ref<NodeBase> lookupNode(string name) { return context->lookupNode(name); }
00081
00082 void addRootGroupChild(Ref<ChildNode>, Time stamp);
00083
00084 void addRoute(string sourceNodeName, string sourceFieldName,
00085 string targetNodeName, string targetFieldName);
00086
00087 int getNextCustomFieldIndex(Ref<CustomFieldNode>);
00088 void addScriptField(Ref<CustomFieldNode>, Ref<CustomFieldBase>);
00089 };
00090 }
00091 }
00092
00093 #endif // ARCHON_X3D_PARSE_H