-
Notifications
You must be signed in to change notification settings - Fork 0
/
DgConverter.h
62 lines (47 loc) · 1.94 KB
/
DgConverter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
////////////////////////////////////////////////////////////////////////////////
//
// DgConverter.h: DgConverter class definitions
//
// Version 6.1 - Kevin Sahr, 5/23/13
//
////////////////////////////////////////////////////////////////////////////////
#ifndef DGCONVERTER_H
#define DGCONVERTER_H
#include <vector>
using namespace std;
#include "DgRF.h"
#include "DgConverterBase.h"
#include "DgAddress.h"
////////////////////////////////////////////////////////////////////////////////
template <class AFrom, class DFrom, class ATo, class DTo> class DgConverter :
public DgConverterBase {
public:
DgConverter (const DgRF<AFrom, DFrom>& fromFrame,
const DgRF<ATo, DTo>& toFrame)
: DgConverterBase(fromFrame, toFrame) {}
DgConverter (const DgConverter& con) : DgConverterBase(con) {}
DgConverter& operator= (const DgConverter& con)
{ DgConverterBase::operator=(con); return *this; }
virtual ATo convertTypedAddress (const AFrom& addIn) const = 0;
protected:
virtual DgAddressBase* createConvertedAddress
(const DgAddressBase& addIn) const
#if DGDEBUG
{
const DgAddress<AFrom>& addFrom =
static_cast<const DgAddress<AFrom>&>(addIn).address();
DgAddress<ATo> *addTo =
//new DgAddress<ATo>(convertTypedAddress(addFrom));
new DgAddress<ATo>(convertTypedAddress(
static_cast<const DgAddress<AFrom>&>(addIn).address()));
cout << " " << addFrom.address() << "->" << addTo->address() << endl;
return addTo;
}
#else
{ return new DgAddress<ATo>(convertTypedAddress(
static_cast<const DgAddress<AFrom>&>(addIn).address())); }
#endif
};
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
#endif