Skip to content

Commit

Permalink
clkmgr: Replace decltype with normal type.
Browse files Browse the repository at this point in the history
Signed-off-by: Lai Peter Jun Ann <[email protected]>
  • Loading branch information
Lai Peter Jun Ann authored and yoongsiang2 committed Oct 21, 2024
1 parent 12a1c60 commit 7652326
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 28 deletions.
6 changes: 3 additions & 3 deletions clkmgr/common/message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ using namespace std;

DECLARE_STATIC(Message::parseMsgMap);

Message::Message(decltype(msgId) msgId)
Message::Message(msgId_t msgId)
{
this->msgId = msgId;
this->msgAck = ACK_NONE;
Expand Down Expand Up @@ -79,7 +79,7 @@ COMMON_PRESEND_MESSAGE_TYPE(Message::presendMessage)

bool Message::addMessageType(parseMsgMapElement_t mapping)
{
decltype(parseMsgMap)::size_type size = parseMsgMap.size();
std::map<msgId_t, BuildMessage_t>::size_type size = parseMsgMap.size();
parseMsgMap.insert(mapping);
if(parseMsgMap.size() == size)
return false;
Expand All @@ -100,7 +100,7 @@ PARSE_RXBUFFER_TYPE(Message::parseBuffer)
MAKE_RXBUFFER_TYPE(Message::buildMessage)
{
msgId_t msgId;
decltype(parseMsgMap)::iterator it;
std::map<msgId_t, BuildMessage_t>::iterator it;
if(!PARSE_RX(FIELD, msgId, LxContext))
return false;
it = parseMsgMap.find(msgId);
Expand Down
29 changes: 14 additions & 15 deletions clkmgr/common/message.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,13 @@ typedef std::pair<msgId_t, BuildMessage_t> parseMsgMapElement_t;
class Message
{
private:
static std::map<decltype(parseMsgMapElement_t::first),
decltype(parseMsgMapElement_t::second)> parseMsgMap;
static std::map<msgId_t, BuildMessage_t> parseMsgMap;
msgId_t msgId;
msgAck_t msgAck;
sessionId_t sessionId;

protected:
Message(decltype(msgId) msgId);
Message(msgId_t msgId);
static bool addMessageType(parseMsgMapElement_t);
static std::string ExtractClassName(std::string prettyFunction,
std::string function);
Expand Down Expand Up @@ -76,22 +75,22 @@ class Message

virtual ~Message() = default;

const decltype(msgId) &getc_msgId() { return msgId; }
decltype(msgId) &get_msgId() { return msgId; }
void set_msgId(const decltype(msgId) &msgId) { this->msgId = msgId; }
decltype(msgId) c_get_val_msgId() const { return msgId; }
const msgId_t &getc_msgId() { return msgId; }
msgId_t &get_msgId() { return msgId; }
void set_msgId(const msgId_t &msgId) { this->msgId = msgId; }
msgId_t c_get_val_msgId() const { return msgId; }

const decltype(msgAck) &getc_msgAck() { return msgAck; }
decltype(msgAck) &get_msgAck() { return msgAck; }
void set_msgAck(const decltype(msgAck) &msgAck) { this->msgAck = msgAck; }
decltype(msgAck) c_get_val_msgAck() const { return msgAck; }
const msgAck_t &getc_msgAck() { return msgAck; }
msgAck_t &get_msgAck() { return msgAck; }
void set_msgAck(const msgAck_t &msgAck) { this->msgAck = msgAck; }
msgAck_t c_get_val_msgAck() const { return msgAck; }

const decltype(sessionId) &getc_sessionId() { return sessionId; }
decltype(sessionId) &get_sessionId() { return sessionId; }
void set_sessionId(const decltype(sessionId) &sessionId) {
const sessionId_t &getc_sessionId() { return sessionId; }
sessionId_t &get_sessionId() { return sessionId; }
void set_sessionId(const sessionId_t &sessionId) {
this->sessionId = sessionId;
}
decltype(sessionId) c_get_val_sessionId() const { return sessionId; }
sessionId_t c_get_val_sessionId() const { return sessionId; }

static bool initMessage() { return false; };
static bool init() { return false; }
Expand Down
2 changes: 1 addition & 1 deletion clkmgr/common/transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ bool Transport::init()
bool Transport::stop()
{
/* Send stop signal to all of the threads */
for(decltype(workerList)::iterator it = workerList.begin();
for(std::vector<TransportWorkerState>::iterator it = workerList.begin();
it != workerList.end(); ++it)
it->exitVal->store(true);
/* Do any transport specific stop */
Expand Down
18 changes: 9 additions & 9 deletions clkmgr/common/transport.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ class TransportContext
TransportContext() : _init(true), offset(0) {}
virtual ~TransportContext() = default;

const decltype(offset) &getc_offset() { return offset; }
decltype(offset) &get_offset() { return offset; }
void set_offset(const decltype(offset) &offset) { this->offset = offset; }
decltype(offset) c_get_val_offset() const { return offset; }
const std::size_t &getc_offset() { return offset; }
std::size_t &get_offset() { return offset; }
void set_offset(const std::size_t &offset) { this->offset = offset; }
std::size_t c_get_val_offset() const { return offset; }

const decltype(buffer) &getc_buffer() { return buffer; }
decltype(buffer) &get_buffer() { return buffer; }
void set_buffer(const decltype(buffer) &buffer) { this->buffer = buffer; }
decltype(buffer) c_get_val_buffer() const { return buffer; }
const TransportBuffer &getc_buffer() { return buffer; }
TransportBuffer &get_buffer() { return buffer; }
void set_buffer(const TransportBuffer &buffer) { this->buffer = buffer; }
TransportBuffer c_get_val_buffer() const { return buffer; }

void resetOffset() { set_offset(0); }
void addOffset(std::size_t offset) { this->offset += offset; }
Expand Down Expand Up @@ -101,7 +101,7 @@ class Transport
static std::vector<TransportWorkerState> workerList;
static void dispatchLoop(
std::promise<FUTURE_TYPEOF(TransportWorkerState::retVal)>,
decltype(TransportWorkerState::exitVal) exitVal,
std::shared_ptr<std::atomic<bool>> exitVal,
TransportWork arg
);
public:
Expand Down

0 comments on commit 7652326

Please sign in to comment.