Hi,
I'm "objectizing" my code. First, I create a generic Array class. Then I refactor my code unsuccessfully, I re-refactor my code unsuccessfully, I re-re-refactor my code… I'm lost.
My error is:
Core2.cpp:33: error: no matching function for call to 'Schedule::Schedule(int, const prog_char [17], int, int, Array&)'
Schedule.h:40: note: candidates are: Schedule::Schedule(byte, const prog_char, boolean, unsigned int, Array)
Schedule.h:37: note: Schedule::Schedule(const Schedule&)
An my related files:
#ifndef ARRAY_H_
#define ARRAY_H_
#include <Arduino.h>
template<class T>
class Array {
public:
Array(const T* elements);
__attribute__((always_inline)) inline const T* getElments() { return this->_elements; };
__attribute__((always_inline)) inline const uint8_t size() { return this->_size; };
protected:
const T* _elements;
uint8_t _size;
};
template <class T>
Array<T>::Array(const T* elements)
{
this->_size = ARRAYLEN(elements);
this->_elements = elements;
}
#endif ARRAY_H_
#ifndef SCHEDULE_H_
#define SCHEDULE_H_
#include <Arduino.h>
#include <avr/pgmspace.h>
#include "macros.h"
#include "Array.h"
#include "Connector.h"
class Schedule : public ConnectorDigital {
public:
Schedule(byte id, const prog_char* label, const boolean isNC, unsigned int data, Array<const uint8_t>* digitals) {
this->_pin = (id << 2) | isNC;
this->_label = label;
this->_schedule = data;
this->_digitals = digitals;
};
protected:
unsigned int _schedule;
Array<const uint8_t>* _digitals;
};
#endif SCHEDULE_H_
and Core2.cpp:
static const uint8_t schedulePins_13_values[] = { 1, 2, 3, 4 };
Array<uint8_t>* schedulePins_13 = new Array<uint8_t>(schedulePins_13_values);
static Schedule schedule_13 = Schedule(13, Dictionary::test, false, 1324, schedulePins_13 );
I'm confused