Skip to content

Commit

Permalink
Merge pull request #489 from micro-manager/allow-cpp17-device-adapters
Browse files Browse the repository at this point in the history
MMDevice: Allow compilation with C++17
  • Loading branch information
marktsuchida authored Sep 4, 2024
2 parents 138684c + c7f0b10 commit 3db33f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 23 deletions.
4 changes: 2 additions & 2 deletions MMDevice/DeviceBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -1562,7 +1562,7 @@ class CCameraBase : public CDeviceBase<MM::Camera, U>
virtual long GetNumberOfImages() {return thd_->GetNumberOfImages();}

// called from the thread function before exit
virtual void OnThreadExiting() throw()
virtual void OnThreadExiting()
{
try
{
Expand Down Expand Up @@ -1668,7 +1668,7 @@ class CCameraBase : public CDeviceBase<MM::Camera, U>
void UpdateActualDuration() {actualDuration_ = camera_->GetCurrentMMTime() - startTime_;}

private:
virtual int svc(void) throw()
virtual int svc()
{
int ret=DEVICE_ERR;
try
Expand Down
29 changes: 8 additions & 21 deletions MMDevice/ImageMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@

#pragma once

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4290) // 'C++ exception specification ignored'
#endif

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
// 'dynamic exception specifications are deprecated in C++11 [-Wdeprecated]'
#pragma GCC diagnostic ignored "-Wdeprecated"
#endif

#include "MMDeviceConstants.h"

#include <string>
Expand All @@ -42,6 +31,12 @@
#include <stdio.h>
#include <stdlib.h>

#ifdef SWIG
#define MMDEVICE_LEGACY_THROW(ex) throw (ex)
#else
#define MMDEVICE_LEGACY_THROW(ex)
#endif

///////////////////////////////////////////////////////////////////////////////
// MetadataError
// -------------
Expand Down Expand Up @@ -326,14 +321,14 @@ class Metadata
return false;
}

MetadataSingleTag GetSingleTag(const char* key) const throw (MetadataKeyError)
MetadataSingleTag GetSingleTag(const char* key) const MMDEVICE_LEGACY_THROW(MetadataKeyError)
{
MetadataTag* tag = FindTag(key);
const MetadataSingleTag* stag = tag->ToSingleTag();
return *stag;
}

MetadataArrayTag GetArrayTag(const char* key) const throw (MetadataKeyError)
MetadataArrayTag GetArrayTag(const char* key) const MMDEVICE_LEGACY_THROW(MetadataKeyError)
{
MetadataTag* tag = FindTag(key);
const MetadataArrayTag* atag = tag->ToArrayTag();
Expand Down Expand Up @@ -499,11 +494,3 @@ class Metadata
typedef std::map<std::string, MetadataTag*>::iterator TagIter;
typedef std::map<std::string, MetadataTag*>::const_iterator TagConstIter;
};

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif

0 comments on commit 3db33f6

Please sign in to comment.