1
This commit is contained in:
parent
0c7047a18b
commit
d1a289b78d
@ -18,6 +18,7 @@ struct AttrAddition : public std::enable_shared_from_this<AttrAddition>
|
|||||||
list_head list_entry;
|
list_head list_entry;
|
||||||
int attr_id;
|
int attr_id;
|
||||||
float value;
|
float value;
|
||||||
|
float finaly_value;
|
||||||
int source_type = kAstNone;
|
int source_type = kAstNone;
|
||||||
std::shared_ptr<AttrAddition> holder;
|
std::shared_ptr<AttrAddition> holder;
|
||||||
std::shared_ptr<std::function<std::string()>> get_source;
|
std::shared_ptr<std::function<std::string()>> get_source;
|
||||||
@ -45,29 +46,42 @@ static std::array<std::vector<std::shared_ptr<AttrAddition>>, kAstEnd> s_speed_r
|
|||||||
|
|
||||||
static float CalcSpeedRateIn(list_head* head)
|
static float CalcSpeedRateIn(list_head* head)
|
||||||
{
|
{
|
||||||
list_head* pos = nullptr;
|
{
|
||||||
list_head* next = nullptr;
|
list_head* pos = nullptr;
|
||||||
list_for_each_safe(pos, next, head) {
|
list_head* next = nullptr;
|
||||||
AttrAddition* e = list_entry(pos,
|
list_for_each_safe(pos, next, head) {
|
||||||
AttrAddition,
|
AttrAddition* e = list_entry(pos,
|
||||||
entry);
|
AttrAddition,
|
||||||
switch (e->source_type) {
|
entry);
|
||||||
case kAstChip:
|
switch (e->source_type) {
|
||||||
{
|
case kAstChip:
|
||||||
s_speed_ratein_list.at(e->source_type).push_back(e->holder);
|
{
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
if (e->source_type >= 0 && e->source_type <= s_speed_ratein_list.size()) {
|
|
||||||
s_speed_ratein_list.at(e->source_type).push_back(e->holder);
|
s_speed_ratein_list.at(e->source_type).push_back(e->holder);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
if (e->source_type >= 0 && e->source_type <= s_speed_ratein_list.size()) {
|
||||||
|
s_speed_ratein_list.at(e->source_type).push_back(e->holder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto& itr : s_speed_ratein_list) {
|
{
|
||||||
itr.clear();
|
for (auto& itr : s_speed_ratein_list) {
|
||||||
|
std::sort(itr.begin(), itr.end(),
|
||||||
|
[] (std::shared_ptr<AttrAddition> a, std::shared_ptr<AttrAddition> b) -> bool
|
||||||
|
{
|
||||||
|
return std::fabs(a->value) > std::fabs(b->value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
for (auto& itr : s_speed_ratein_list) {
|
||||||
|
itr.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user