EnumParseOverflowContainer.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
  3. * SPDX-License-Identifier: Apache-2.0.
  4. */
  5. #include <aws/core/utils/EnumParseOverflowContainer.h>
  6. #include <aws/core/utils/logging/LogMacros.h>
  7. using namespace Aws::Utils;
  8. using namespace Aws::Utils::Threading;
  9. static const char LOG_TAG[] = "EnumParseOverflowContainer";
  10. const Aws::String& EnumParseOverflowContainer::RetrieveOverflow(int hashCode) const
  11. {
  12. ReaderLockGuard guard(m_overflowLock);
  13. auto foundIter = m_overflowMap.find(hashCode);
  14. if (foundIter != m_overflowMap.end())
  15. {
  16. AWS_LOGSTREAM_DEBUG(LOG_TAG, "Found value " << foundIter->second << " for hash " << hashCode << " from enum overflow container.");
  17. return foundIter->second;
  18. }
  19. AWS_LOGSTREAM_ERROR(LOG_TAG, "Could not find a previously stored overflow value for hash " << hashCode << ". This will likely break some requests.");
  20. return m_emptyString;
  21. }
  22. void EnumParseOverflowContainer::StoreOverflow(int hashCode, const Aws::String& value)
  23. {
  24. WriterLockGuard guard(m_overflowLock);
  25. AWS_LOGSTREAM_WARN(LOG_TAG, "Encountered enum member " << value << " which is not modeled in your clients. You should update your clients when you get a chance.");
  26. m_overflowMap[hashCode] = value;
  27. }