From 08543f8a8c9ae9d6f062af86b3de6ff453118b18 Mon Sep 17 00:00:00 2001 From: Scott Snyder <scott.snyder@cern.ch> Date: Tue, 24 Jan 2017 19:41:13 +0100 Subject: [PATCH] Add ignore argument to insertMove. (AthContainersInterfaces-00-01-42) * Tagging AthContainersInterfaces-00-01-42. * AthContainersInterfaces/IAuxStore.h: Add ignore argument to insertMove. * Tagging AthContainersInterfaces-00-01-41. * AthContainersInterfaces/IAuxStore.h, AthContainersInterfaces/IAuxTypeVector.h: Add insertMove operation. --- .../AthContainersInterfaces/IAuxStore.h | 27 ++++++++++++++++++- .../AthContainersInterfaces/IAuxTypeVector.h | 25 ++++++++++++++++- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/Control/AthContainersInterfaces/AthContainersInterfaces/IAuxStore.h b/Control/AthContainersInterfaces/AthContainersInterfaces/IAuxStore.h index fe2a090a6a6..f83ad59fc37 100644 --- a/Control/AthContainersInterfaces/AthContainersInterfaces/IAuxStore.h +++ b/Control/AthContainersInterfaces/AthContainersInterfaces/IAuxStore.h @@ -4,7 +4,7 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -// $Id: IAuxStore.h 793235 2017-01-20 16:57:37Z ssnyder $ +// $Id: IAuxStore.h 793731 2017-01-24 19:41:13Z ssnyder $ /** * @file AthContainersInterfaces/IAuxStore.h * @author scott snyder <snyder@bnl.gov> @@ -138,6 +138,31 @@ public: virtual void shift (size_t pos, ptrdiff_t offs) = 0; + /** + * @brief Move all elements from @c other to this store. + * @param pos The starting index of the insertion. + * @param other Store from which to do the move. + * @param ignore Set of variables that should not be added to the store. + * + * Let @c len be the size of @c other. The store will be increased + * in size by @c len elements, with the elements at @c pos being + * copied to @c pos+len. Then, for each auxiliary variable, the + * entire contents of that variable for @c other will be moved to + * this store at index @c pos. This will be done via move semantics + * if possible; otherwise, it will be done with a copy. Variables + * present in this store but not in @c other will have the corresponding + * elements default-initialized. Variables in @c other but not in this + * store will be added unless they are in @c ignore. + * + * Returns true if it is known that none of the vectors' memory moved, + * false otherwise. + */ + virtual bool insertMove (size_t pos, + IAuxStore& other, + const SG::auxid_set_t& ignore = SG::auxid_set_t()) + = 0; + + /** * @brief Set an option for a given auxiliary variable. * @param auxid The identifier of the desired aux data item. diff --git a/Control/AthContainersInterfaces/AthContainersInterfaces/IAuxTypeVector.h b/Control/AthContainersInterfaces/AthContainersInterfaces/IAuxTypeVector.h index ff211aebfb1..96f939a57d5 100644 --- a/Control/AthContainersInterfaces/AthContainersInterfaces/IAuxTypeVector.h +++ b/Control/AthContainersInterfaces/AthContainersInterfaces/IAuxTypeVector.h @@ -4,7 +4,7 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -// $Id: IAuxTypeVector.h 793235 2017-01-20 16:57:37Z ssnyder $ +// $Id: IAuxTypeVector.h 793692 2017-01-24 16:27:09Z ssnyder $ /** * @file AthContainersInterfaces/IAuxTypeVector.h * @author scott snyder <snyder@bnl.gov> @@ -108,6 +108,29 @@ public: virtual void shift (size_t pos, ptrdiff_t offs) = 0; + /** + * @brief Insert elements into the vector via move semantics. + * @param pos The starting index of the insertion. + * @param beg Start of the range of elements to insert. + * @param end End of the range of elements to insert. + * + * @c beg and @c end define a range of container elements, with length + * @c len defined by the difference of the pointers divided by the + * element size. + * + * The size of the container will be increased by @c len, with the elements + * starting at @c pos copied to @c pos+len. + * + * The contents of the @c beg:end range will then be moved to our vector + * starting at @c pos. This will be done via move semantics if possible; + * otherwise, it will be done with a copy. + * + * Returns true if it is known that the vector's memory did not move, + * false otherwise. + */ + virtual bool insertMove (size_t pos, void* beg, void* end) = 0; + + /** * @brief Set an option for this variable. * @param option The option to set. -- GitLab