feat: Implement CUDA support for VoxRaytracer, add CUDA tests for voxel image operations, and update CMake to enable CUDA compilation.
This commit is contained in:
119
src/Core/Uuid.h
119
src/Core/Uuid.h
@@ -23,69 +23,49 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
|
||||
#ifndef U_CORE_UUID_H
|
||||
#define U_CORE_UUID_H
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/uuid/uuid.hpp>
|
||||
#include <boost/uuid/name_generator.hpp>
|
||||
#include <boost/uuid/random_generator.hpp>
|
||||
#include <boost/uuid/uuid.hpp>
|
||||
#include <boost/uuid/uuid_io.hpp>
|
||||
|
||||
#include "Core/Mpl.h"
|
||||
#include "Core/Object.h"
|
||||
|
||||
|
||||
namespace uLib {
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Object Registration //
|
||||
|
||||
|
||||
typedef boost::uuids::uuid uuid_t;
|
||||
|
||||
extern uuid_t uLib_dns_uuid;
|
||||
|
||||
template < typename T >
|
||||
class type_id : public boost::uuids::uuid {
|
||||
template <typename T> class type_id : public boost::uuids::uuid {
|
||||
public:
|
||||
type_id() :
|
||||
m_size(sizeof(T)),
|
||||
uuid(boost::uuids::name_generator(uLib_dns_uuid)(typeid(T).name()))
|
||||
{
|
||||
std::cout << "Request for register new type\n" <<
|
||||
"name: " << typeid(T).name() << "\n" <<
|
||||
"uuid: " << to_string(*this) << "\n";
|
||||
}
|
||||
type_id()
|
||||
: m_size(sizeof(T)),
|
||||
uuid(boost::uuids::name_generator(uLib_dns_uuid)(typeid(T).name())) {
|
||||
std::cout << "Request for register new type\n"
|
||||
<< "name: " << typeid(T).name() << "\n"
|
||||
<< "uuid: " << to_string(*this) << "\n";
|
||||
}
|
||||
|
||||
explicit type_id(boost::uuids::uuid const& u)
|
||||
: boost::uuids::uuid(u) {}
|
||||
explicit type_id(boost::uuids::uuid const &u) : boost::uuids::uuid(u) {}
|
||||
|
||||
operator boost::uuids::uuid() {
|
||||
return static_cast<boost::uuids::uuid&>(*this);
|
||||
}
|
||||
|
||||
operator boost::uuids::uuid() const {
|
||||
return static_cast<boost::uuids::uuid const&>(*this);
|
||||
}
|
||||
|
||||
unsigned int size() const { return m_size; }
|
||||
unsigned int size() const { return m_size; }
|
||||
|
||||
private:
|
||||
unsigned int m_size;
|
||||
unsigned int m_size;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -94,70 +74,57 @@ private:
|
||||
namespace detail {
|
||||
|
||||
class TypeRegister {
|
||||
typedef boost::uuids::name_generator IDGen_t;
|
||||
typedef boost::uuids::name_generator IDGen_t;
|
||||
|
||||
public:
|
||||
struct RegisterEntry {
|
||||
uuid_t id;
|
||||
int size;
|
||||
};
|
||||
struct RegisterEntry {
|
||||
uuid_t id;
|
||||
int size;
|
||||
};
|
||||
|
||||
TypeRegister(uuid_t const &dns) :
|
||||
gen(dns) {}
|
||||
|
||||
|
||||
template< typename T >
|
||||
RegisterEntry * AddType(T *t = NULL) {
|
||||
RegisterEntry en = { gen(typeid(T).name()), sizeof(T) };
|
||||
for(int i=0; i < m_registry.size(); ++i)
|
||||
if(en.id == m_registry[i].id) return &(m_registry[i]);
|
||||
m_registry.push_back(en);
|
||||
return &m_registry.back();
|
||||
}
|
||||
|
||||
void PrintSelf(std::ostream &o) {
|
||||
std::cout << "RegisterController: \n";
|
||||
for (int i=0; i<m_registry.size(); ++i)
|
||||
o << "type [" << i << "]: "
|
||||
<< to_string(m_registry[i].id) << " "
|
||||
<< m_registry[i].size << "\n";
|
||||
o << "\n";
|
||||
}
|
||||
TypeRegister(uuid_t const &dns) : gen(dns) {}
|
||||
|
||||
template <typename T> RegisterEntry *AddType(T *t = NULL) {
|
||||
RegisterEntry en = {gen(typeid(T).name()), sizeof(T)};
|
||||
for (int i = 0; i < m_registry.size(); ++i)
|
||||
if (en.id == m_registry[i].id)
|
||||
return &(m_registry[i]);
|
||||
m_registry.push_back(en);
|
||||
return &m_registry.back();
|
||||
}
|
||||
|
||||
void PrintSelf(std::ostream &o) {
|
||||
std::cout << "RegisterController: \n";
|
||||
for (int i = 0; i < m_registry.size(); ++i)
|
||||
o << "type [" << i << "]: " << to_string(m_registry[i].id) << " "
|
||||
<< m_registry[i].size << "\n";
|
||||
o << "\n";
|
||||
}
|
||||
|
||||
private:
|
||||
IDGen_t gen;
|
||||
std::vector<RegisterEntry> m_registry;
|
||||
|
||||
IDGen_t gen;
|
||||
std::vector<RegisterEntry> m_registry;
|
||||
};
|
||||
|
||||
} // detail
|
||||
|
||||
|
||||
|
||||
} // namespace detail
|
||||
|
||||
class TypeRegister : public detail::TypeRegister {
|
||||
public:
|
||||
typedef detail::TypeRegister BaseClass;
|
||||
typedef detail::TypeRegister::RegisterEntry Entry;
|
||||
typedef detail::TypeRegister BaseClass;
|
||||
typedef detail::TypeRegister::RegisterEntry Entry;
|
||||
|
||||
static TypeRegister* Controller();
|
||||
static TypeRegister *Controller();
|
||||
|
||||
private:
|
||||
TypeRegister(); // Blocks constructor
|
||||
static TypeRegister *s_Instance; // Singleton instance
|
||||
TypeRegister(); // Blocks constructor
|
||||
static TypeRegister *s_Instance; // Singleton instance
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// OBJECT REGISTER //
|
||||
|
||||
|
||||
|
||||
} // uLib
|
||||
} // namespace uLib
|
||||
|
||||
#endif // UUID_H
|
||||
|
||||
Reference in New Issue
Block a user