00001 #ifndef __INSTANTIO_NODE_H
00002 #define __INSTANTIO_NODE_H
00003
00004 #ifdef _MSC_VER
00005 # pragma once
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "InstantIODef.h"
00027 #include "Namespace.h"
00028 #include "BasicOutSlot.h"
00029 #include "BasicInSlot.h"
00030 #include <string>
00031 #include <vector>
00032 #ifdef _MSC_VER
00033 # pragma warning (push)
00034 # pragma warning (disable: 4251)
00035 #endif
00036
00037
00038 namespace InstantIO
00039 {
00040
00041
00042 class NodeType;
00043
00044
00050 class INSTANTIO_DLLMAPPING Node: public Namespace, public BasicOutSlot::Listener, public BasicInSlot::Listener
00051 {
00052 public:
00053
00055 enum State { NODE_RUNNING, NODE_SLEEPING, NODE_ERROR, NODE_DISABLED };
00056
00058
00061 Node();
00062
00064
00067 virtual ~Node();
00068
00069 virtual std::string typeName() const;
00070
00072
00076 State getState() const;
00077
00079
00083 std::string getShortInfo() const;
00084
00089 virtual std::string getDetailedInfo() const;
00090
00092 typedef std::vector<std::string> LogVector;
00093
00099 void getLog(LogVector &entries) const;
00100
00106 virtual void setFieldValue(const std::string &name, const std::string &value);
00107
00113 virtual std::string getFieldValue(const std::string &name) const
00114 ;
00115
00120 virtual void getFieldNames(std::vector<std::string> &names) const;
00121
00123
00127 virtual NodeType *type() const;
00128
00129 protected:
00130
00132 void setState(State state);
00133
00135 void setState(State state, const std::string &shortInfo);
00136
00138 void setShortInfo(const std::string &shortInfo);
00139
00144 void addLog(const std::string &entry);
00145
00149 virtual void initialize();
00150
00154 virtual void shutdown();
00155
00157 virtual void start();
00158
00160 virtual void stop();
00161
00163 virtual void startOutSlot(BasicOutSlot &outSlot);
00164
00166 virtual void stopOutSlot(BasicOutSlot &outSlot);
00167
00169 virtual void startInSlot(BasicInSlot &inSlot);
00170
00172 virtual void stopInSlot(BasicInSlot &inSlot);
00173
00174 private:
00175
00177 Node(const Node &);
00178
00180 const Node &operator=(const Node &);
00181
00183 volatile unsigned int useCounter_;
00184
00186 State state_;
00187
00189 std::string shortInfo_;
00190
00192 unsigned int logSize_;
00193
00195 unsigned int logTop_;
00196
00198 unsigned int logBottom_;
00199
00201 LogVector log_;
00202 };
00203
00204
00205 }
00206
00207
00208 #ifdef _MSC_VER
00209 # pragma warning (pop)
00210 #endif
00211
00212 #endif // __INSTANTIO_NODE_H