Main Page | Modules | Class Hierarchy | Class List | File List | Class Members | 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 *, 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 
00054     // the following members will be used directly by inspectors
00055     RecordFunc record_in_inspector; // to notify inspector about file writes
00056     void *data_for_inspector;
00057 
00058   public:
00059     // internal: called from behind cEnvir
00060     void setCallback(RecordFunc f, void *d) {record_in_inspector=f; data_for_inspector=d;}
00061 
00062   public:
00065 
00069     explicit cOutVector(const char *name=NULL, int tuple=1);
00070 
00074     cOutVector(const cOutVector& r) : cObject() {setName(r.name());operator=(r);}
00075 
00079     virtual ~cOutVector();
00080 
00084     cOutVector& operator=(const cOutVector&)  {copyNotSupported();return *this;}
00086 
00089 
00094     virtual void setName(const char *name);
00095 
00100     virtual cObject *dup() const    {return new cOutVector(*this);}
00101 
00106     virtual std::string info() const;
00107 
00112     virtual void netPack(cCommBuffer *buffer);
00113 
00118     virtual void netUnpack(cCommBuffer *buffer);
00120 
00123 
00132     virtual bool record(double value);
00133 
00142     virtual bool record(double value1, double value2);
00143 
00147     virtual void enable()  {enabled=true;}
00148 
00153     virtual void disable()  {enabled=false;}
00154 
00158     virtual bool isEnabled()  {return enabled;}
00159 
00165     long valuesReceived()  {return num_received;}
00166 
00172     long valuesStored()  {return num_stored;}
00173 
00177     int tuple() {return tupl;}
00179 };
00180 
00181 #endif
00182 
00183 

Generated on Fri Apr 1 12:25:32 2005 for OMNeT++/OMNEST Simulation Library by  doxygen 1.3.9.1