learning C++

This commit is contained in:
rusefi 2019-04-12 19:56:34 -04:00
parent 6241d11ec9
commit 91ac74c1c9
6 changed files with 6 additions and 24 deletions

View File

@ -32,18 +32,13 @@ void SingleWave::setState(int switchIndex, pin_state_t state) {
pinStates[switchIndex] = state;
}
void MultiWave::baseConstructor() {
MultiWave::MultiWave() {
channels = NULL;
switchTimes = NULL;
reset();
}
MultiWave::MultiWave() {
baseConstructor();
}
MultiWave::MultiWave(float *switchTimes, SingleWave *waves) {
baseConstructor();
MultiWave::MultiWave(float *switchTimes, SingleWave *waves) : MultiWave(){
init(switchTimes, waves);
}

View File

@ -61,7 +61,6 @@ public:
*/
class MultiWave {
public:
void baseConstructor();
MultiWave();
MultiWave(float *switchTimes, SingleWave *waves);
void init(float *switchTimes, SingleWave *waves);

View File

@ -32,7 +32,7 @@ SimplePwm::SimplePwm(const char *name) : SimplePwm() {
this->name = name;
}
void PwmConfig::baseConstructor() {
PwmConfig::PwmConfig() {
memset((void*)&scheduling, 0, sizeof(scheduling));
memset((void*)&safe, 0, sizeof(safe));
dbgNestingLevel = 0;
@ -46,12 +46,7 @@ void PwmConfig::baseConstructor() {
name = "[noname]";
}
PwmConfig::PwmConfig() {
baseConstructor();
}
PwmConfig::PwmConfig(float *st, SingleWave *waves) {
baseConstructor();
PwmConfig::PwmConfig(float *st, SingleWave *waves) : PwmConfig() {
multiWave.init(st, waves);
}

View File

@ -53,7 +53,6 @@ class PwmConfig {
public:
PwmConfig();
PwmConfig(float *switchTimes, SingleWave *waves);
void baseConstructor();
void init(float *switchTimes, SingleWave *waves);
void weComplexInit(const char *msg,

View File

@ -295,7 +295,7 @@ void Logging::appendPrintf(const char *fmt, ...) {
#endif /* ! EFI_UNIT_TEST */
void Logging::baseConstructor() {
Logging::Logging() {
name = NULL;
buffer = NULL;
linePointer = NULL;
@ -303,12 +303,7 @@ void Logging::baseConstructor() {
isInitialized = false;
}
Logging::Logging() {
baseConstructor();
}
Logging::Logging(char const *name, char *buffer, int bufferSize) {
baseConstructor();
Logging::Logging(char const *name, char *buffer, int bufferSize) : Logging(){
#if ! EFI_UNIT_TEST
initLoggingExt(name, buffer, bufferSize);
#else

View File

@ -18,7 +18,6 @@
// size of buffers?
class Logging {
public:
void baseConstructor();
Logging();
Logging(const char *name, char *buffer, int bufferSize);
void initLoggingExt(const char *name, char *buffer, int bufferSize);