-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExample.cpp
96 lines (81 loc) · 2.07 KB
/
Example.cpp
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/******************************************************************************
* ANNKit is a platform independent C++ implementation of a 3 layer
* neural net trained by back propagation.
*
* Copyright of Gerry Ens and GoWest Robotics. www.GoWestRobotics.com
* You are free to use, alter and redistribute this code for all non-commercial
* purposes. Commercial use is also allowed under these conditions:
* 1) Notify the author by email at: Gerry@GoWestRobotics.com
* 2) Include this header intact somewhere in any file using all or part of
* this code
* 3) Clearly mark any modifications to this code
*****************************************************************************/
#include "Example.h"
CExample::CExample(void)
{
m_pvdInputs = new CValueVector;
m_pvdOutputs = new CValueVector;
}
CExample::CExample(unsigned nInputs, unsigned nOutputs)
{
m_pvdInputs = new CValueVector(nInputs);
m_pvdOutputs = new CValueVector(nOutputs);
}
CExample::~CExample(void)
{
delete m_pvdInputs;
delete m_pvdOutputs;
}
CExample::CExample(CExample& cexRHS)
{
*this = cexRHS;
}
//Deep copy
CExample &CExample::operator=(CExample& cexRHS)
{
unsigned i = 0;
//inputs
for (i = 0; i < m_pvdInputs->size(); i++)
{
(*m_pvdInputs)[i] = (*cexRHS.GetInputs())[i];
}
//outputs
for (i = 0; i < m_pvdOutputs->size(); i++)
{
(*m_pvdOutputs)[i] = (*cexRHS.GetOutputs())[i];
}
return (*this);
}
//accessors
void CExample::SetInputValue(unsigned i, double dValue)
{
(*m_pvdInputs)[i] = dValue;
}
double CExample::GetInputValue(unsigned i)
{
return (*m_pvdInputs)[i];
}
void CExample::SetOutputValue(unsigned i, double dValue)
{
(*m_pvdOutputs)[i] = dValue;
}
double CExample::GetOutputValue(unsigned i)
{
return (*m_pvdOutputs)[i];
}
CValueVector * CExample::GetInputs(void)
{
return m_pvdInputs;
}
CValueVector * CExample::GetOutputs(void)
{
return m_pvdOutputs;
}
void CExample::SetOutputs(CValueVector *pvdOutputs)
{
m_pvdOutputs = pvdOutputs;
}
void CExample::SetInputs(CValueVector *pvdInputs)
{
m_pvdInputs = pvdInputs;
}