-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
230 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
SET(CMAKE_C_COMPILER clang) | ||
SET(CMAKE_CXX_COMPILER clang++) | ||
SET(CMAKE_C_COMPILER clang-15) | ||
SET(CMAKE_CXX_COMPILER clang++-15) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
/** | ||
@file | ||
@author Alexander Sherikov | ||
@copyright 2017-2024 Alexander Sherikov, Licensed under the Apache License, Version 2.0. | ||
(see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0) | ||
@brief | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "common.h" | ||
|
||
|
||
namespace ariles2 | ||
{ | ||
/// @ingroup aggregate | ||
namespace aggregate | ||
{ | ||
template <class t_Visitor> | ||
class ARILES2_VISIBILITY_ATTRIBUTE ParametersWraper | ||
{ | ||
public: | ||
typename t_Visitor::Parameters parameters_; | ||
|
||
public: | ||
ParametersWraper(const bool override_parameters = true) : parameters_(override_parameters) | ||
{ | ||
} | ||
|
||
ParametersWraper(const typename t_Visitor::Parameters ¶meters) : parameters_(parameters) | ||
{ | ||
} | ||
|
||
template < | ||
class t_IdType, | ||
typename = std::enable_if_t< | ||
std::is_same<t_IdType, t_Visitor>::value | ||
or std::is_base_of<t_IdType, typename t_Visitor::Parameters>::value>> | ||
typename t_Visitor::Parameters &get() | ||
{ | ||
return (parameters_); | ||
} | ||
|
||
template < | ||
class t_IdType, | ||
typename = std::enable_if_t< | ||
std::is_same<t_IdType, t_Visitor>::value | ||
or std::is_base_of<t_IdType, typename t_Visitor::Parameters>::value>> | ||
const typename t_Visitor::Parameters &get() const | ||
{ | ||
return (parameters_); | ||
} | ||
}; | ||
|
||
template <class... t_Visitors> | ||
class ARILES2_VISIBILITY_ATTRIBUTE Parameters; | ||
|
||
template <> | ||
class ARILES2_VISIBILITY_ATTRIBUTE Parameters<> | ||
{ | ||
public: | ||
Parameters(const bool){}; | ||
Parameters(){}; | ||
|
||
void get(){}; | ||
}; | ||
|
||
template <class t_Visitor, class... t_Visitors> | ||
class ARILES2_VISIBILITY_ATTRIBUTE Parameters<t_Visitor, t_Visitors...> : public ParametersWraper<t_Visitor>, | ||
public Parameters<t_Visitors...> | ||
{ | ||
public: | ||
Parameters(const bool override_parameters = true) | ||
: ParametersWraper<t_Visitor>(override_parameters), Parameters<t_Visitors...>(override_parameters) | ||
{ | ||
} | ||
|
||
template <class... t_Parameters> | ||
Parameters(const typename t_Visitor::Parameters ¶meters, t_Parameters &&...other_parameters) | ||
: ParametersWraper<t_Visitor>(parameters) | ||
, Parameters<t_Visitors...>(std::forward<t_Parameters>(other_parameters)...) | ||
{ | ||
} | ||
|
||
template <class t_Parameters> | ||
Parameters(const t_Parameters ¶meters, const bool override_parameters = true) | ||
: ParametersWraper<t_Visitor>(override_parameters) | ||
, Parameters<t_Visitors...>(parameters, override_parameters) | ||
{ | ||
} | ||
|
||
Parameters(const typename t_Visitor::Parameters ¶meters, const bool override_parameters = true) | ||
: ParametersWraper<t_Visitor>(parameters), Parameters<t_Visitors...>(override_parameters) | ||
{ | ||
} | ||
|
||
using ParametersWraper<t_Visitor>::get; | ||
using Parameters<t_Visitors...>::get; | ||
}; | ||
|
||
|
||
|
||
/* | ||
template <class t_Visitor> | ||
class ARILES2_VISIBILITY_ATTRIBUTE BaseVisitorWraper | ||
{ | ||
public: | ||
t_Visitor visitor_; | ||
public: | ||
BaseVisitorWraper() {}; | ||
template<class... t_Args> | ||
BaseVisitorWraper(t_Args &&... args) : visitor_(std::forward<t_Args>(args)...) | ||
{ | ||
} | ||
template <class t_GetVisitor, typename = std::enable_if_t<std::is_same<t_GetVisitor, t_Visitor>::value>> | ||
t_Visitor &get() | ||
{ | ||
return (visitor_); | ||
} | ||
template <class t_GetVisitor, typename = std::enable_if_t<std::is_same<t_GetVisitor, t_Visitor>::value>> | ||
const t_Visitor &get() const | ||
{ | ||
return (visitor_); | ||
} | ||
}; | ||
*/ | ||
|
||
template <class... t_Visitors> | ||
class ARILES2_VISIBILITY_ATTRIBUTE BaseVisitor; | ||
|
||
template <> | ||
class ARILES2_VISIBILITY_ATTRIBUTE BaseVisitor<> | ||
{ | ||
}; | ||
|
||
template <class t_Visitor, class... t_Visitors> | ||
class ARILES2_VISIBILITY_ATTRIBUTE BaseVisitor<t_Visitor, t_Visitors...> : // public BaseVisitorWraper<t_Visitor>, | ||
public BaseVisitor<t_Visitors...> | ||
{ | ||
}; | ||
|
||
|
||
template <class... t_Visitors> | ||
class ARILES2_VISIBILITY_ATTRIBUTE Visitor | ||
: public BaseVisitor<t_Visitors...>, | ||
public visitor::Base<visitor::GenericVisitor, Parameters<t_Visitors...>> | ||
{ | ||
public: | ||
using Parameters = aggregate::Parameters<t_Visitors...>; | ||
|
||
public: | ||
using visitor::Base<visitor::GenericVisitor, Parameters>::getDefaultParameters; | ||
}; | ||
} // namespace aggregate | ||
} // namespace ariles2 |
Oops, something went wrong.