Main Page Modules Class Hierarchy Compound List File List Compound Members

# coutvect.h

    00001 //==========================================================================
    00002 //   COUTVECT.H - header for
    00003 //                             OMNeT++
    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-2003 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 *, 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 tuple;           // 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
    00054     // the following members will be used directly by inspectors
    00055     friend class TOutVectorInspector;
    00056     friend class TOutVectorWindow;
    00057     RecordFunc record_in_inspector; // to notify inspector about file writes
    00058     void *data_for_inspector;       // FIXME: why not via a setCallback() function??
    00059
    00060   public:
    00063
    00067     explicit cOutVector(const char *name=NULL, int tuple=1);
    00068
    00072     cOutVector(const cOutVector& r) : cObject(r) {setName(r.name());operator=(r);}
    00073
    00077     virtual ~cOutVector();
    00078
    00082     cOutVector& operator=(const cOutVector&)  {copyNotSupported();return *this;}
    00084
    00087
    00092     virtual void setName(const char *name);
    00093
    00098     virtual cObject *dup() const    {return new cOutVector(*this);}
    00099
    00104     virtual void info(char *buf);
    00106
    00109
    00118     virtual bool record(double value);
    00119
    00128     virtual bool record(double value1, double value2);
    00129
    00133     virtual void enable()  {enabled=true;}
    00134
    00139     virtual void disable()  {enabled=false;}
    00140
    00144     virtual bool isEnabled()  {return enabled;}
    00145
    00151     long valuesReceived()  {return num_received;}
    00152
    00158     long valuesStored()  {return num_stored;}
    00160 };
    00161
    00162 #endif
    00163
    00164