C:\Users\Owner\AppData\Local\Temp\build2075849323474743225.tmp/LED.cpp:75: undefined reference to CArray<CVirtualLED>::~CArray()' LED.cpp.o: In function
CClockDisplay':
C:\Users\Owner\AppData\Local\Temp\build2075849323474743225.tmp/LED.cpp:69: undefined reference to `CArray::CArray()'
#ifndef _ARRAY_H
#define _ARRAY_H
#define NULL 0;
template<class T>
class CArrayElement
{
public:
// Construction
CArrayElement();
~CArrayElement();
// Implementation
T m_Element, *m_pNext;
};
template<class T>
class CArray
{
public:
// Construction
CArray();
~CArray();
// Attributes
void add(T &rT);
bool addAt(T &rT, const int nIndex);
T &operator[](const int nIndex);
bool deleteAt(const int nIndex);
protected:
// Implementation
CArrayElement<T> *m_pHead;
CArrayElement<T> m_Blank;
int m_nSize;
};
#endif
#include "Array.h"
template<class T>
CArrayElement<T>::CArrayElement()
{
m_pNext = NULL;
}
template<class T>
CArrayElement<T>::~CArrayElement()
{
m_pNext = NULL;
}
template<class T>
CArray<T>::CArray()
{
m_pHead = NULL;
m_nSize = 0;
}
template<class T>
CArray<T>::~CArray()
{
CArrayElement<T> *pCurrent = m_pHead;
while (m_pHead)
{
pCurrent = m_pHead->m_pNext;
delete m_pHead;
m_pHead = pCurrent;
}
}
template<class T>
void CArray<T>::add(T &rT)
{
CArrayElement<T> *pCurrent = m_pHead;
while (pCurrent->m_pNext)
pCurrent = pCurrent->m_pNext;
pCurrent->m_pNext = new CArrayElement<T>;
pCurrent->m_Element = rT;
m_nSize++;
}
template<class T>
bool CArray<T>::addAt(T &rT, const int nIndex)
{
CArrayElement<T> *pCurrent = NULL;
CArrayElement<T> *pPrevious = NULL;
CArrayElement<T> *pNew = NULL;
bool bResult = false;
int nI = 0;
if ((nIndex >= 1) && (nIndex <= m_nSize))
{
bResult = true;
for (nI = 1, pCurrent = m_pHead; nI < nIndex; nI++)
{
pPrevious = pCurrent;
pCurrent = pCurrent->m_pNext;
}
m_nSize++;
pNew = new CArrayElement<T>;
pNew->m_Element = rT;
pNew->m_pNext = pCurrent;
if (pCurrent == m_pHead)
m_pHead = pNew;
else
pPrevious->m_pNext = pNew;
}
return bResult;
}
template<class T>
T &CArray<T>::operator[](const int nIndex)
{
CArrayElement<T> *pCurrent = NULL;
int nI = 0;
T &rResult = m_Blank;
if ((nIndex >= 1) && (nIndex <= m_nSize))
{
for (nI = 1, pCurrent = m_pHead; nI < nIndex; nI++)
{
pCurrent = pCurrent->m_pNext;
}
rResult = pCurrent->m_pElement;
}
return rResult;
}
template<class T>
bool CArray<T>::deleteAt(const int nIndex)
{
CArrayElement<T> *pCurrent = NULL;
CArrayElement<T> *pPrevious = NULL;
bool bResult = false;
int nI = 0;
if ((nIndex >= 1) && (nIndex <= m_nSize))
{
bResult = true;
for (nI = 1, pCurrent = m_pHead; nI < nIndex; nI++)
{
pPrevious = pCurrent;
pCurrent = pCurrent->m_pNext;
}
if (pCurrent == m_pHead)
m_pHead = pCurrent->m_pNext;
else
pPrevious->m_pNext = pCurrent->m_pNext;
delete pCurrent;
pCurrent = NULL;
}
return bResult;
}
#ifndef _LED_H
#define _LED_H
#include "Array.h"
#define BLACK 0
#define RED 1
#define YELLOW 2
#define GREEN 3
#define CYAN 4
#define BLUE 5
#define PINK 6
#define WHITE 7
class CVirtualLED
{
public:
// Construction
CVirtualLED();
CVirtualLED(const int nRadius, const int nAngle, const int nColor);
~CVirtualLED();
// Attributes
void setPos(const int nRadius, const int nAngle);
void setRadius(const int nRadius);
void setAngle(const int nAngle);
int getAngle();
int getRadius();
void setColor(const int nColor);
int getColor();
protected:
// Implementation
int m_nRadius, m_nAngle, m_nColor;
};
[b]typedef CArray<CVirtualLED> CVirtualLEDArray;[/b]
class CClockDisplay
{
public:
// Construction
CClockDisplay();
~CClockDisplay();
// Attributes
void addVirtualLED(CVirtualLED &rVirtualLED);
int getCircumAt(const int nRadius);
float Sine(const int nAbgleDeg);
float Cosine(const int nAbgleDeg);
void setup();
protected:
// Implementation
[b]CVirtualLEDArray m_arrayClockFace;
[/b] static const float m_fPi;
static const int m_nNumRadialLEDs, m_nLEDDiameter, m_nMajClkDiv, m_nMinClkDiv, m_nLEDRadialSpacing, m_nLEDCircumSpacing;
};
#endif