Add identity_traits<condition_variable>, add macro for opaque identities

develop
lethosor 2023-05-29 01:09:59 -04:00
parent eb12ff17f6
commit 2f42745175
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
2 changed files with 12 additions and 10 deletions

@ -40,6 +40,7 @@ namespace df {
stl_bit_vector_identity identity_traits<std::vector<bool> >::identity;
bit_array_identity identity_traits<BitArray<int> >::identity;
STL_OPAQUE_IDENTITY_TRAITS(condition_variable);
STL_OPAQUE_IDENTITY_TRAITS(fstream);
STL_OPAQUE_IDENTITY_TRAITS(mutex);

@ -24,6 +24,7 @@ distribution.
#pragma once
#include <condition_variable>
#include <deque>
#include <map>
#include <mutex>
@ -542,6 +543,12 @@ namespace df
#define INTEGER_IDENTITY_TRAITS(type) NUMBER_IDENTITY_TRAITS(integer, type)
#define FLOAT_IDENTITY_TRAITS(type) NUMBER_IDENTITY_TRAITS(float, type)
#define OPAQUE_IDENTITY_TRAITS(type) \
template<> struct DFHACK_EXPORT identity_traits<type> { \
static opaque_identity identity; \
static opaque_identity *get() { return &identity; } \
};
INTEGER_IDENTITY_TRAITS(char);
INTEGER_IDENTITY_TRAITS(signed char);
INTEGER_IDENTITY_TRAITS(unsigned char);
@ -555,6 +562,9 @@ namespace df
INTEGER_IDENTITY_TRAITS(unsigned long long);
FLOAT_IDENTITY_TRAITS(float);
FLOAT_IDENTITY_TRAITS(double);
OPAQUE_IDENTITY_TRAITS(std::condition_variable);
OPAQUE_IDENTITY_TRAITS(std::fstream);
OPAQUE_IDENTITY_TRAITS(std::mutex);
template<> struct DFHACK_EXPORT identity_traits<bool> {
static bool_identity identity;
@ -566,16 +576,6 @@ namespace df
static stl_string_identity *get() { return &identity; }
};
template<> struct DFHACK_EXPORT identity_traits<std::fstream> {
static opaque_identity identity;
static opaque_identity *get() { return &identity; }
};
template<> struct DFHACK_EXPORT identity_traits<std::mutex> {
static opaque_identity identity;
static opaque_identity *get() { return &identity; }
};
template<> struct DFHACK_EXPORT identity_traits<char*> {
static ptr_string_identity identity;
static ptr_string_identity *get() { return &identity; }
@ -604,6 +604,7 @@ namespace df
#undef NUMBER_IDENTITY_TRAITS
#undef INTEGER_IDENTITY_TRAITS
#undef FLOAT_IDENTITY_TRAITS
#undef OPAQUE_IDENTITY_TRAITS
// Container declarations