File tree Expand file tree Collapse file tree 3 files changed +230
-177
lines changed Expand file tree Collapse file tree 3 files changed +230
-177
lines changed Original file line number Diff line number Diff line change 58
58
59
59
#include "opencv2/hal/defs.h"
60
60
61
+ #define OPENCV_ABI_COMPATIBILITY 300
62
+
61
63
#ifdef __OPENCV_BUILD
62
64
# define DISABLE_OPENCV_24_COMPATIBILITY
63
65
#endif
Original file line number Diff line number Diff line change @@ -513,30 +513,42 @@ class CV_EXPORTS AutoLock
513
513
AutoLock& operator = (const AutoLock&);
514
514
};
515
515
516
+ // TLS interface
516
517
class CV_EXPORTS TLSDataContainer
517
518
{
518
- private:
519
- int key_;
520
519
protected:
521
520
TLSDataContainer ();
522
521
virtual ~TLSDataContainer ();
522
+
523
+ #if OPENCV_ABI_COMPATIBILITY > 300
524
+ void * getData () const ;
525
+ void release ();
526
+
527
+ private:
528
+ #else
529
+ void release ();
530
+
523
531
public:
532
+ void * getData () const ;
533
+ #endif
524
534
virtual void * createDataInstance () const = 0;
525
- virtual void deleteDataInstance (void * data ) const = 0;
535
+ virtual void deleteDataInstance (void * pData ) const = 0;
526
536
527
- void * getData () const ;
537
+ int key_ ;
528
538
};
529
539
540
+ // Main TLS data class
530
541
template <typename T>
531
542
class TLSData : protected TLSDataContainer
532
543
{
533
544
public:
534
- inline TLSData () {}
535
- inline ~TLSData () {}
536
- inline T* get () const { return (T*)getData (); }
545
+ inline TLSData () {}
546
+ inline ~TLSData () { release (); } // Release key and delete associated data
547
+ inline T* get () const { return (T*)getData (); } // Get data assosiated with key
548
+
537
549
private:
538
- virtual void * createDataInstance () const { return new T; }
539
- virtual void deleteDataInstance (void * data ) const { delete (T*)data; }
550
+ virtual void * createDataInstance () const {return new T;} // Wrapper to allocate data by template
551
+ virtual void deleteDataInstance (void * pData ) const {delete (T*)pData;} // Wrapper to release data by template
540
552
};
541
553
542
554
/* * @brief Designed for command line parsing
You can’t perform that action at this time.
0 commit comments