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

Fix compilation error in EventSetup::tryToGet #8802

Merged
merged 1 commit into from Apr 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion FWCore/Framework/interface/EventSetup.h
Expand Up @@ -70,7 +70,7 @@ class EventSetup
BOOST_STATIC_ASSERT((boost::is_base_and_derived<edm::eventsetup::EventSetupRecord, T>::value));
const T* value = nullptr;
eventSetupTryToGetImplementation(*this, value);
return *value;
return value;
}

/** can directly access data if data_default_record_trait<> is defined for this data type **/
Expand Down
17 changes: 17 additions & 0 deletions FWCore/Framework/test/eventsetup_t.cppunit.cc
Expand Up @@ -48,6 +48,7 @@ CPPUNIT_TEST_SUITE(testEventsetup);

CPPUNIT_TEST(constructTest);
CPPUNIT_TEST(getTest);
CPPUNIT_TEST(tryToGetTest);
CPPUNIT_TEST_EXCEPTION(getExcTest,edm::eventsetup::NoRecordException<DummyRecord>);
CPPUNIT_TEST(recordProviderTest);
CPPUNIT_TEST(provenanceTest);
Expand All @@ -74,6 +75,7 @@ CPPUNIT_TEST_SUITE_END();

void constructTest();
void getTest();
void tryToGetTest();
void getExcTest();
void recordProviderTest();
void recordValidityTest();
Expand Down Expand Up @@ -124,6 +126,21 @@ void testEventsetup::getTest()
CPPUNIT_ASSERT(&dummyRecord == &gottenRecord);
}

void testEventsetup::tryToGetTest()
{
eventsetup::EventSetupProvider provider;
EventSetup const& eventSetup = provider.eventSetupForInstance(IOVSyncValue::invalidIOVSyncValue());
CPPUNIT_ASSERT(non_null(&eventSetup));
//eventSetup.get<DummyRecord>();
//CPPUNIT_ASSERT_THROW(eventSetup.get<DummyRecord>(), edm::eventsetup::NoRecordException<DummyRecord>);

DummyRecord dummyRecord;
provider.addRecordToEventSetup(dummyRecord);
const DummyRecord* gottenRecord = eventSetup.tryToGet<DummyRecord>();
CPPUNIT_ASSERT(non_null(gottenRecord));
CPPUNIT_ASSERT(&dummyRecord == gottenRecord);
}

void testEventsetup::getExcTest()
{
eventsetup::EventSetupProvider provider;
Expand Down