Motorcortex Core  version: 2.7.6
scope_guard.h
1 /*
2  * Developer : Alexey Zakharov (alexey.zakharov@vectioneer.com)
3  * All rights reserved. Copyright (c) 2020 VECTIONEER.
4  */
5 
6 #ifndef MOTORCORTEX_LICENSE_SCOPE_GUARD_H
7 #define MOTORCORTEX_LICENSE_SCOPE_GUARD_H
8 
9 #include <mbedtls/x509_crt.h>
10 
11 namespace mcx {
12 
13 namespace license {
14 
15 class ScopeGuard {
16 public:
17  explicit ScopeGuard(mbedtls_x509_crt& crt) : crt_{crt} {}
18 
19  ~ScopeGuard() { mbedtls_x509_crt_free(&crt_); }
20 
21 private:
22  mbedtls_x509_crt& crt_;
23 };
24 
25 } // namespace license
26 
27 } // namespace mcx
28 
29 #endif // MOTORCORTEX_LICENSE_SCOPE_GUARD_H
mcx::license::ScopeGuard
Definition: scope_guard.h:15