00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __COUTVECT_H
00021 #define __COUTVECT_H
00022
00023 #include <stdio.h>
00024 #include "cobject.h"
00025
00026
00032 typedef void (*RecordFunc)(void *, simtime_t, double, double);
00033
00034 class TOutVectorInspector;
00035 class TOutVectorWindow;
00036
00037
00045 class SIM_API cOutVector : public cObject
00046 {
00047 protected:
00048 bool enabled;
00049 int tupl;
00050 void *handle;
00051 long num_received;
00052 long num_stored;
00053 simtime_t last_t;
00054
00055
00056 RecordFunc record_in_inspector;
00057 void *data_for_inspector;
00058
00059 public:
00060
00061 void setCallback(RecordFunc f, void *d) {record_in_inspector=f; data_for_inspector=d;}
00062
00063 public:
00066
00071 explicit cOutVector(const char *name=NULL, int tuple=1);
00072
00076 cOutVector(const cOutVector& r) : cObject() {setName(r.name());operator=(r);}
00077
00081 virtual ~cOutVector();
00082
00086 cOutVector& operator=(const cOutVector&) {copyNotSupported();return *this;}
00088
00091
00096 virtual void setName(const char *name);
00097
00102 virtual cPolymorphic *dup() const {return new cOutVector(*this);}
00103
00108 virtual std::string info() const;
00109
00114 virtual void netPack(cCommBuffer *buffer);
00115
00120 virtual void netUnpack(cCommBuffer *buffer);
00122
00125
00133 virtual bool record(double value);
00134
00142 virtual bool record(double value1, double value2);
00143
00155 virtual bool recordWithTimestamp(simtime_t t, double value);
00156
00168 virtual bool recordWithTimestamp(simtime_t t, double value1, double value2);
00169
00173 virtual void enable() {enabled=true;}
00174
00179 virtual void disable() {enabled=false;}
00180
00184 virtual bool isEnabled() {return enabled;}
00185
00191 long valuesReceived() {return num_received;}
00192
00198 long valuesStored() {return num_stored;}
00199
00203 int tuple() {return tupl;}
00205 };
00206
00207 #endif
00208
00209