From 8e201d18a88d4cf4ca1163c32bdc2400c28ead8d Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 23 Dec 2010 14:23:31 +0000 Subject: a few more EPA tweaks (from 2.X) git-svn-id: svn://localhost/ardour2/branches/3.0@8340 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/pbd/epa.cc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'libs/pbd/epa.cc') diff --git a/libs/pbd/epa.cc b/libs/pbd/epa.cc index 71387b4c23..8665823d77 100644 --- a/libs/pbd/epa.cc +++ b/libs/pbd/epa.cc @@ -29,14 +29,25 @@ using namespace std; EnvironmentalProtectionAgency* EnvironmentalProtectionAgency::_global_epa = 0; -EnvironmentalProtectionAgency::EnvironmentalProtectionAgency () +EnvironmentalProtectionAgency::EnvironmentalProtectionAgency (bool arm) + : _armed (arm) { - save (); + if (_armed) { + save (); + } } EnvironmentalProtectionAgency::~EnvironmentalProtectionAgency() { - restore (); + if (_armed) { + restore (); + } +} + +void +EnvironmentalProtectionAgency::arm () +{ + _armed = true; } void @@ -63,9 +74,9 @@ EnvironmentalProtectionAgency::save () } } void -EnvironmentalProtectionAgency::restore () +EnvironmentalProtectionAgency::restore () const { - for (map::iterator i = e.begin(); i != e.end(); ++i) { + for (map::const_iterator i = e.begin(); i != e.end(); ++i) { cerr << "Restore [" << i->first << "] = " << i->second << endl; setenv (i->first.c_str(), i->second.c_str(), 1); } -- cgit v1.2.3