FreeWRL/FreeX3D  3.0.0
SAIExecutionContext.h
1 /****************************************************************************
2  This file is part of the FreeWRL/FreeX3D Distribution.
3 
4  Copyright 2009 CRC Canada. (http://www.crc.gc.ca)
5 
6  FreeWRL/FreeX3D is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  FreeWRL/FreeX3D is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with FreeWRL/FreeX3D. If not, see <http://www.gnu.org/licenses/>.
18 ****************************************************************************/
19 
20 #ifndef _SAIEXECUTIONCONTEXT_H_ABSTRACT_
21 #define _SAIEXECUTIONCONTEXT_H_ABSTRACT_
22 
23 #include "SAIGlobals.h"
24 
25 #define NO_SCENE 0 //There is no scene defined. This value should never be seen directly.
26 #define SCRIPTED_ENCODING 1 //The scene was created dynamically through scripting calls.
27 #define ASCII_ENCODING 2 //The scene described an original VRML 1.0 encoding.
28 #define CLASSIC_VRML_ENCODING 3 //The scene is encoded using the Classic VRML encoding. The scene may be VRML 97 or this specification.
29 #define XML_ENCODING 4 //The scene is encoded using the XML file format.
30 #define BINARY_ENCODING 5 //The scene was encoded using the binary format specified in ISO/IEC 19776-3.
31  //It shall be an error to use this value to describe a browser-specific proprietary binary format.
32 #define BIFS_ENCODING 6 //The scene was encoded using the MPEG4 BIFS encoding.
33 #define LAST_STD_ENCODING = 100 //A definition of the last constant used by the standard encodings.
34  //A browser is permitted to allow other, proprietary encoding mechanisms,
35  //and therefore any constant used to describe that shall use a value greater than this number.
36  //Code using these values shall not expect to be transportable across multiple browser implementations.
37 
38 namespace freeWRLSAI_cpp
39 {
40  //forward declarations
41  class saiNode;
42  class saiProtoDeclaration;
43  class saiRoute;
44 
46  {
47  public:
48  enum saiContextType
49  {
50  saiGenericContext = 0,
51  saiSceneContext,
52  //others
53  saiUndefinedContext //for error checking
54  };
55 
56  //GENERAL NOTICE: classes derived from saiExecutionContext should never be contructed with a standard ctor, so ctor/dtor group should be as follows
57  //protected:
58  // saiExecutionContext(); //standard ctor is never to be used
59 
60  //public:
61  //saiExecutionContext should be constructed with at least the pointer to the protected fwl X3D_"something" struct
62  //so every derived class should have something along the lines of
63  // saiExecutionContext(void* pProtectedStruct){ m_pProtectedStruct = pProtectedStruct;}
64 
65  //not part of W3C specifications, but it seems necessary
66  virtual saiContextType getContextType() = 0;
67 
68  virtual const char* getSpecificationVersion() = 0;
69 
70  virtual int getEncoding() = 0;
71 
72  virtual const char* getWorldURL() = 0; //returns NULL if no url was provided for scene creation
73 
74  virtual saiNode* getNode(const char* strNodeName, int nAction) = 0;
75 
76  virtual saiNode* createNode(const char* strNodeType) = 0;
77 
78  virtual saiNode* createProto(const char* strProtoName) = 0;
79 
80  virtual saiProtoDeclaration* getProtoDeclaration(const char* strProtoName) = 0;
81 
82  virtual void protoDeclarationHandling(const char* strProtoName, saiNode* pNode, int nAction) = 0;
83 
84  virtual saiProtoDeclaration* getExternProtoDeclaration(const char* strProtoName) = 0;
85 
86  virtual void externProtoDeclarationHandling(const char* strProtoName, saiNode* pNode, int nAction) = 0;
87 
88  virtual std::vector<saiNode*>* getRootNodes() = 0;
89 
90  virtual std::vector<saiRoute*>* getRoutes() = 0;
91 
92  virtual void dispose() = 0;
93 
94  virtual saiProfileDeclaration* getProfile() = 0;
95  virtual std::map<std::string, saiComponent*>* getComponents() = 0;
96 
97  //WAITING FOR DEFINITION
98  //virtual void namedNodeHandling... I believe it should be implemented with four different method signatures like Java Language Bindings does
99  //virtual void dynamicRouteHandling... same as above
100  };
101 };
102 
103 #endif //_SAIEXECUTIONCONTEXT_H_ABSTRACT_