//------------------------------------------------------------------------------ tFirmwareRet firmwarestore_create(const tFirmwareStoreConfig* pConfig_p, tFirmwareStoreHandle* ppHandle_p) { tFirmwareRet ret = kFwReturnOk; tFirmwareStoreInstance* instance; if ((pConfig_p == NULL) || (ppHandle_p == NULL)) { ret = kFwReturnInvalidParameter; } instance = malloc(sizeof(tFirmwareStoreInstance)); if (instance == NULL) { ret = kFwReturnNoResource; goto EXIT; } memset(instance, 0, sizeof(tFirmwareStoreInstance)); strncpy(instance->aFilename, pConfig_p->pFilename, FWSTORE_FILEPATH_LENGTH); getPathToFile(instance->aFilename, instance->aPathToFile); *ppHandle_p = instance; EXIT: return ret; }
void ClsTypeManager<T>::loadTypes(string _strDirectory) { list<string> listTypes = getListLibraries(_strDirectory); typename list<string>::iterator it; for (it = listTypes.begin(); it != listTypes.end(); ++it) { string strFileName = it->data(); string strType = fileName2typeName(strFileName); string strPath = getPathToFile(_strDirectory, strFileName); try { string strLabel = loadType(strType, strPath); // Guard against duplicate label. typename TypeLabelMap::iterator entry; entry = mapLabelLookup.find(strLabel); if (entry != mapLabelLookup.end()) { cerr << "WARNING: duplicate label " << strLabel << ", scanning for new label:" << endl; int i = 1; ostringstream tmp; do { tmp.str(""); ++i; tmp << strLabel << " #" << i; } while (mapLabelLookup.find(tmp.str()) != mapLabelLookup.end()); strLabel = tmp.str(); } mapLabelLookup.insert(make_pair(strLabel, strType)); listLabels.push_back(strLabel); if (bDebugTypeManager) { cout << "Loaded " << strLabel << ", stored as " << strType << endl; } } catch (iqrcommon::LoadTypeError &e) { cerr << getName() << ": couldn't load " << strFileName << endl << " " << e.what() << endl; } } // Sort the list of names alphabetically. listLabels.sort(); }