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

UINetwork.h

00001 // Copyright (C) 2001 Jean-Marc Valin
00002 
00003 #ifndef UINETWORK_H
00004 #define UINETWORK_H
00005 
00006 //#include <gnome.h>
00007 //#include "UIDocument.h"
00008 #include <vector>
00009 #include <string>
00010 #include <libxml/tree.h>
00011 #include <fstream>
00012 #include <pthread.h>
00013 #include "UINetTerminal.h"
00014 #include "UINodeParameters.h"
00015 #include "UINodeRepository.h"
00016 #include <set>
00017 
00018 namespace FD {
00019 //struct xmlNode;
00020 class ItemInfo;
00021 class UINode;
00022 class UITerminal;
00023 class UILink;
00024 class UINodeMenu;
00025 class UIDocument;
00026 class UINote;
00027 //class UINetTerminal;
00028 
00029 class Network;
00030 class ParameterSet;
00031 
00037 class UINetwork {
00038   public:
00040    enum Type {subnet=0, iterator=1, threaded=2};
00041 protected:
00042 
00044    bool destroyed;
00045 
00047    UIDocument *doc;
00048 
00050    std::string name;
00051 
00053    std::string m_description;
00054 
00056    Type type;
00057 
00059    std::vector <UINode *> nodes;
00060 
00062    std::vector <UILink *> links;
00063 
00065    std::vector <UINetTerminal *> terminals;
00066 
00068    std::vector <UINote*> m_notes;
00069 
00071    //UINode *conditionNode;
00072 private:
00073    
00075    bool buildRecurs;
00076 public:
00078    UINetwork(UIDocument *_doc, std::string _name, Type _type);
00079 
00081    UINetwork(UIDocument *_doc, xmlNodePtr net, bool init=true);
00082 
00084    void load (xmlNodePtr net);
00085 
00087    virtual ~UINetwork();
00088 
00090    void setModified();
00091 
00092    UINode *loadNode (xmlNodePtr node);
00093    
00094    UINode *getNodeNamed(std::string n);
00095    
00096    void addNode(UINode *node);
00097 
00098    void removeNode (UINode *node);
00099 
00100    void addLink (UILink *link);
00101 
00102    void removeLink (UILink *link);
00103 
00104    const std::string &getName() {return name;}
00105 
00106    std::string getDescription() {return m_description;}
00107 
00108    void setDescription(const std::string & _description){m_description = _description;}
00109 
00110    
00111    Type getType() {return type;}
00112 
00113    UIDocument *getDocument() {return doc;}
00114 
00115    bool isIter() {return type==iterator;}
00116 
00117 
00118    void saveXML(xmlNode *root);
00119 
00120    virtual void newNetNotify(const std::string &cat, const std::string &type);
00121 
00122    void addTerminal(UINetTerminal *term);
00123 
00124    void removeTerminal(UINetTerminal *term);
00125 
00126    std::vector<std::string> getTerminals(UINetTerminal::NetTermType termType);
00127 
00128    void insertNetParams(std::vector<ItemInfo *> &params);
00129 
00130    virtual UINode *newNode(UINetwork* _net, xmlNodePtr def);
00131    
00132    virtual UINode *newNode(UINetwork* _net, std::string _name, 
00133                                                    std::string _type, double _x, double _y, bool doInit);
00134 
00135 //   virtual UITerminal *newTerminal (string _name, UINode *_node, bool _isInput, double _x, double _y);
00136 
00137    virtual UILink *newLink (UITerminal *_from, UITerminal *_to, char *str=NULL);
00138 
00139 
00148    virtual UINote* newNote(const std::string &text, double x, double y, bool visible);
00149 
00150 
00151    virtual UINetTerminal *newNetTerminal (UITerminal *_terminal, UINetTerminal::NetTermType _type, const std::string &_name, 
00152                                           const std::string &_objType="any", const std::string &_description="No description available");
00153 
00154    Network *build(const std::string &netName, const ParameterSet &params);
00155 
00157    void genCode(std::ostream &out, int &id, std::set<std::string> &nodeList);
00158  
00159    std::vector<UINode *> getNodes() {return nodes;}
00160    std::vector<UILink *> getLinks() {return links;}
00161    std::vector<UINetTerminal *> getTerminals() {return terminals;}
00162 
00164    std::vector<UINote*> getNotes() {return m_notes;}
00165 
00166    void addNote(UINote *note);
00167 
00168 
00169    void removeNote(UINote *note);
00170    
00171    
00172    virtual void rename(std::string newName);
00173 
00174    void interfaceChangeNotify();
00175 
00176    virtual void updateAllSubnetTerminals(const std::string _nettype, const std::string _terminalname, 
00177                                          UINetTerminal::NetTermType _terminaltype, bool _remove); 
00178 
00179 
00180    virtual void updateAllSubnetParameters(const std::string _nettype, NodeInfo* _info);
00181 
00182 };
00183 
00184 }//namespace FD
00185 #endif

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