OSDN Git Service

3be73268dac34f1f711acbf6c49ee0d963db4188
[dennco/dennco.git] / Source / TKCell.h
1 //  Copyright (c) 2012 Dennco Project
2 //
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16 //
17 //  Created by tkawata on 12/11/2011.
18 //
19
20 #ifndef __INCLUDE_TKCELL__
21 #define __INCLUDE_TKCELL__
22
23 #include <string>
24 #include <map>
25
26 class TKCellCode;
27 class TKReceptor;
28 class TKAxon;
29 class TKContainer;
30 class TKCellCodeInstance;
31
32 typedef std::map<std::string, TKReceptor*> TKReceptorMap;
33
34 class TKCell
35 {
36 public:
37         TKCell(TKContainer *container, std::string location, std::string name, bool canInterface);
38         virtual ~TKCell();
39     
40     std::string             getName() { return mName; }
41     float                   getAxonValue();
42     void                    setAxonValue(float value);
43     
44     const TKReceptorMap*    getReceptors() { return &mReceptors; }
45     
46     virtual bool            setCellCode(TKCellCode *code, const void *data);
47     
48         bool                    connectTo(std::string connectionName, TKCell *targetReceptor);
49         inline TKContainer*     getContainer() { return mContainer; }
50     bool                    isInterface() { return mCanInterface; }
51         
52         virtual bool            doTick(float time) = 0;
53     virtual bool            doInit() = 0;
54     virtual bool            doDestroy() = 0;
55
56 protected:
57     virtual TKReceptor*     createReceptor(std::string name);
58     
59     std::string             mName;
60     std::string             mLocation;
61         TKContainer             *mContainer;
62         TKAxon                  *mAxon;
63         TKReceptorMap           mReceptors;
64     TKCellCodeInstance      *mCellCodeInstance;
65     bool                    mCanInterface;
66
67 };
68
69 #endif
70