Project

General

Profile

Statistics
| Branch: | Revision:

root / src / scave / xyarray.h @ a3be1d55

History | View | Annotate | Download (1.6 KB)

1
//=========================================================================
2
//  XYARRAY.H - part of
3
//                  OMNeT++/OMNEST
4
//           Discrete System Simulation in C++
5
//
6
//  Author: Andras Varga
7
//
8
//=========================================================================
9

    
10
/*--------------------------------------------------------------*
11
  Copyright (C) 1992-2008 Andras Varga
12
  Copyright (C) 2006-2008 OpenSim Ltd.
13

14
  This file is distributed WITHOUT ANY WARRANTY. See the file
15
  `license' for details on this and other legal matters.
16
*--------------------------------------------------------------*/
17

    
18
#ifndef _XYARRAY_H_
19
#define _XYARRAY_H_
20

    
21
#include "scavedefs.h"
22

    
23
NAMESPACE_BEGIN
24

    
25
/**
26
 * ArrayBuilderNode returns the results in this class.
27
 */
28
class SCAVE_API XYArray
29
{
30
    private:
31
        double *x;
32
        double *y;
33
        int len;
34
        BigDecimal *xp; // precise x value
35
        eventnumber_t *evec; // event numbers
36
    public:
37
        XYArray(int l, double *xv, double *yv, BigDecimal *xpv = NULL, eventnumber_t *ev = NULL) {len = l; x = xv; y = yv; xp = xpv; evec = ev;}
38
        ~XYArray() {delete [] x; delete [] y; delete [] xp; delete [] evec;}
39
        int length() const  {return len;}
40
        double getX(int i) const  {return (i>=0 && i<len) ? x[i] : 0;}
41
        double getY(int i) const  {return (i>=0 && i<len) ? y[i] : 0;}
42
        BigDecimal getPreciseX(int i) const {return ((xp != NULL && i>=0 && i < len) ? xp[i] : BigDecimal::Nil);}
43
        eventnumber_t getEventNumber(int i) const {return ((evec != NULL && i>=0 && i<len) ? evec[i] : -1);}
44
        void sortByX();
45
};
46

    
47
NAMESPACE_END
48

    
49

    
50
#endif
51

    
52