| 184 | }; |
| 185 | |
| 186 | class Node : public IECore::RefCounted |
| 187 | { |
| 188 | |
| 189 | public : |
| 190 | |
| 191 | // Container used to store all the children of the node. |
| 192 | // We need two things out of this structure - quick access |
| 193 | // to the child with a specific name, and also partitioning |
| 194 | // between names with wildcards and those without. This is |
| 195 | // achieved by using an ordered container, and having the |
| 196 | // less than operation for Names sort first on hasWildcards |
| 197 | // and second on the name. |
| 198 | typedef std::map<Name, NodePtr> ChildMap; |
| 199 | typedef ChildMap::iterator ChildMapIterator; |
| 200 | typedef ChildMap::value_type ChildMapValue; |
| 201 | typedef ChildMap::const_iterator ConstChildMapIterator; |
| 202 | |
| 203 | Node( bool terminator = false ); |
| 204 | // Shallow copy. |
| 205 | Node( const Node &other ); |
| 206 | ~Node() override; |
| 207 | |
| 208 | // Returns an iterator to the first child whose name contains wildcards. |
| 209 | // All children between here and children.end() will also contain wildcards. |
| 210 | ConstChildMapIterator wildcardsBegin() const; |
| 211 | |
| 212 | Node *child( const Name &name ); |
| 213 | const Node *child( const Name &name ) const; |
| 214 | |
| 215 | bool operator == ( const Node &other ) const; |
| 216 | |
| 217 | bool operator != ( const Node &other ); |
| 218 | |
| 219 | bool clearChildren(); |
| 220 | bool isEmpty(); |
| 221 | |
| 222 | ChildMap children; |
| 223 | bool terminator; |
| 224 | |
| 225 | // For most Node trees, the number of leaf nodes |
| 226 | // exceeds the number of branch nodes. Since by |
| 227 | // definition all leaf nodes are terminators with |
| 228 | // no children, we can save memory by always using |
| 229 | // this single shared node instance when adding a |
| 230 | // leaf node. |
| 231 | static Node *leaf(); |
| 232 | |
| 233 | }; |
| 234 | |
| 235 | typedef std::vector<IECore::InternedString>::const_iterator NameIterator; |
| 236 |
no outgoing calls
no test coverage detected