00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef DDDVIS_H__
00040 #define DDDVIS_H__
00041
00042 #include <sstream>
00043 #include <iostream>
00044 #include <string>
00045 #include <map>
00046 #include <set>
00047 #include <boost/utility.hpp>
00048 #include "ariba/utility/types/NodeID.h"
00049 #include "ariba/utility/logging/Logging.h"
00050 #include "ariba/utility/system/Timer.h"
00051 #include "ariba/utility/misc/Helper.h"
00052 #include "ariba/utility/misc/KeyMapping.hpp"
00053 #include "ariba/utility/configuration/Configuration.h"
00054 #include "ariba/utility/visual/ServerVis.h"
00055
00056 using std::set;
00057 using std::string;
00058 using std::map;
00059 using std::pair;
00060 using std::make_pair;
00061 using std::cout;
00062 using std::ostringstream;
00063 using ariba::utility::NodeID;
00064 using ariba::utility::Configuration;
00065 using ariba::utility::KeyMapping;
00066 using ariba::utility::Timer;
00067
00068 namespace ariba {
00069 namespace utility {
00070
00071 class DddVis : public ServerVis, private boost::noncopyable {
00072 use_logging_h(DddVis);
00073 public:
00074 static DddVis& instance() { static DddVis the_inst; return the_inst; }
00075
00076
00077
00078
00079
00083 void visCreate (
00084 NETWORK_ID network,
00085 NodeID& node,
00086 string nodename,
00087 string info
00088 );
00089
00093 void visConnect (
00094 NETWORK_ID network,
00095 NodeID& srcnode,
00096 NodeID& destnode,
00097 string info
00098 );
00099
00103 void visDisconnect (
00104 NETWORK_ID network,
00105 NodeID& srcnode,
00106 NodeID& destnode,
00107 string info
00108 );
00109
00113 void visShutdown (
00114 NETWORK_ID network,
00115 NodeID& node,
00116 string info
00117 );
00118
00119
00120
00121
00122
00126 void visChangeNodeColor (
00127 NETWORK_ID network,
00128 NodeID& node,
00129 unsigned char r,
00130 unsigned char g,
00131 unsigned char b
00132 );
00133
00137 void visChangeNodeColor (
00138 NETWORK_ID network,
00139 NodeID& node,
00140 NODE_COLORS color
00141 );
00142
00146 void visChangeLinkColor (
00147 NETWORK_ID network,
00148 NodeID& srcnode,
00149 NodeID& destnode,
00150 unsigned char r,
00151 unsigned char g,
00152 unsigned char b
00153 );
00154
00158 void visChangeLinkColor (
00159 NETWORK_ID network,
00160 NodeID& srcnode,
00161 NodeID& destnode,
00162 NODE_COLORS color
00163 );
00164
00168 void visShowNodeLabel (
00169 NETWORK_ID network,
00170 NodeID& node,
00171 string label
00172 );
00173
00174 protected:
00175 DddVis();
00176 virtual ~DddVis();
00177
00178 private:
00179
00180 typedef enum _CommandType {
00181 CREATE_LAYER_TYPE = 0,
00182 CREATE_CLUSTER_TYPE = 1,
00183 CREATE_NODE_TYPE = 2,
00184 CREATE_EDGE_TYPE = 3,
00185 REMOVE_LAYER_TYPE = 4,
00186 REMOVE_CLUSTER_TYPE = 5,
00187 REMOVE_NODE_TYPE = 6,
00188 REMOVE_EDGE_TYPE = 7,
00189 SET_CLUSTER_LAYOUT_TYPE = 8,
00190 SET_NODE_COLOR_TYPE = 9,
00191 SET_EDGE_COLOR_TYPE = 10,
00192 SET_NODE_INFO_TYPE = 11,
00193 SET_EDGE_INFO_TYPE = 12,
00194 SET_LAYOUT_LEADER_TYPE = 13,
00195 } CommandType;
00196
00197 typedef enum _LayoutType {
00198 CIRCULAR_LAYOUT = 0,
00199 FORCE_LAYOUT = 1,
00200 LEADER_LAYOUT = 2,
00201 RANDOM_LAYOUT = 3,
00202 } LayoutType;
00203
00204 typedef enum _LayoutOrderStrategie {
00205 ORDER_BY_ID = 0,
00206 ORDER_RANDOMLY = 1,
00207 } LayoutOrderStrategie;
00208
00209 long getCommandID();
00210 long getTimestamp();
00211 int makeColor(unsigned char r, unsigned char g, unsigned char b);
00212 void sendMessage( const string msg, NETWORK_ID nid );
00213 unsigned int getNodeNumber(const NodeID& node);
00214
00215 unsigned long commandid;
00216 static const string del;
00217
00218 typedef set<ServerVis::NETWORK_ID> LayerSet;
00219 LayerSet layerSet;
00220
00221 typedef map<NodeID,unsigned int> NodeSet;
00222 NodeSet nodeSet;
00223
00224 typedef pair<NodeID, NodeID> NodePair;
00225 typedef KeyMapping<NodePair> NetworkLinks;
00226 NetworkLinks networkLinks;
00227 };
00228
00229 }}
00230
00231 #endif // DDDVIS_H__