Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development of the generic format API #110

Closed
wants to merge 13 commits into from

Conversation

matthiasrichter
Copy link
Collaborator

I have collapsed my development of a mockup for the format API, the final data header is not part of this development but is in the fork of @mkrzwic . We will soon merge it.

The update concludes the discussion in the CWG4 meeting
Introducing template parameters for the header message and the payload message.
Correcting some typos.
The test is to first extend a compilation check and can be later
extended to a unit test
Creating new module 'DataFormats' on top level. The recent development
regarding data formats goes into DataFormats/Generic.
The original header definition has served as basis for the discussion,
the final definition has been developed elsewhere and is soon to be
merged. The very early definition is temporarily kept for the unit test.
@MohammadAlTurany
Copy link
Contributor

MohammadAlTurany commented Apr 19, 2016

Hi Matthias,
The test crashes with:

* thread #1: tid = 0x597d9, 0x0000000100001f7f testMessageList`void print_list<AliceO2::Format::messageList<TestMsg, SimpleHeader_t> >(list=<unavailable>, hdrsel=<unavailable>) + 191 at testMessageList.cxx:77, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x0000000100001f7f testMessageList`void print_list<AliceO2::Format::messageList<TestMsg, SimpleHeader_t> >(list=<unavailable>, hdrsel=<unavailable>) + 191 at testMessageList.cxx:77
   74          it != list.end();
   75          ++it) {
   76       // the iterator defines a conversion operator to the header type
-> 77       std::cout << static_cast<typename ListType::header_type>(it) << std::end;
   78       // dereferencing of the iterator gives the payload
   79       std::cout << *it << std::end;
   80     }

@matthiasrichter
Copy link
Collaborator Author

Hi Mohammad,
seems that I have been using static_cast in an inappropriate way to invoke the type cast operator. On some architectures it works, but it's undefined, what takes precedence.

I have pushed a fix to my dev branch and it looks like it automatically appears in the PR (cool ;-). Could you please try again.

Ciao
Matthias

@MohammadAlTurany
Copy link
Contributor

Hi Matthias,

Still crashing on MAC,

Process 85821 launched: '/Users/turany/fairsoft/releases/src/AliceO2/build/bin/testMessageList' (x86_64)
simple list:
Header ID: 1
Process 85821 stopped
* thread #1: tid = 0x6dab31, 0x000000010000267f testMessageList`void print_list<AliceO2::Format::messageList<unsigned char const*, SimpleHeader_t> >(list=<unavailable>, hdrsel=<unavailable>) + 191 at testMessageList.cxx:78, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x000000010000267f testMessageList`void print_list<AliceO2::Format::messageList<unsigned char const*, SimpleHeader_t> >(list=<unavailable>, hdrsel=<unavailable>) + 191 at testMessageList.cxx:78
   75          ++it) {
   76       // the iterator defines a conversion operator to the header type
   77       typename ListType::header_type hdr = it;
-> 78       std::cout << hdr << std::endl;
   79       // dereferencing of the iterator gives the payload
   80       std::cout << *it << std::endl;
   81     }

@MohammadAlTurany
Copy link
Contributor

Hi Matthias,

it crashes in the line:

stream << "Header Specification: " << std::hex << header.specification;

When using clang, writing to output stream caused segmentation violation
because the stream object was not returned by the operator which has been
used just before.
Adding also some other return statements (though irrelevant for the crash).

Crash log
* thread #1: tid = 0x597d9, 0x0000000100001f7f testMessageList`void print_list<AliceO2::Format::messageList<TestMsg, SimpleHeader_t> >(list=<unavailable>, hdrsel=<unavailable>) + 191 at testMessageList.cxx:77, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x0000000100001f7f testMessageList`void print_list<AliceO2::Format::messageList<TestMsg, SimpleHeader_t> >(list=<unavailable>, hdrsel=<unavailable>) + 191 at testMessageList.cxx:77
   74          it != list.end();
   75          ++it) {
   76       // the iterator defines a conversion operator to the header type
-> 77       std::cout << static_cast<typename ListType::header_type>(it) << std::end;
   78       // dereferencing of the iterator gives the payload
   79       std::cout << *it << std::end;
   80     }
@matthiasrichter
Copy link
Collaborator Author

Hi Mohammad,
in the end, it was much simpler: a missing return statement in the custom ostream operator<<. Fix is pushed, the previous one is removed. I tested also with clang. I hope its working now.

Ciao
Matthias

@MohammadAlTurany
Copy link
Contributor

Hi Matthias,
Thanks, now it works! it is merged with the dev.
best,
Mohammad

@matthiasrichter
Copy link
Collaborator Author

Hi Mohammad,
very good. But I just noticed that the first attempt also is merged now, even though it was not part of the PR.

Cheers
Matthias

knopers8 added a commit to knopers8/AliceO2 that referenced this pull request Sep 7, 2020
EmilGorm pushed a commit to EmilGorm/AliceO2 that referenced this pull request Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants