Skip to content

Commit

Permalink
Please consider the following formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alibuild committed Feb 23, 2024
1 parent eb21563 commit 8e53ef7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Framework/Core/include/Framework/DataRefUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ struct DataRefUtils {

typename RSS::FairInputTBuffer ftm(const_cast<char*>(ref.payload), payloadSize);
ftm.InitMap();
auto *classInfo = ftm.ReadClass();
auto* classInfo = ftm.ReadClass();
ftm.SetBufferOffset(0);
ftm.ResetMap();
result.reset(static_cast<wrapped*>(ftm.ReadObjectAny(cl)));
Expand Down
8 changes: 4 additions & 4 deletions Framework/Core/include/Framework/TMessageSerializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class FairInputTBuffer : public TBufferFile
// of overhead, where the source embedded the pointer for the reallocation.
// Notice this will break if the sender and receiver are not using the same
// size for a pointer.
FairInputTBuffer(char * data, size_t size)
: TBufferFile(TBuffer::kRead, size-sizeof(char*), data + sizeof(char*), false, nullptr)
FairInputTBuffer(char* data, size_t size)
: TBufferFile(TBuffer::kRead, size - sizeof(char*), data + sizeof(char*), false, nullptr)
{
}
};
Expand All @@ -86,7 +86,7 @@ struct TMessageSerializer {
static void serialize(o2::framework::FairOutputTBuffer& msg, const T* input, const TClass* cl);

template <typename T = TObject>
static inline std::unique_ptr<T> deserialize(FairInputTBuffer & buffer);
static inline std::unique_ptr<T> deserialize(FairInputTBuffer& buffer);
};

inline void TMessageSerializer::serialize(FairOutputTBuffer& tm, const TObject* input)
Expand All @@ -106,7 +106,7 @@ inline void TMessageSerializer::serialize(FairOutputTBuffer& tm, const T* input,
}

template <typename T>
inline std::unique_ptr<T> TMessageSerializer::deserialize(FairInputTBuffer & buffer)
inline std::unique_ptr<T> TMessageSerializer::deserialize(FairInputTBuffer& buffer)
{
TClass* tgtClass = TClass::GetClass(typeid(T));
if (tgtClass == nullptr) {
Expand Down
6 changes: 4 additions & 2 deletions Framework/Core/src/TMessageSerializer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

using namespace o2::framework;

void* FairOutputTBuffer::embedInItself(fair::mq::Message& msg) {
void* FairOutputTBuffer::embedInItself(fair::mq::Message& msg)
{
// The first bytes of the message are used to store the pointer to the message itself
// so that we can reallocate it if needed.
if (sizeof(char*) > msg.GetSize()) {
Expand All @@ -28,7 +29,8 @@ void* FairOutputTBuffer::embedInItself(fair::mq::Message& msg) {
}

// Reallocation function. Get the message pointer from the data and call Rebuild.
char *FairOutputTBuffer::fairMQrealloc(char *oldData, size_t newSize, size_t oldSize) {
char* FairOutputTBuffer::fairMQrealloc(char* oldData, size_t newSize, size_t oldSize)
{
auto* msg = reinterpret_cast<fair::mq::Message*>(oldData - sizeof(char*));
if (newSize <= msg->GetSize()) {
// no need to reallocate, the message is already big enough
Expand Down
7 changes: 4 additions & 3 deletions Framework/Core/test/test_DataRefUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@

using namespace o2::framework;

TEST_CASE("PureRootTest") {
TEST_CASE("PureRootTest")
{
TBufferFile buffer(TBuffer::kWrite);
TObjString s("test");
buffer.WriteObject(&s);

TBufferFile buffer2(TBuffer::kRead, buffer.BufferSize(), buffer.Buffer(), false);
buffer2.SetReadMode();
buffer2.InitMap();
TClass *storedClass = buffer2.ReadClass();
TClass* storedClass = buffer2.ReadClass();
// ReadClass advances the buffer, so we need to reset it.
buffer2.SetBufferOffset(0);
buffer2.ResetMap();
REQUIRE(storedClass != nullptr);
auto *outS = (TObjString*)buffer2.ReadObjectAny(storedClass);
auto* outS = (TObjString*)buffer2.ReadObjectAny(storedClass);
REQUIRE(outS != nullptr);
REQUIRE(outS->GetString() == "test");
}
Expand Down

0 comments on commit 8e53ef7

Please sign in to comment.