bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>:: AttachSchema( const StructIdEnum struct_id, NsSmartDeviceLink::NsSmartObjects::SmartObject &object) { typename StructsSchemesMap::iterator structs_iterator = structs_schemes_.find(struct_id); if (structs_iterator == structs_schemes_.end()) { return false; } object.setSchema(structs_iterator->second); structs_iterator->second.applySchema(object); return true; }
bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::attachSchema(NsSmartDeviceLink::NsSmartObjects::SmartObject &object) { if(false == object.keyExists(strings::S_PARAMS)) return false; if(false == object[strings::S_PARAMS].keyExists(strings::S_MESSAGE_TYPE)) return false; if(false == object[strings::S_PARAMS].keyExists(strings::S_FUNCTION_ID)) return false; MessageTypeEnum msgtype((MessageTypeEnum)(int)object[strings::S_PARAMS][strings::S_MESSAGE_TYPE]); FunctionIdEnum fid((FunctionIdEnum)(int)object[strings::S_PARAMS][strings::S_FUNCTION_ID]); SmartSchemaKey<FunctionIdEnum, MessageTypeEnum> key(fid, msgtype); typename FuncionsSchemesMap::iterator schemaIterator = functions_schemes_.find(key); if(schemaIterator == functions_schemes_.end()) { // Schema was not found return false; } object.setSchema(schemaIterator->second); schemaIterator->second.applySchema(object); return true; }