Home | Hierarchy | Members | Alphabetical | Related Pages |
00001 #ifndef XDKWRL_MFNODE_H 00002 #define XDKWRL_MFNODE_H 00003 00004 #include <xdkwrl/fieldtypes/sfnode.h> 00005 #include <deque> 00006 #include <algorithm> 00007 #include <iterator> 00008 00009 namespace wrl 00010 { 00011 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00012 // Interface of MFNode 00013 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00014 /*! \ingroup fieldtypes 00015 * 00016 * A MFNode is a container of SFNode. It is implemented using a STL's 00017 * deque so you can benefit from its interface. Most common 00018 * functionnalities you would use are: 00019 \code 00020 Transform* t = new Transform(); 00021 // Transform has a field children of type MFNode 00022 Shape* s1 = new Shape(); 00023 Shape* s2 = new Shape(); 00024 t->children.push_back(SFNode(s1)); // push_back(s1); would fail since 00025 t->children.push_back(SFNode(s2)); // constructor SFNode(Node*) is explicit 00026 00027 cout<<t->children[0]->typeName()<<endl; // echoes "Shape" 00028 \endcode 00029 * but since it uses STL principles, you have all useful concepts such as 00030 * iterator, algorithms, etc... 00031 * 00032 * Below is included the documentation for this field type from the ISO 00033 * standard. 00034 * \htmlinclude sfnode.html 00035 */ 00036 class MFNode : public std::deque<SFNode> 00037 { 00038 public: 00039 static inline const char* typeName(); 00040 static inline FieldTypeId typeId(); 00041 friend std::ostream& operator<<(std::ostream& s,const MFNode& f); 00042 }; 00043 //************************************************************ 00044 // Implementation of MFNode 00045 //************************************************************ 00046 inline const char* 00047 MFNode::typeName() 00048 { 00049 return "MFNode"; 00050 } 00051 inline FieldTypeId 00052 MFNode::typeId() 00053 { 00054 return mfNode; 00055 } 00056 inline std::ostream& operator<<(std::ostream& s,const MFNode& f) 00057 { 00058 std::copy(f.begin(),f.end(),std::ostream_iterator<SFNode>(s,"\n")); 00059 return s; 00060 } 00061 } 00062 00063 00064 #endif // XDKWRL_MFNODE_H
Generated on 24 Feb 2005 with version 1.3.9.1. |