📄 commonutility.h
字号:
/** * Copyright (c) 2006 Michele Mastrogiovanni. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _COMMON_UTILITY_H_#define _COMMON_UTILITY_H_#include "Utility.h"#include "clustering-header.h"#include "packet.h"#include <string>#include <map>typedef enum DumpType{ TX_BYTE_UNICAST = 0, TX_MSG_UNICAST = 1, TX_BYTE_BROADCAST = 2, TX_MSG_BROADCAST = 3, RX_BYTE_UNICAST = 4, RX_MSG_UNICAST = 5, RX_BYTE_BROADCAST = 6, RX_MSG_BROADCAST = 7, TIME = 8, ENERGY = 9};typedef struct { double values[10];} DumpData;class CommonUtility : public Utility { public: CommonUtility() : Utility(), packetsTransmit(0), bytesTransmit(0) { utility_name = "COMMON"; } // Dump Nodes. virtual void dump(); // Aggiunge valori ai dati. void add(NodeAddress node, double value, DumpType type); void set(NodeAddress node, double value, DumpType type); double get(NodeAddress node, DumpType type); virtual void addTransmitPacket(double packets, double bytes) { packetsTransmit += packets; bytesTransmit += bytes; } public: map<NodeAddress, DumpData> datas; double packetsTransmit; double bytesTransmit; };#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -