|
|
@ -279,25 +279,31 @@ namespace openssl { |
|
|
|
|
|
|
|
|
|
|
|
//! Scoped Engine Registry
|
|
|
|
//! Scoped Engine Registry
|
|
|
|
/*! Engine will be deregistered and freed at destruction */ |
|
|
|
/*! Engine will be deregistered and freed at destruction */ |
|
|
|
class RegisterEngine { |
|
|
|
template <class ENGINE=Engine> class RegisterEngine { |
|
|
|
public: |
|
|
|
public: |
|
|
|
RegisterEngine(Engine* e): _e(e) { |
|
|
|
RegisterEngine(ENGINE* e = 0): _e(e) { |
|
|
|
if (_e) EngineMapper::add(_e); |
|
|
|
if (_e) EngineMapper::add(_e); |
|
|
|
} |
|
|
|
} |
|
|
|
~RegisterEngine() { |
|
|
|
~RegisterEngine() { |
|
|
|
if (_e) EngineMapper::remove(_e); |
|
|
|
if (_e) EngineMapper::remove(_e); |
|
|
|
} |
|
|
|
} |
|
|
|
operator Engine*() { |
|
|
|
RegisterEngine& operator=(ENGINE* e) { |
|
|
|
|
|
|
|
if (_e) EngineMapper::remove(_e); |
|
|
|
|
|
|
|
_e = e; |
|
|
|
|
|
|
|
if (_e) EngineMapper::add(_e); |
|
|
|
|
|
|
|
return *this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
operator ENGINE*() { |
|
|
|
return _e; |
|
|
|
return _e; |
|
|
|
} |
|
|
|
} |
|
|
|
Engine* operator->() { |
|
|
|
ENGINE* operator->() { |
|
|
|
return _e; |
|
|
|
return _e; |
|
|
|
} |
|
|
|
} |
|
|
|
Engine& operator*() { |
|
|
|
ENGINE& operator*() { |
|
|
|
return *_e; |
|
|
|
return *_e; |
|
|
|
} |
|
|
|
} |
|
|
|
private: |
|
|
|
private: |
|
|
|
Engine* _e; |
|
|
|
ENGINE* _e; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
//@}
|
|
|
|
//@}
|
|
|
|