Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

UINode.h

00001 // Copyright (C) 2001 Jean-Marc Valin
00002 
00003 #ifndef UINODE_H
00004 #define UINODE_H
00005 
00006 //#include <gnome.h>
00007 #include <string>
00008 #include <vector>
00009 #include <string>
00010 #include <libxml/tree.h>
00011 #include <fstream>
00012 #include "UINetTerminal.h"
00013 #include <set>
00014 
00015 namespace FD {
00016 
00017 class UINetwork;
00018 //class GUINetwork;
00019 class UINodeParameters;
00020 class UILink;
00021 class ItemInfo;
00022 
00023 class UINetTerminal;
00024 class UITerminal;
00025 
00026 class Node;
00027 class ParameterSet;
00028 
00034 class UINode {
00035 protected:
00037    bool destroyed;
00038 
00040    std::string name;
00041 
00043    UINetwork *net;
00044 
00046    std::string type;
00047    
00049    std::string description;
00050 
00052    double x,y;
00053 
00055    double xtmp,ytmp;
00056 
00058    std::vector <UITerminal *> inputs;
00059 
00061    std::vector <UITerminal *> outputs;
00062 
00064    UINodeParameters *parameters;
00065 
00066 
00067 public:
00068 
00070    UINode(UINetwork* _net, std::string _name, std::string _type, double x, double y, bool doInit=1);
00071 
00073    UINode(UINetwork* _net, xmlNodePtr def, bool doInit=1);
00074 
00076    virtual ~UINode();
00077 
00079    const std::string &getName() {return name;}
00080    
00082    const std::string &getType() {return type;}
00083 
00085    UINetwork * getNetwork() {return net;}
00086 
00087 
00089    virtual void rename (const std::string &newName);
00090 
00092    virtual void addTerminal(const std::string &_name, UINetTerminal::NetTermType _type, 
00093                             const std::string &_objType="any", const std::string &_description="No description available");
00094 
00096    virtual void removeTerminal(const std::string &_name, UINetTerminal::NetTermType _type);
00097 
00099    void saveXML(xmlNode *root);
00100 
00102    UITerminal *getInputNamed(std::string n);
00103 
00105    UITerminal *getOutputNamed(std::string n);
00106 
00108    void getPos (double &xx, double &yy)
00109    {
00110       xx=x;
00111       yy=y;
00112    }
00113    
00115    void setPos (double new_x, double new_y)
00116    {
00117       x = new_x;
00118       y = new_y;
00119    }
00120 
00121   
00122 
00123    void setNodeParameters(UINodeParameters *params);   
00124    
00125    void insertNetParams(std::vector<ItemInfo *> &params);
00126 
00127    void updateNetParams(std::vector<ItemInfo *> &params);
00128 
00129 //   virtual UITerminal *newTerminal (string _name, UINode *_node, bool _isInput, double _x, double _y);
00130 
00131    virtual void notifyError(const std::string &message) {}
00132 
00133    virtual UILink *newLink (UITerminal *_from, UITerminal *_to);
00134 
00135    virtual UINetTerminal *newNetTerminal (UITerminal *_terminal, UINetTerminal::NetTermType _type, const std::string &_name,
00136                                           const std::string &_objType="any", const std::string &_description="No description available");
00137 
00138    virtual UINodeParameters *newNodeParameters (UINode *_node, std::string type);
00139  
00140    virtual void redraw() {}
00141 
00142    Node *build(const ParameterSet &params);
00143 
00145    void genCode(std::ostream &out, int &id, std::set<std::string> &nodeList);
00146 
00147    std::vector<UITerminal *> getInputs() {return inputs;}
00148    std::vector <UITerminal *> getOutputs() {return outputs;}
00149    UINodeParameters * getParameters() {return parameters;}
00150    std::string getDescription() {return description;}
00151    std::string getComments() const;
00152 
00153    friend class UINetwork;
00154 //   friend GUINetwork;
00155 };
00156 
00157 }//namespace FD
00158 #endif

Generated on Wed Oct 5 14:28:56 2005 for FlowDesigner by  doxygen 1.4.4