Skip to content

Commit

Permalink
Clang-Format
Browse files Browse the repository at this point in the history
  • Loading branch information
cmsbuild committed Feb 7, 2020
1 parent 1edbed3 commit 0ba31ec
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 29 deletions.
8 changes: 4 additions & 4 deletions DataFormats/Common/interface/AssociationVector.h
Expand Up @@ -162,17 +162,17 @@ namespace edm {
}

template <typename KeyRefProd, typename CVal, typename KeyRef, typename SizeType, typename KeyReferenceHelper>
inline typename CVal::const_reference AssociationVector<KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper>::
operator[](KeyRef const& k) const {
inline typename CVal::const_reference
AssociationVector<KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper>::operator[](KeyRef const& k) const {
KeyRef keyRef = KeyReferenceHelper::get(k, ref_.id());
checkForWrongProduct(keyRef.id(), ref_.id());
return data_[keyRef.key()];
}

template <typename KeyRefProd, typename CVal, typename KeyRef, typename SizeType, typename KeyReferenceHelper>
template <typename K>
inline typename CVal::const_reference AssociationVector<KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper>::
operator[](edm::Ptr<K> const& k) const {
inline typename CVal::const_reference
AssociationVector<KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper>::operator[](edm::Ptr<K> const& k) const {
static_assert(std::is_base_of<K, key_type>::value,
"edm::Ptr's key type is not a base class of AssociationVector's item type");
checkForWrongProduct(k.id(), ref_.id());
Expand Down
20 changes: 15 additions & 5 deletions DataFormats/Common/test/testMultiAssociation.cc
Expand Up @@ -592,19 +592,27 @@ bool testMultiAssociation::tryBadFill(int i) {
filler.setValues(Ref<CKey2>(handleK2, 0), coll1);
}; break;
case 2: { // fill again with different id
{ MultiRef::FastFiller filler = m.fastFiller(handleK1); }
{
MultiRef::FastFiller filler = m.fastFiller(handleK1);
}
{ MultiRef::FastFiller filler = m.fastFiller(handleK2); }
}; break;
case 3: { // fill again with the same id
{ MultiRef::FastFiller filler = m.fastFiller(handleK1); }
{
MultiRef::FastFiller filler = m.fastFiller(handleK1);
}
{ MultiRef::FastFiller filler = m.fastFiller(handleK1); }
}; break;
case 4: { // Check lazyFiller doesn't fill if not requested
{ MultiRef::LazyFiller filler = m.lazyFiller(handleK1); }
{
MultiRef::LazyFiller filler = m.lazyFiller(handleK1);
}
{ MultiRef::LazyFiller filler = m.lazyFiller(handleK1); }
}; break;
case 5: { // Check lazyFiller can't fill twice the same key if requested
{ MultiRef::LazyFiller filler = m.lazyFiller(handleK1, true); }
{
MultiRef::LazyFiller filler = m.lazyFiller(handleK1, true);
}
{ MultiRef::LazyFiller filler = m.lazyFiller(handleK1, true); }
}; break;
case 6: { // Check lazyFiller doesn't fill twice by mistake
Expand All @@ -615,7 +623,9 @@ bool testMultiAssociation::tryBadFill(int i) {
filler.fill();
}; break;
case 8: { // Check lazyFiller doesn't fill if not requested
{ MultiRef::LazyFiller filler = m.lazyFiller(handleK1, false); }
{
MultiRef::LazyFiller filler = m.lazyFiller(handleK1, false);
}
CPPUNIT_ASSERT(m.empty());
} break;
case 9: { // Check index out of bounds
Expand Down
40 changes: 20 additions & 20 deletions Utilities/XrdAdaptor/src/XrdRequestManager.cc
Expand Up @@ -676,26 +676,26 @@ std::future<IOSize> XrdAdaptor::RequestManager::handle(std::shared_ptr<std::vect
future2 = c_ptr2->get_future();
}
if (!req1->empty() && !req2->empty()) {
std::future<IOSize> task =
std::async(std::launch::deferred,
[](std::future<IOSize> a, std::future<IOSize> b) {
// Wait until *both* results are available. This is essential
// as the callback may try referencing the RequestManager. If one
// throws an exception (causing the RequestManager to be destroyed by
// XrdFile) and the other has a failure, then the recovery code will
// reference the destroyed RequestManager.
//
// Unlike other places where we use shared/weak ptrs to maintain object
// lifetime and destruction asynchronously, we *cannot* destroy the request
// asynchronously as it is associated with a ROOT buffer. We must wait until we
// are guaranteed that XrdCl will not write into the ROOT buffer before we
// can return.
b.wait();
a.wait();
return b.get() + a.get();
},
std::move(future1),
std::move(future2));
std::future<IOSize> task = std::async(
std::launch::deferred,
[](std::future<IOSize> a, std::future<IOSize> b) {
// Wait until *both* results are available. This is essential
// as the callback may try referencing the RequestManager. If one
// throws an exception (causing the RequestManager to be destroyed by
// XrdFile) and the other has a failure, then the recovery code will
// reference the destroyed RequestManager.
//
// Unlike other places where we use shared/weak ptrs to maintain object
// lifetime and destruction asynchronously, we *cannot* destroy the request
// asynchronously as it is associated with a ROOT buffer. We must wait until we
// are guaranteed that XrdCl will not write into the ROOT buffer before we
// can return.
b.wait();
a.wait();
return b.get() + a.get();
},
std::move(future1),
std::move(future2));
timer.stop();
//edm::LogVerbatim("XrdAdaptorInternal") << "Total time to create requests " << static_cast<int>(1000*timer.realTime()) << std::endl;
return task;
Expand Down

0 comments on commit 0ba31ec

Please sign in to comment.