|
|
#ifndef OM_FINAL_NODE_H #define OM_FINAL_NODE_H /** * Base class for final nodes. * * This class provides a simple support to inherit from OmNode by redefining all the children insertion operations * so that they become invalid. Thus, such a 'final node' always is a leaf with an empty list of children. * Note only insertion operations have to be disabled, since the others would apply normally for a list of zero children. */ class OmFinalNode : public OmNode { public: /** * Default constructor. */ OmFinalNode() {} public: /** * Disable appending. * @li Postcondition: false */ virtual OmNode * append(OmNode * adoption_in) { OmException::checkDisabled(true, "Cannot append a child on a Final node"); return this; } /** * Disable insertion. * @li Postcondition: false */ virtual OmNode * insert(Iterator it_in, OmNode * adoption_in) { OmException::checkDisabled(true, "Cannot insert a child on a Final node"); return this; } protected: /** * Copy constructor. */ OmFinalNode(const OmFinalNode & other_in) : OmNode(other_in) {} /** * Destructor. */ virtual ~OmFinalNode() {} }; #endif // OM_FINAL_NODE_H
Generated by: root@localhost.localdomain on Tue Oct 12 21:02:30 199. |