clang-format
This commit is contained in:
@@ -19,18 +19,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdexcept>
|
||||
#include <pthread.h>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
#include <pthread.h>
|
||||
|
||||
namespace utils
|
||||
{
|
||||
template<typename... Args>
|
||||
std::thread named_thread(const std::string& name, Args&&... args)
|
||||
template <typename... Args>
|
||||
std::thread named_thread(const std::string & name, Args &&... args)
|
||||
{
|
||||
std::thread t{std::forward<Args>(args)...};
|
||||
pthread_setname_np(t.native_handle(), name.substr(0, 15).c_str());
|
||||
return t;
|
||||
}
|
||||
}
|
||||
} // namespace utils
|
||||
|
||||
@@ -56,7 +56,6 @@ public:
|
||||
read_index.store(next_read);
|
||||
return std::move(res);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace utils
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include <cassert>
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
class singleton
|
||||
{
|
||||
// static_assert(std::derived_from<T, singleton<T>>);
|
||||
@@ -32,7 +32,7 @@ protected:
|
||||
singleton()
|
||||
{
|
||||
assert(instance_ == nullptr);
|
||||
instance_ = reinterpret_cast<T*>(this);
|
||||
instance_ = reinterpret_cast<T *>(this);
|
||||
}
|
||||
|
||||
~singleton()
|
||||
@@ -41,15 +41,16 @@ protected:
|
||||
instance_ = nullptr;
|
||||
}
|
||||
|
||||
singleton(const singleton&) = delete;
|
||||
singleton& operator=(const singleton&) = delete;
|
||||
singleton(const singleton &) = delete;
|
||||
singleton & operator=(const singleton &) = delete;
|
||||
|
||||
public:
|
||||
static T & instance()
|
||||
{
|
||||
assert(instance_ != nullptr);
|
||||
return *reinterpret_cast<T*>(instance_);
|
||||
return *reinterpret_cast<T *>(instance_);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> T * singleton<T>::instance_;
|
||||
template <typename T>
|
||||
T * singleton<T>::instance_;
|
||||
|
||||
@@ -57,13 +57,13 @@ public:
|
||||
auto userdata_first()
|
||||
{
|
||||
using F = decltype(std::function(impl));
|
||||
return details::add_void<F>::template fn_0<T>;
|
||||
return ::details::add_void<F>::template fn_0<T>;
|
||||
}
|
||||
|
||||
operator auto()
|
||||
{
|
||||
using F = decltype(std::function(impl));
|
||||
return details::add_void<F>::template fn<T>;
|
||||
return ::details::add_void<F>::template fn<T>;
|
||||
}
|
||||
|
||||
operator void *()
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <filesystem>
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
|
||||
std::filesystem::path xdg_config_home()
|
||||
{
|
||||
|
||||
+5
-6
@@ -1,13 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "wivrn_serialization.h"
|
||||
#include "wivrn_packets.h"
|
||||
|
||||
#include "wivrn_serialization.h"
|
||||
|
||||
namespace xrt::drivers::wivrn
|
||||
{
|
||||
using protocol = std::variant<from_headset::packets, to_headset::packets>;
|
||||
using protocol = std::variant<from_headset::packets, to_headset::packets>;
|
||||
|
||||
extern const char git_version[];
|
||||
static inline const constinit auto protocol_version = serialization_type_hash<protocol>();
|
||||
}
|
||||
extern const char git_version[];
|
||||
static inline const constinit auto protocol_version = serialization_type_hash<protocol>();
|
||||
} // namespace xrt::drivers::wivrn
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
#include "vk_allocator.h"
|
||||
#include "vk_mem_alloc.h"
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
#include <cstdint>
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
|
||||
template <typename T>
|
||||
struct basic_allocation_traits
|
||||
|
||||
@@ -7,5 +7,4 @@
|
||||
// printf("\n"); \
|
||||
// } while(false)
|
||||
|
||||
|
||||
#include "vk_mem_alloc.h"
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
#include <span>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
#include <openxr/openxr.h>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
#include "wivrn_serialization_types.h"
|
||||
|
||||
|
||||
@@ -29,12 +29,12 @@ namespace xrt::drivers::wivrn
|
||||
struct data_holder
|
||||
{
|
||||
data_holder() = default;
|
||||
data_holder(const data_holder&) = delete;
|
||||
data_holder(data_holder&&) = default;
|
||||
data_holder& operator=(const data_holder&) = delete;
|
||||
data_holder& operator=(data_holder&&) = default;
|
||||
data_holder(const data_holder &) = delete;
|
||||
data_holder(data_holder &&) = default;
|
||||
data_holder & operator=(const data_holder &) = delete;
|
||||
data_holder & operator=(data_holder &&) = default;
|
||||
|
||||
std::vector<uint8_t> c;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace xrt::drivers::wivrn
|
||||
|
||||
@@ -51,4 +51,4 @@ struct test
|
||||
float y;
|
||||
};
|
||||
static_assert(serialization_type_hash<test>() == hash("structure{int32,float32}"));
|
||||
} // namespace unit_tests
|
||||
} // namespace
|
||||
|
||||
+12
-9
@@ -23,10 +23,10 @@
|
||||
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
#include <exception>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <netinet/ip.h>
|
||||
#include <exception>
|
||||
#include <span>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@@ -71,9 +71,10 @@ protected:
|
||||
|
||||
public:
|
||||
fd_base() = default;
|
||||
fd_base(int fd): fd{fd} {}
|
||||
fd_base(int fd) :
|
||||
fd{fd} {}
|
||||
fd_base(fd_base &&);
|
||||
fd_base& operator=(fd_base &&);
|
||||
fd_base & operator=(fd_base &&);
|
||||
~fd_base();
|
||||
|
||||
int get_fd() const
|
||||
@@ -162,17 +163,19 @@ template <class T, class Tuple>
|
||||
struct Index;
|
||||
|
||||
template <class T, class... Types>
|
||||
struct Index<T, std::tuple<T, Types...>> {
|
||||
static const std::size_t value = 0;
|
||||
struct Index<T, std::tuple<T, Types...>>
|
||||
{
|
||||
static const std::size_t value = 0;
|
||||
};
|
||||
|
||||
template <class T, class U, class... Types>
|
||||
struct Index<T, std::tuple<U, Types...>> {
|
||||
static const std::size_t value = 1 + Index<T, std::tuple<Types...>>::value;
|
||||
struct Index<T, std::tuple<U, Types...>>
|
||||
{
|
||||
static const std::size_t value = 1 + Index<T, std::tuple<Types...>>::value;
|
||||
};
|
||||
}
|
||||
} // namespace details
|
||||
|
||||
template <typename Socket, typename ReceivedType, typename ...VariantTypes>
|
||||
template <typename Socket, typename ReceivedType, typename... VariantTypes>
|
||||
class typed_socket<Socket, ReceivedType, std::variant<VariantTypes...>> : public Socket
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user