//---------------------------------------------------------------------------

#ifndef CDSCrossFH
#define CDSCrossFH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <stdio.h>
#include <ADODB.hpp>
#include <DB.hpp>
#include "ITSLibF.h"
#include "ITSDbF.h"
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------

class TCrossCam
{
public:
    TCrossCam()
    {
        DRCT_DVSN_CD = 0;
    };
    ~TCrossCam() {};

private:

public:
    String  IXR_ID;
    String  CMRA_ID;
    String  CMRA_NM;
    String  ISTL_LCTN;
    int     DRCT_DVSN_CD;
    String  DRCT_DVSN_NM;

public:
    void SetInfo();
    void Copy(TCrossCam *AObj);

};

class TCross
{
public:
    TCross();
    ~TCross();

public:
    String  IXR_ID;
    String  IXR_NM;
    String  IXR_TYPE;

public:
    TItsMap<String, TCrossCam*> FLists;

public:

};
//---------------------------------------------------------------------------
typedef std::map<String, TCross*>::iterator   CrossIterator;
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
class TCrossManager
{
public:
    TCrossManager();
    ~TCrossManager();

private:

public:
    TItsMap<String, TCross*> FLists;
    TItsMap<String, TCrossCam*> FCamLists;

public:
    bool LoadFromDb(TADOConnection *ADbConn=NULL);
    bool LoadCrossCam(TADOConnection *ADbConn=NULL);
};

//---------------------------------------------------------------------------
extern TCrossManager *CrossManager;
//---------------------------------------------------------------------------


class TCamVol
{
public:
    TCamVol()
    {
        G = L = R = U = 0;
    };
    ~TCamVol(){};

    int Total()
    {
        return G+L+R+U;
    };
public:
    String CMRA_ID;
    int G, L, R, U;
};

class TLaneVol
{
public:
    TLaneVol()
    {
        VOL = 0;
    };
    ~TLaneVol(){};
public:
    String LANE;
    int    VOL;

public:
    TItsMap<String, TCamVol*> FLists;
};

class TDspVol
{
public:
    TDspVol() {};
    ~TDspVol(){};

public:
    String  DSP_DATE;

public:
    TItsMap<String, TLaneVol*> FLists;
};

class TCrossVol
{
public:
    TCrossVol() {};
    ~TCrossVol(){};

public:
    String IXR_ID;
    String IXR_NM;

public:
    TItsMap<String, TDspVol*> FLists;
};

#endif
