WizardNode.h

Go to the documentation of this file.
00001 /*
00002  * The information in this file is
00003  * Copyright(c) 2007 Ball Aerospace & Technologies Corporation
00004  * and is subject to the terms and conditions of the
00005  * GNU Lesser General Public License Version 2.1
00006  * The license text is available from   
00007  * http://www.gnu.org/licenses/lgpl.html
00008  */
00009 
00010 
00011 
00012 #ifndef _WIZARDNODE
00013 #define _WIZARDNODE
00014 
00015 #include "Serializable.h"
00016 
00017 #include <string>
00018 #include <vector>
00019 
00020 class WizardItem;
00021 
00022 /**
00023  *  A data element used an input or output for a wizard item.
00024  *
00025  *  %Wizard nodes define the input or output data for an item executed in a wizard.  A
00026  *  node has a name, type, and a value.  The node type is a string containing the actual
00027  *  data type.  This is used in conjunction with the value, which is stored as a void
00028  *  pointer.  The value can then be any data type, which is identified by the string.  The
00029  *  name is also used to uniquely identify nodes of the same type.
00030  *
00031  *  A node can also be connected with one or more other nodes.  For example, an output node
00032  *  would be connected with an input node on another wizard item so that the value of the
00033  *  output node is used as the value for the input node.  All connected nodes are of the
00034  *  same data type as the original node.  The connected nodes can be retrieved with the
00035  *  getConnectedNodes() method.
00036  *
00037  *  @see     WizardItem
00038  */
00039 class WizardNode : public Serializable
00040 {
00041 public:
00042    /**
00043     *  Returns the node name.
00044     *
00045     *  @return  The node name.
00046     *
00047     *  @see     getType()
00048     */
00049    virtual const std::string& getName() const = 0;
00050 
00051    /**
00052     *  Returns the node type.
00053     *
00054     *  @return  The node type.
00055     *
00056     *  @see     getOriginalType(), getValidTypes()
00057     */
00058    virtual const std::string& getType() const = 0;
00059 
00060    /**
00061     *  Gets the item description.
00062     *
00063     *  @return  The item description.
00064     */
00065    virtual const std::string& getDescription() const = 0;
00066 
00067    /**
00068     *  Returns the original node type.
00069     *
00070     *  Some node types can also support connections with other compatible node types.
00071     *  The original type specifies the kind of value that must be present for the
00072     *  wizard to work successfully.  This value can differ from WizardNode::getType(),
00073     *  since that value is simply the current connected type.
00074     *
00075     *  @return  The original node type.
00076     *
00077     *  @see     getType(), getValidTypes()
00078     */
00079    virtual const std::string& getOriginalType() const = 0;
00080 
00081    /**
00082     *  Returns all valid types for this node.
00083     *
00084     *  This method returns the types that this node will accept.  The node may accept
00085     *  multiple types, but the value must always be a kind of the original type.
00086     *
00087     *  @return  All valid types for this node.
00088     *
00089     *  @see     getType(), getOriginalType()
00090     */
00091    virtual const std::vector<std::string>& getValidTypes() const = 0;
00092 
00093    /**
00094     *  Returns the node value.
00095     *
00096     *  @return  The node value as a void pointer.  The type must be queried to extract
00097     *           the actual data value referenced by the pointer.
00098     *
00099     *  @see     getType(), setValue()
00100     */
00101    virtual void* getValue() const = 0;
00102 
00103    /**
00104     *  Sets the node value.
00105     *
00106     *  @param   pValue
00107     *           The node value as a void pointer.
00108     *
00109     *  @see     getValue()
00110     */
00111    virtual void setValue(void* pValue) = 0;
00112 
00113    /**
00114     *  Returns the wizard item to which this node belongs.
00115     *
00116     *  @return  A pointer to the wizard item that contains this node.
00117     */
00118    virtual WizardItem* getItem() const = 0;
00119 
00120    /**
00121     *  Retrieves all connected nodes.
00122     *
00123     *  @return  A reference to a vector containing pointers to all of the nodes connected
00124     *           to this node.
00125     */
00126    virtual const std::vector<WizardNode*>& getConnectedNodes() const = 0;
00127 
00128 protected:
00129    /**
00130     * A plug-in cannot create this object, it can only retrieve an already existing
00131     * object from WizardItem.  The WizardItem will manage any instances
00132     * of this object.
00133     */
00134    virtual ~WizardNode() {}
00135 };
00136 
00137 #endif

Software Development Kit - Opticks 4.9.0 Build 16218