Skip to content

Commit

Permalink
Removed logging when objects are constructed and destructed
Browse files Browse the repository at this point in the history
Changed from c-style casting to c++-style.
  • Loading branch information
permobergedge committed Dec 4, 2024
1 parent 3f72183 commit 6811413
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 127 deletions.
223 changes: 108 additions & 115 deletions ElasticFrameProtocol.cpp

Large diffs are not rendered by default.

16 changes: 7 additions & 9 deletions ElasticFrameProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <vector>
#include <iostream>
#include <sstream>
#include <climits>
#include <cmath>
#include <thread>
#include <map>
Expand All @@ -46,7 +45,6 @@
#include <bitset>
#include <mutex>
#include <atomic>
#include <algorithm>
#include <deque>
#include <condition_variable>
#include <chrono>
Expand Down Expand Up @@ -75,8 +73,9 @@ extern "C" {
#define PRIORITY_P3 0b01100000 // God-mode priority (not implemented)
#define UNDEFINED_FLAG 0b10000000 // TBD

#define EFP_MAJOR_VERSION 0
#define EFP_MINOR_VERSION 4
constexpr uint8_t EFP_MAJOR_VERSION = 0;
constexpr uint8_t EFP_MINOR_VERSION = 4;
constexpr uint16_t EFP_VERSION = static_cast<uint16_t>(EFP_MAJOR_VERSION) << 8 | EFP_MINOR_VERSION;

// Bitwise operations are used on members therefore the namespace is wrapping enum instead of 'enum class'
/// Definition of the data types supported by EFP
Expand Down Expand Up @@ -220,7 +219,7 @@ class ElasticFrameProtocolSender {
virtual ~ElasticFrameProtocolSender();

///Return the version of the current implementation (Uint16)((8 MSB Major) + (8 LSB Minor))
uint16_t getVersion() { return ((uint16_t)EFP_MAJOR_VERSION << 8) | (uint16_t)EFP_MINOR_VERSION; }
static uint16_t getVersion() { return EFP_VERSION; }

/**
* Converts the original data from a vector to EFP packets/fragments
Expand Down Expand Up @@ -343,7 +342,7 @@ class ElasticFrameProtocolSender {
private:
//Private methods ----- START ------
// Used by the C - API
void sendData(const std::vector<uint8_t> &rSubPacket, uint8_t lStreamID, ElasticFrameProtocolContext* pCTX);
void sendData(const std::vector<uint8_t> &rSubPacket, uint8_t lStreamID, ElasticFrameProtocolContext* pCTX) const;
//Private methods ----- END ------

// Internal lists and variables ----- START ------
Expand Down Expand Up @@ -439,8 +438,7 @@ class ElasticFrameProtocolReceiver {
virtual ~ElasticFrameProtocolReceiver();

///Return the version of the current implementation
uint16_t getVersion() { return ((uint16_t)EFP_MAJOR_VERSION << 8) | (uint16_t)EFP_MINOR_VERSION; }

static uint16_t getVersion() { return EFP_VERSION; }
/**
* Function assembling received fragments from a vector
*
Expand Down Expand Up @@ -593,7 +591,7 @@ class ElasticFrameProtocolReceiver {
ElasticFrameMessages stopReceiver();

// C-API callback. If C++ is used this is a dummy callback
void gotData(pFramePtr &rPacket, ElasticFrameProtocolContext* pCTX);
void gotData(pFramePtr &rPacket, ElasticFrameProtocolContext* pCTX) const;

// Method unpacking Type1 fragments
ElasticFrameMessages unpackType1(const uint8_t *pSubPacket, size_t lPacketSize, uint8_t lFromSource);
Expand Down
4 changes: 2 additions & 2 deletions logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if (g == (LOGG_NOTIFY & (LOGG_MASK))) {a << "Notification: ";} \
else if (g == (LOGG_WARN & (LOGG_MASK))) {a << "Warning: ";} \
else if (g == (LOGG_ERROR & (LOGG_MASK))) {a << "Error: ";} \
else if (g == (LOGG_FATAL & (LOGG_MASK))) {a << "Fatal: ";} \
if (a.str().length()) { \
if (!a.str().empty()) { \
if (l) {a << __FILE__ << " " << __LINE__ << " ";} \
a << f << std::endl; \
std::cout << a.str(); \
Expand All @@ -31,4 +31,4 @@ std::cout << a.str(); \
#define EFP_LOGGER(l,g,f)
#endif

#endif
#endif
1 change: 1 addition & 0 deletions unitTests/UnitTest14.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <gtest/gtest.h>

#include <algorithm>
#include <memory>

#include "ElasticFrameProtocol.h"
Expand Down
1 change: 1 addition & 0 deletions unitTests/UnitTest15.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <gtest/gtest.h>

#include <algorithm>
#include <memory>

#include "ElasticFrameProtocol.h"
Expand Down
1 change: 1 addition & 0 deletions unitTests/UnitTest16.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <gtest/gtest.h>

#include <algorithm>
#include <memory>
#include <random>

Expand Down
1 change: 1 addition & 0 deletions unitTests/UnitTest17.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <gtest/gtest.h>

#include <algorithm>
#include <memory>

#include "ElasticFrameProtocol.h"
Expand Down
1 change: 1 addition & 0 deletions unitTests/UnitTest19.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <gtest/gtest.h>

#include <algorithm>
#include <memory>

#include "ElasticFrameProtocol.h"
Expand Down
1 change: 1 addition & 0 deletions unitTests/UnitTest21.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <gtest/gtest.h>

#include <algorithm>
#include <memory>

#include "ElasticFrameProtocol.h"
Expand Down
3 changes: 2 additions & 1 deletion unitTests/UnitTest22.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <gtest/gtest.h>

#include <algorithm>
#include <memory>

#include "ElasticFrameProtocol.h"
Expand Down Expand Up @@ -93,4 +94,4 @@ TEST(UnitTest22, HeadOfLineBlocking) {
}

EXPECT_EQ(dataReceived.load(), 4);
}
}
1 change: 1 addition & 0 deletions unitTests/UnitTest5.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <gtest/gtest.h>

#include <algorithm>
#include <memory>

#include "ElasticFrameProtocol.h"
Expand Down
1 change: 1 addition & 0 deletions unitTests/UnitTest6.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <gtest/gtest.h>

#include <algorithm>
#include <memory>

#include "ElasticFrameProtocol.h"
Expand Down
1 change: 1 addition & 0 deletions unitTests/UnitTest9.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <gtest/gtest.h>

#include <algorithm>
#include <memory>

#include "ElasticFrameProtocol.h"
Expand Down

0 comments on commit 6811413

Please sign in to comment.