#include <Scene.h>
Inheritance diagram for Scene:
Public Member Functions | |
Scene () | |
virtual | ~Scene () |
void | def (const char *nodeName, Node *value) |
Node * | use (const char *nodeName) |
Node * | getNodeByName (const char *nodeName) |
void | undef (const char *nodeName) |
int | addSymbol (std::string s) |
const std::string & | getSymbol (int id) const |
void | setRoot (Node *root) |
Node * | getRoot () const |
void | setNodes (NodeList *nodes) |
virtual const char * | parseVRML (FILE *f) |
Node * | createNode (const char *nodeType) |
bool | writeVRML (FILE *f) |
void | addProto (std::string name, Proto *value) |
Proto * | getProto (std::string name) |
void | addRoute (Node *src, int eventOut, Node *dest, int eventIn) |
void | deleteRoute (Node *src, int eventOut, Node *dest, int eventIn) |
int | getFieldType (std::string name) |
void | errorf (const char *fmt,...) |
void | invalidNode (const char *nodeName) |
void | invalidField (const char *node, const char *field) |
void | setField (Node *node, int field, FieldValue *value) |
void | addNode (Node *node) |
void | removeNode (Node *node) |
std::string | generateUniqueNodeName (Node *node) |
const NodeList * | getNodes () const |
bool | isTempSave () const |
void | ref () |
void | unref () |
Static Public Member Functions | |
static bool | validRoute (Node *src, int eventOut, Node *dst, int eventIn) |
static const char * | getFieldTypeName (int type) |
static void | checkInLicense () |
static void | checkOutLicense () |
Private Attributes | |
int | _refs |
NodeMap | _nodeMap |
Node * | _root |
StringMap | _symbols |
std::vector< std::string > | _symbolList |
ProtoMap | _protos |
StringMap | _fieldTypeMap |
NodeList * | _nodes |
int | _numSymbols |
NodeViewpoint * | _defaultViewpoint |
NodeViewpoint * | _currentViewpoint |
std::string | _compileErrors |
bool | _tempSave |
std::map<std::string,Node *> NodeMap, std::map<std::string,int> StringMap, std::map<std::string,Proto *> ProtoMap. Important variables are:
Scene::Scene | ( | ) |
Scene class constructor. Initialises the private "StringMap _fieldTypeMap" to contain pairs of "std::string-Int" as "MFVec3f - MFVEC3F" (the int ID MFVEC3F is returned from the scanner). Also initialises the private "ProtoMap _protos" to contain pairs of "std::string-Proto" as "Anchor - ProtoAnchor". In addition it assigns "Node _root" of the Scene to be a "Group" Node. Also it creates a default viewpoint.
TM
TM
Scene::~Scene | ( | ) | [virtual] |
void Scene::def | ( | const char * | nodeName, | |
Node * | value | |||
) |
In case of a VRML DEF keyword. Assigns the std::string "nodename" to the Node.
Node * Scene::use | ( | const char * | nodeName | ) |
In case of a VRML "USE" statement.
nodeName | the name of the node. |
Node * Scene::getNodeByName | ( | const char * | nodeName | ) |
void Scene::undef | ( | const char * | nodeName | ) |
Deassociate the Node with name 'nodeName' from that nodeName (in the NodeMap HastTable).
int Scene::addSymbol | ( | std::string | s | ) |
Primary used by the lexer. Adds the tokenised std::string input yytext to the Symbol HashTable and then in the Vector(Array) that contains all the parsed tokens.
s | std::string read by the lexr |
const string & Scene::getSymbol | ( | int | id | ) | const |
Returns a std::string scanned by the lexer.
id | the id(position) of the lexer input std::string |
void Scene::setNodes | ( | NodeList * | nodes | ) |
Sets all the root Nodes in the scenegraph. They are set as children of the _root "Group" node. (set in the Scene constructor).
const char * Scene::parseVRML | ( | FILE * | f | ) | [virtual] |
Node * Scene::createNode | ( | const char * | nodeType | ) |
bool Scene::writeVRML | ( | FILE * | f | ) |
Outputs to a file all the scene contents(all nodes).
void Scene::addProto | ( | std::string | name, | |
Proto * | value | |||
) |
Proto* Scene::getProto | ( | std::string | name | ) |
Checks if the Route is valid (from eventOut to eventIn).
int Scene::getFieldType | ( | std::string | name | ) |
Returns an int from a StringMap HashTable for FieldTypes. That is the int id from the StringMap _fieldTypeMap e.g. key "MFVec3f"-MFVEC3F value
const char * Scene::getFieldTypeName | ( | int | type | ) | [static] |
Returns a std::string from a StringMap HashTable for FieldTypes. From the pairs std::string-Id returns the opposite of getFieldType i.e. the std::string name
void Scene::errorf | ( | const char * | fmt, | |
... | ||||
) |
Outputs error messages to a buffer
void Scene::invalidNode | ( | const char * | nodeName | ) |
Outputs error message. In case of an invalid DEF name.
void Scene::invalidField | ( | const char * | node, | |
const char * | field | |||
) |
Outputs error message. In case of an invalid Field.
void Scene::setField | ( | Node * | node, | |
int | field, | |||
FieldValue * | value | |||
) |
Sets the field of the current node to the fieldValue
void Scene::addNode | ( | Node * | node | ) |
void Scene::removeNode | ( | Node * | node | ) |
Removes the Node from the Scene. Actually from Scene._nodes ( a NodeList i.e. an Array<Node*>)
string Scene::generateUniqueNodeName | ( | Node * | node | ) |
In case of Node::write() and that Node doesn't have a nodeName, generate a new nodeName.
const NodeList* Scene::getNodes | ( | ) | const [inline] |
bool Scene::isTempSave | ( | ) | const [inline] |
void Scene::ref | ( | ) | [inline] |
void Scene::unref | ( | ) | [inline] |
void Scene::checkInLicense | ( | ) | [static] |
FLEX_LM Check_in license
void Scene::checkOutLicense | ( | ) | [static] |
FLEX_LM Check_out license
int Scene::_refs [private] |
NodeMap Scene::_nodeMap [private] |
Node* Scene::_root [private] |
StringMap Scene::_symbols [private] |
std::vector<std::string> Scene::_symbolList [private] |
ProtoMap Scene::_protos [private] |
StringMap Scene::_fieldTypeMap [private] |
NodeList* Scene::_nodes [private] |
int Scene::_numSymbols [private] |
NodeViewpoint* Scene::_defaultViewpoint [private] |
NodeViewpoint* Scene::_currentViewpoint [private] |
std::string Scene::_compileErrors [private] |
bool Scene::_tempSave [private] |