本文整理汇总了C++中ModelData::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelData::clear方法的具体用法?C++ ModelData::clear怎么用?C++ ModelData::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelData
的用法示例。
在下文中一共展示了ModelData::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadModel
bool OpenTxEepromInterface::loadModel(ModelData &model, uint8_t *data, int index, unsigned int stickMode)
{
T _model;
if (!data) {
// load from EEPROM
efile->openRd(FILE_MODEL(index));
int sz = efile->readRlc2((uint8_t*)&_model, sizeof(T));
if (sz) {
model = _model;
if (sz < (int)sizeof(T)) {
std::cout << " size(" << model.name << ") " << sz << " < " << (int)sizeof(T) << " ";
}
if (stickMode) {
applyStickModeToModel(model, stickMode);
}
}
else {
model.clear();
}
}
else {
// load from SD Backup, size is stored in index
if ((unsigned int)index < sizeof(T))
return false;
memcpy((uint8_t*)&_model, data, sizeof(T));
model = _model;
}
return true;
}
示例2: loadModelVariant
bool OpenTxEepromInterface::loadModelVariant(unsigned int index, ModelData &model, uint8_t *data, unsigned int version, unsigned int variant)
{
T open9xModel(model, board, version, variant);
if (!data) {
// load from EEPROM
QByteArray eepromData(sizeof(model), 0); // ModelData should be always bigger than the EEPROM struct
efile->openRd(FILE_MODEL(index));
int numbytes = efile->readRlc2((uint8_t *)eepromData.data(), eepromData.size());
if (numbytes) {
open9xModel.Import(eepromData);
// open9xModel.Dump();
model.used = true;
}
else {
model.clear();
}
}
else {
// load from SD Backup, size is stored in index
QByteArray eepromData((char *)data, index);
open9xModel.Import(eepromData);
}
return true;
}
示例3: sizeof
void Gruvin9xInterface::loadModel(ModelData &model, unsigned int stickMode, int version)
{
T _model;
if ((version == 2 && efile->readRlc2((uint8_t*)&_model, sizeof(T))) ||
(version == 1 && efile->readRlc1((uint8_t*)&_model, sizeof(T)))) {
model = _model;
if (stickMode) {
applyStickModeToModel(model, stickMode);
}
}
else {
model.clear();
}
}