本文整理汇总了C++中utils::make_selector方法的典型用法代码示例。如果您正苦于以下问题:C++ utils::make_selector方法的具体用法?C++ utils::make_selector怎么用?C++ utils::make_selector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils
的用法示例。
在下文中一共展示了utils::make_selector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gEmptyRadio
namespace implementation {
using V1_0::Band;
using V1_0::Class;
using std::lock_guard;
using std::move;
using std::mutex;
using std::vector;
using utils::make_selector;
static const vector<VirtualProgram> gInitialFmPrograms{
{make_selector(Band::FM, 94900), "Wild 94.9", "Drake ft. Rihanna", "Too Good"},
{make_selector(Band::FM, 96500), "KOIT", "Celine Dion", "All By Myself"},
{make_selector(Band::FM, 97300), "[email protected]", "Drops of Jupiter", "Train"},
{make_selector(Band::FM, 99700), "99.7 Now!", "The Chainsmokers", "Closer"},
{make_selector(Band::FM, 101300), "101-3 KISS-FM", "Justin Timberlake", "Rock Your Body"},
{make_selector(Band::FM, 103700), "iHeart80s @ 103.7", "Michael Jackson", "Billie Jean"},
{make_selector(Band::FM, 106100), "106 KMEL", "Drake", "Marvins Room"},
};
static VirtualRadio gEmptyRadio({});
static VirtualRadio gFmRadio(gInitialFmPrograms);
VirtualRadio::VirtualRadio(const vector<VirtualProgram> initialList) : mPrograms(initialList) {}
vector<VirtualProgram> VirtualRadio::getProgramList() {
lock_guard<mutex> lk(mMut);
return mPrograms;
}
bool VirtualRadio::getProgram(const ProgramSelector& selector, VirtualProgram& programOut) {
lock_guard<mutex> lk(mMut);
for (auto&& program : mPrograms) {
if (utils::tunesTo(selector, program.selector)) {
programOut = program;
return true;
}
}
return false;
}
VirtualRadio& getRadio(V1_0::Class classId) {
switch (classId) {
case Class::AM_FM:
return getFmRadio();
case Class::SAT:
return getSatRadio();
case Class::DT:
return getDigitalRadio();
default:
ALOGE("Invalid class ID");
return gEmptyRadio;
}
}
VirtualRadio& getAmRadio() {
return gEmptyRadio;
}
VirtualRadio& getFmRadio() {
return gFmRadio;
}
VirtualRadio& getSatRadio() {
return gEmptyRadio;
}
VirtualRadio& getDigitalRadio() {
return gEmptyRadio;
}
} // namespace implementation