5 #ifndef __NODAMUSHI_SVD_NORMALIZED_DIM_HELPER_HPP__ 6 #define __NODAMUSHI_SVD_NORMALIZED_DIM_HELPER_HPP__ 20 template<
typename NODE>
22 return n.dim && *n.dim!=0? *n.dim : 1;
36 template<
typename NODE>
45 const STR& s = *string;
47 if(s.length() < 2)
return;
48 auto p = s.find(
"%s");
65 while(i != 0 && (s[i] ==
' ' || s[i] ==
'\t')) --i;
68 if(i < 3 || s[i-1] !=
'%' || s[i] !=
's' ){
76 while(i != 0 && (s[i] ==
' ' || s[i] ==
'\t')) --i;
95 return std::string(*
str);
97 const std::string& n = *
str;
103 if(dimi.size() <= index) s.
append(std::to_string(index));
104 else s.append(dimi[index]);
105 }
else s.append(std::to_string(index));
114 template<
typename NODE>
116 ->dim_name_helper<
typename decltype(n.name)::type>
118 return {n,n.name? &n.name.get() :
nullptr};
121 template<
typename NODE>
123 ->dim_name_helper<
typename decltype(n.displayName)::type>
125 return {n,n.displayName? &n.displayName.get() :
nullptr};
129 template<
typename NODE>
148 (n.dimIncrement && n.dimIncrement.get() > 0)?n.dimIncrement.get() : 1)
162 template<
typename NODE>
167 template<
typename NODELIST>
171 for(
const auto& f:
list){
172 if(f.dim && f.dim!=0) count += *f.dim;
183 #endif // __NODAMUSHI_SVD_NORMALIZED_DIM_HELPER_HPP__ auto make_dim_displayName_helper(const NODE &n) -> dim_name_helper< typename decltype(n.displayName)::type >
dim_helper< NODE > make_dim_helper(const NODE &n)
auto make_dim_name_helper(const NODE &n) -> dim_name_helper< typename decltype(n.name)::type >
dim_type
Array or Sequence or not.
size_t offset(size_t index)
dim_name_helper(const NODE &n, const STR *string)
std::string operator()(size_t index) const
size_t get_dim_count(const NODE &n)
get dim size. when dim is empty return 1.
dim_helper(const NODE &n)
replacing s process support
decltype(make_dim_name_helper(*((NODE *) 0))) name_helper
void append(std::string &dst, size_t index) const
dim,dimIndex,array information object.
is_array() const noexcept
const dimIndex * dimIndex
size_t calcChildrenSize(const NODELIST &list)
is_array() const noexcept