OSDN Git Service

[denncoCreator] fixed a crash bug.
[dennco/denncoCreator.git] / Source / dccell.h
index fcce41b..b47c95d 100644 (file)
@@ -37,8 +37,10 @@ class DCCell : public QObject, public TKCell
 {
     Q_OBJECT
 
-    friend class DCComponentUtil;
-    DCCell(DCContainer *container, std::string location, std::string name, std::string type, bool canInterface);
+    friend struct DCComponentUtil;
+    friend class DCContainer;
+
+    DCCell(DCContainer *container, std::string location, std::string name, std::string type, bool canInputInterface, bool canOutputInterface);
     void bindComponent(DCVPageComponent *component);
 
     DCVPageComponent    *d_vComponent;
@@ -52,17 +54,32 @@ class DCCell : public QObject, public TKCell
 
     bool                removeAllConnections();
 
+    /**
+      * Change name of this cell.
+      * DCContainer will call this method.
+      */
+    void                changeName(const QString& newName);
+
+    /**
+      * Change the location path for this cell.
+      * DCContainer will call this method.
+      */
+    void                changePath(const QString& newPath);
+
+
 public:
     virtual ~DCCell();
 
-    virtual bool        doTick(float time) {return false;}
+    virtual bool        doTick(float time) { (void) time; return false;}
     virtual bool        doInit() {return false;}
     virtual bool        doDestroy() {return false;}
     virtual bool        setCellCode(TKCellCode *code, const void *data);
 
+    std::string         getLocation() const { return mLocation; }
     DCVPageComponent *  getVComponent() const { return d_vComponent; }
     DCVCPage*           getPageBelonging() const;
     DCCellCode*         getCellCode() const { return d_cellCode; }
+    bool                getIsCellCodeAssgined() const;
     DCAxon*             getAxon() const;
     std::string         getReceptorName(DCReceptor *receptor) const;
     DCReceptor*         getReceptor(const QString& receptorName);
@@ -74,6 +91,7 @@ public:
     float               getViewHeight() const;
     void                getViewHCrossPoint(float dx, float dz, float *outX, float *outZ) const;
     void                getViewVCrossPoint(float dx, float dy, float *outX, float *outY) const;
+    QString             getWorkFilePathForCustomScript() const;
 
     void                setViewPageX(float x);
     void                setViewPageY(float y);
@@ -81,17 +99,42 @@ public:
     void                setViewHeight(float height);
     bool                saveCustomScript(const QString& script);
 
-    /* This method is exepected to be called from command classes (defined in dceditcommands.h).
-     * This will remove receptor from the list
-     * This will remove receptor object but won't remove the axon terminal connected to the receptor
+    /* Following methods are expected to be called from command classes (defined in dceditcommands.h).
+     */
+
+    /**
+     * Rename receptor name
+     */
+    bool                renameReceptor(const QString& oldName, const QString& newName);
+
+    /**
+     * Remove receptor from the list
+     * Note that this remove receptor object but won't remove the axon terminal connected to the receptor.
+     * This method is expected to be only called from command classes (defined in dceditcommands.h )
      */
     bool                removeReceptor(const QString &name);
+
+
+    /**
+     * Remove receptor from the list
+     * Note that this remove receptor object but won't remove the axon terminal connected to the receptor.
+     * This method is expected to be only called from command classes (defined in dceditcommands.h )
+     */
     bool                removeReceptor(DCReceptor *receptor);
 
-    /* This method is exepected to be called from command.
+    /**
+     * Create a receptor with the given name and register it into this cell.
+     * This method is expected to be only called from command classes (defined in dceditcommands.h )
      */
     virtual DCReceptor* createReceptor(const QString &receptorName);
 
+    /**
+     * Change cell code type.
+     * change of cell's own type attribute only take effort when no cell code class is assined to this cell.
+     * In the case a cell code class is assiend to this cell, type of this cell rely on the cell code class's API type.
+     */
+    void                changeType(const QString& type);
+
 signals:
     void    cellCodeChanged();