- Main Page
- Modules
- Classes
- Files
- Directories
- Related Pages

# coutvect.h

    00001 //==========================================================================
    00002 //  COUTVECT.H - part of
    00003 //                     OMNeT++/OMNEST
    00004 //            Discrete System Simulation in C++
    00005 //
    00006 //
    00007 //  Declaration of the following classes:
    00008 //    cOutVector         : represents an output vector
    00009 //    cOutputVectorManager  : actually records for cOutVector objects
    00010 //
    00011 //==========================================================================
    00012
    00013 /*--------------------------------------------------------------*
    00014   Copyright (C) 1992-2005 Andras Varga
    00015
    00016   This file is distributed WITHOUT ANY WARRANTY. See the file
    00017   `license' for details on this and other legal matters.
    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;        // if false, record() method will do nothing
    00049     int tupl;            // values: 1 or 2
    00050     void *handle;        // identifies output vector for the output vector manager
    00051     long num_received;   // total number of values passed to the output vector object
    00052     long num_stored;     // number of values actually stored
    00053     simtime_t last_t;    // last timestamp written, needed to ensure increasing timestamp order
    00054
    00055     // the following members will be used directly by inspectors
    00056     RecordFunc record_in_inspector; // to notify inspector about file writes
    00057     void *data_for_inspector;
    00058
    00059   public:
    00060     // internal: called from behind cEnvir
    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