reduced massive ctor size

this was done by moving zero or nullptr initialization
into the header file
This commit is contained in:
Robin Müller 2020-04-19 15:15:33 +02:00
parent eacedf7ed6
commit ce554c615c
2 changed files with 28 additions and 29 deletions

View File

@ -21,24 +21,23 @@ DeviceHandlerBase::DeviceHandlerBase(uint32_t ioBoardAddress,
uint8_t setDeviceSwitch, object_id_t deviceCommunication, uint8_t setDeviceSwitch, object_id_t deviceCommunication,
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId, uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId,
FailureIsolationBase* fdirInstance, uint32_t cmdQueueSize) : FailureIsolationBase* fdirInstance, uint32_t cmdQueueSize) :
SystemObject(setObjectId), rawPacket(0), rawPacketLen(0), mode(MODE_OFF), SystemObject(setObjectId), mode(MODE_OFF), submode(SUBMODE_NONE),
submode(SUBMODE_NONE), pstStep(0), maxDeviceReplyLen(maxDeviceReplyLen), maxDeviceReplyLen(maxDeviceReplyLen), wiretappingMode(OFF),
wiretappingMode(OFF), defaultRawReceiver(0), storedRawData(StorageManagerIF::INVALID_ADDRESS), storedRawData(StorageManagerIF::INVALID_ADDRESS), deviceCommunicationId(
requestedRawTraffic(0), powerSwitcher(NULL), IPCStore(NULL), deviceCommunication), deviceThermalStatePoolId(thermalStatePoolId),
deviceCommunicationId(deviceCommunication), communicationInterface(NULL), deviceThermalRequestPoolId(thermalRequestPoolId), healthHelper(this,
cookie(NULL), commandQueue(NULL), deviceThermalStatePoolId(thermalStatePoolId), setObjectId), modeHelper(this), parameterHelper(this),
deviceThermalRequestPoolId(thermalRequestPoolId), healthHelper(this, setObjectId), childTransitionFailure(RETURN_OK), fdirInstance(fdirInstance),
modeHelper(this), parameterHelper(this), childTransitionFailure(RETURN_OK), hkSwitcher(this), defaultFDIRUsed(fdirInstance == nullptr),
ignoreMissedRepliesCount(0), fdirInstance(fdirInstance), hkSwitcher(this), switchOffWasReported(false), actionHelper(this, nullptr), cookieInfo(),
defaultFDIRUsed(fdirInstance == NULL), switchOffWasReported(false), ioBoardAddress(ioBoardAddress), childTransitionDelay(5000),
executingTask(NULL), actionHelper(this, NULL), cookieInfo(), ioBoardAddress(ioBoardAddress), transitionSourceMode(_MODE_POWER_DOWN), transitionSourceSubMode(
timeoutStart(0), childTransitionDelay(5000), transitionSourceMode(_MODE_POWER_DOWN), SUBMODE_NONE), deviceSwitch(setDeviceSwitch) {
transitionSourceSubMode(SUBMODE_NONE), deviceSwitch(setDeviceSwitch) {
commandQueue = QueueFactory::instance()->createMessageQueue(cmdQueueSize, commandQueue = QueueFactory::instance()->createMessageQueue(cmdQueueSize,
CommandMessage::MAX_MESSAGE_SIZE); CommandMessage::MAX_MESSAGE_SIZE);
cookieInfo.state = COOKIE_UNUSED; cookieInfo.state = COOKIE_UNUSED;
insertInCommandMap(RAW_COMMAND_ID); insertInCommandMap(RAW_COMMAND_ID);
if (this->fdirInstance == NULL) { if (this->fdirInstance == nullptr) {
this->fdirInstance = new DeviceHandlerFailureIsolation(setObjectId, this->fdirInstance = new DeviceHandlerFailureIsolation(setObjectId,
defaultFDIRParentId); defaultFDIRParentId);
} }
@ -55,7 +54,7 @@ DeviceHandlerBase::~DeviceHandlerBase() {
ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) { ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
this->pstStep = counter; this->pstStep = counter;
if (counter == 0) { if (getComAction() == SEND_WRITE) {
cookieInfo.state = COOKIE_UNUSED; cookieInfo.state = COOKIE_UNUSED;
readCommandQueue(); readCommandQueue();
doStateMachine(); doStateMachine();
@ -67,7 +66,7 @@ ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
if (mode == MODE_OFF) { if (mode == MODE_OFF) {
return RETURN_OK; return RETURN_OK;
} }
switch (getCommandQueue()) { switch (getComAction()) {
case SEND_WRITE: case SEND_WRITE:
if ((cookieInfo.state == COOKIE_UNUSED)) { if ((cookieInfo.state == COOKIE_UNUSED)) {
buildInternalCommand(); buildInternalCommand();

View File

@ -473,11 +473,11 @@ protected:
/** /**
* Pointer to the raw packet that will be sent. * Pointer to the raw packet that will be sent.
*/ */
uint8_t *rawPacket; uint8_t *rawPacket = nullptr;
/** /**
* Size of the #rawPacket. * Size of the #rawPacket.
*/ */
uint32_t rawPacketLen; uint32_t rawPacketLen = 0;
/** /**
* The mode the device handler is currently in. * The mode the device handler is currently in.
@ -496,7 +496,7 @@ protected:
/** /**
* This is the counter value from performOperation(). * This is the counter value from performOperation().
*/ */
uint8_t pstStep; uint8_t pstStep = 0;
/** /**
* This will be used in the RMAP getRead command as expected length, is set by the constructor, can be modiefied at will. * This will be used in the RMAP getRead command as expected length, is set by the constructor, can be modiefied at will.
@ -519,7 +519,7 @@ protected:
* Statically initialized in initialize() to a configurable object. Used when there is no method * Statically initialized in initialize() to a configurable object. Used when there is no method
* of finding a recipient, ie raw mode and reporting erreonous replies * of finding a recipient, ie raw mode and reporting erreonous replies
*/ */
MessageQueueId_t defaultRawReceiver; MessageQueueId_t defaultRawReceiver = 0;
store_address_t storedRawData; store_address_t storedRawData;
@ -528,19 +528,19 @@ protected:
* *
* if #isWiretappingActive all raw communication from and to the device will be sent to this queue * if #isWiretappingActive all raw communication from and to the device will be sent to this queue
*/ */
MessageQueueId_t requestedRawTraffic; MessageQueueId_t requestedRawTraffic = 0;
/** /**
* the object used to set power switches * the object used to set power switches
*/ */
PowerSwitchIF *powerSwitcher; PowerSwitchIF *powerSwitcher = nullptr;
/** /**
* Pointer to the IPCStore. * Pointer to the IPCStore.
* *
* This caches the pointer received from the objectManager in the constructor. * This caches the pointer received from the objectManager in the constructor.
*/ */
StorageManagerIF *IPCStore; StorageManagerIF *IPCStore = nullptr;
/** /**
* cached for init * cached for init
@ -550,12 +550,12 @@ protected:
/** /**
* Communication object used for device communication * Communication object used for device communication
*/ */
DeviceCommunicationIF *communicationInterface; DeviceCommunicationIF *communicationInterface = nullptr;
/** /**
* Cookie used for communication * Cookie used for communication
*/ */
Cookie *cookie; Cookie *cookie = nullptr;
struct DeviceCommandInfo { struct DeviceCommandInfo {
bool isExecuting; //!< Indicates if the command is already executing. bool isExecuting; //!< Indicates if the command is already executing.
@ -583,7 +583,7 @@ protected:
/** /**
* The MessageQueue used to receive device handler commands and to send replies. * The MessageQueue used to receive device handler commands and to send replies.
*/ */
MessageQueueIF* commandQueue; MessageQueueIF* commandQueue = nullptr;
/** /**
* this is the datapool variable with the thermal state of the device * this is the datapool variable with the thermal state of the device
@ -614,7 +614,7 @@ protected:
*/ */
ReturnValue_t childTransitionFailure; ReturnValue_t childTransitionFailure;
uint32_t ignoreMissedRepliesCount; //!< Counts if communication channel lost a reply, so some missed replys can be ignored. uint32_t ignoreMissedRepliesCount = 0; //!< Counts if communication channel lost a reply, so some missed replys can be ignored.
FailureIsolationBase* fdirInstance; //!< Pointer to the used FDIR instance. If not provided by child, default class is instantiated. FailureIsolationBase* fdirInstance; //!< Pointer to the used FDIR instance. If not provided by child, default class is instantiated.
@ -624,7 +624,7 @@ protected:
bool switchOffWasReported; //!< Indicates if SWITCH_WENT_OFF was already thrown. bool switchOffWasReported; //!< Indicates if SWITCH_WENT_OFF was already thrown.
PeriodicTaskIF* executingTask;//!< Pointer to the task which executes this component, is invalid before setTaskIF was called. PeriodicTaskIF* executingTask = nullptr;//!< Pointer to the task which executes this component, is invalid before setTaskIF was called.
static object_id_t powerSwitcherId; //!< Object which switches power on and off. static object_id_t powerSwitcherId; //!< Object which switches power on and off.
@ -1004,7 +1004,7 @@ private:
* *
* Set when setMode() is called. * Set when setMode() is called.
*/ */
uint32_t timeoutStart; uint32_t timeoutStart = 0;
/** /**
* Delay for the current mode transition, used for time out * Delay for the current mode transition, used for time out