void QuantumTSTaggedStringAttributeHandler::_consumeValue(const std::string& key, const KeyValue& value) { consumeTSTaggedValue(key, attribute, value->getUInt64Value(ts_attribute), value->getStringValue(attribute)); }
void MR_kv_add_multi_dynamic(void *KVptr, int n, char *key, int *keybytes, char *value, int *valuebytes) { KeyValue *kv = (KeyValue *) KVptr; kv->add(n,key,keybytes,value,valuebytes); }
bool KeyboardControl::HandleKey(unsigned int keyCode) { bool retVal = false; for (int o = 0; o < numObjects; o++) { KeyboardObject *obj = keyObjects[o]; if (obj) { int numVars = obj->GetNumValues(); for (int n = 0; n < numVars; n++) { KeyValue *key = obj->GetKeyValue(n); if (keyCode == key->GetKeyDecrease()) { key->Decrement(); retVal = true; } else if (keyCode == key->GetKeyIncrease()) { key->Increment(); retVal = true; } } } } return retVal; }
// MAPPED // bool Section::deleteData(const char *name) { // Since we are keeping deleted data in the d_allDataVector, // multiple set/deletes will require lots of memory!! // if(name) { std::string myname=name; KeyValue *mydata = d_kv_map[myname]; if(mydata) { // Remain in d_allDataVector, but as deleted // mydata->isDeleted(true); // remove from keyvalue vector and map // std::vector<KeyValue*>::iterator iter; for(iter = d_kv_vector.begin(); iter != d_kv_vector.end(); iter ++) { if( *iter == mydata ) { d_kv_vector.erase(iter); break; } } d_kv_map.erase(myname); return true; } } return false; }
TextureSystem::TextureSystem(sf::RenderWindow& rw, entityx::EntityManager& entities, KeyValue& keys) : window(rw) , imageRenderEnabled(false) , randomTexturesEnabled(true) , positionTextEnabled(false) , entities(entities) { /* This doesn't change. It maps the type shape to the vector of textures aviliable * under random texturing, or we use the first for no random textures */ texturemap = { { SpawnComponent::BOX, {&boxTextures, conf::box_halfwidth*2}}, { SpawnComponent::CIRCLE, {&ballTextures, conf::circle_radius*2}} }; /* Textures for physics objects * `loadTextures` reads a key from an .ini consisting of colon-delimited * textures, and loads them into a vector */ loadTextures(boxTextures, keys.GetString("BOX_TEXTURES")); loadTextures(ballTextures, keys.GetString("BALL_TEXTURES")); //Load background texture and make it repeating bgTexture.loadFromFile(keys.GetString("BACKGROUND_TEXTURE")); bgTexture.setRepeated(true); bgSprite.setTexture(bgTexture); auto windsz = rw.getSize(); bgSprite.setTextureRect(sf::IntRect(0, 0, windsz.x, windsz.y)); //Font for displaying positions and other things boxFont.loadFromFile(keys.GetString("OBJECT_FONT")); }
bool JPWiFly::getConnection(String& method, String& url, KeyValue& data) { String line; int8_t index = buffer.readToFirst_P(kProtocolMethodStrings, 3); if (index == -1) return false; method = prog_mem_string(kProtocolMethodStrings[index], 0, -1); if (!buffer.readTo_P(PSTR(" "), &url)) return false; if (!buffer.readTo_P(kNewLineString)) return false; while (true) { String key, value; int8_t index; if ((index = buffer.readToFirst_P(kColonNewLineStrings, 2, &key)) == -1) return false; if (index == 1) break; if (!buffer.readTo_P(kNewLineString, &value)) return false; data.setValueForKey(key, value); } const String* content_length_str = data.valueForKey_P(PSTR("Content-Length")); if (!content_length_str) return true; int content_length = atoi(content_length_str->c_str()); buffer.readNCharacters(content_length, &line); data.setValueForKey("", line); return true; }
void operator()(std::pair<GridClientVariant, GridClientVariant> pair) { KeyValue* keyValue = protoMap.add_entry(); ObjectWrapper* key = keyValue->mutable_key(); ObjectWrapper* value = keyValue->mutable_value(); GridClientObjectWrapperConvertor::wrapSimpleType(pair.first, *key); GridClientObjectWrapperConvertor::wrapSimpleType(pair.second, *value); }
float KeyboardControl::GetMaxValue(const char *name) { KeyValue *key = GetKeyValue(name); if (key) return key->GetMaxValue(); else return 0.0f; }
float *KeyboardControl::GetValuePtr(const char *name) { KeyValue *key = GetKeyValue(name); if (key) return key->GetValuePtr(); else return NULL; }
void QuantumTSTaggedBinaryAttributeHandler::_consumeValue(const std::string& key, const KeyValue& value) { uint32_t buf_size = 0; consumeTSTaggedValue(key, attribute, value->getUInt64Value(ts_attribute), ChaosSharedPtr<SerializationBuffer>(new SerializationBuffer(value->getBinaryValue(attribute, buf_size), buf_size))); }
const char *Section::getDataValueAt(int index) const { KeyValue *kv = d_kv_vector[index]; if(kv) { return kv->getValue(); } return ""; }
// https://developer.twitter.com // /en/docs/basics/authentication/guides/creating-a-signature.html std::string Network::CalcSignature( const std::string &http_method, const std::string &base_url, const KeyValue &oauth_param, const KeyValue &query_param, const std::string &consumer_secret, const std::string &token_secret) { // "Collecting parameters" // percent encode しつつ合成してキーでソートする KeyValue param; auto encode_insert = [this, ¶m](const KeyValue &map) { for (const auto &entry : map) { param.emplace(Escape(entry.first), Escape(entry.second)); } }; encode_insert(oauth_param); encode_insert(query_param); // 文字列にする // key1=value1&key2=value2&... std::string param_str; bool is_first = true; for (const auto &entry : param) { if (is_first) { is_first = false; } else { param_str += '&'; } param_str += entry.first; param_str += '='; param_str += entry.second; } // "Creating the signature base string" // 署名対象 std::string base = http_method; base += '&'; base += Escape(base_url); base += '&'; base += Escape(param_str); // "Getting a signing key" // 署名鍵は consumer_secret と token_secret をエスケープして & でつなぐだけ std::string key = Escape(consumer_secret); key += '&'; key += Escape(token_secret); // "Calculating the signature" ShaDigest signature; HmacSha1( key.data(), key.size(), reinterpret_cast<const unsigned char *>(base.data()), base.size(), signature); return Base64Encode(signature, sizeof(signature)); }
// MAPPED // void Section::setComment(const char *name, const char *comment) { if(name) { std::string myname=name; KeyValue *mydata = d_kv_map[myname]; if(mydata) { mydata->setComment(comment); } } }
// MAPPED // const char * Section::getComment(const char *name) const { if(name) { std::string myname=name; KeyValue *mydata = d_kv_map[myname]; if(mydata) { return mydata->getComment(); } } return ""; }
void Config::init () { if (Path::is_file (MRTRIX_SYS_CONFIG_FILE)) { INFO ("reading config file \"" MRTRIX_SYS_CONFIG_FILE "\"..."); try { KeyValue kv (MRTRIX_SYS_CONFIG_FILE); while (kv.next()) { config[kv.key()] = kv.value(); } } catch (...) { } } std::string path = Path::join (Path::home(), MRTRIX_USER_CONFIG_FILE); if (Path::is_file (path)) { INFO ("reading config file \"" + path + "\"..."); try { KeyValue kv (path); while (kv.next()) { config[kv.key()] = kv.value(); } } catch (...) { } } }
IKeyValue * VectorKeyValue::get(int index) { KeyValue *temp; temp = &(this->buffer[index]); temp->getKey(); temp->getValue(); temp->getvalues(); return(temp); /*KeyValue *temp= new KeyValue(); temp->setKey(this->buffer[index].getKey()); temp->setValues(this->buffer[index].getvalues()); return temp;*/ //return(&(this->buffer[index])); }
void LookupService::reset() { MapIterator i; for (i = _maps.begin(); i != _maps.end(); i++) { KeyValueMap &kvmap = i->second; KeyValueMap::iterator it; for (it = kvmap.begin(); it != kvmap.end(); it++) { KeyValue *k = (KeyValue*)&(it->first); KeyValue *v = it->second; k->destroy(); v->destroy(); delete v; } kvmap.clear(); } _maps.clear(); }
// https://developer.twitter.com // /en/docs/basics/authentication/guides/authorizing-a-request Network::KeyValue Network::CreateOAuthField( const std::string &consumer_key, const std::string &access_token) { KeyValue param; // oauth_consumer_key: アプリの識別子 param.emplace("oauth_consumer_key", consumer_key); // oauth_nonce: ランダム値 // OAuth spec ではリプレイ攻撃対策との記述あり // 暗号学的安全性は要らない気もするが一応そうしておく // Twitter によるとランダムな英数字なら何でもいいらしいが、例に挙げられている // 32byte の乱数を BASE64 にして英数字のみを残したものとする std::array<uint8_t, 32> nonce; for (auto &b : nonce) { b = static_cast<uint8_t>(m_secure_rand()); } std::string nonce_b64 = net.Base64Encode(&nonce, sizeof(nonce)); std::string nonce_str; std::copy_if(nonce_b64.begin(), nonce_b64.end(), std::back_inserter(nonce_str), [](unsigned char c) { return std::isalnum(c); }); param.emplace("oauth_nonce", nonce_str); // 署名は署名以外のフィールドに対しても行うので後で追加する // param.emplace("oauth_signature", sha1(...)); param.emplace("oauth_signature_method", "HMAC-SHA1"); param.emplace("oauth_timestamp", std::to_string(std::time(nullptr))); param.emplace("oauth_token", access_token); param.emplace("oauth_version", "1.0"); return param; }
IplImage* TrackView::loadFloorPlan( const WbConfig& runConfig ) { Collection m_rooms = RoomsCollection(); m_rooms.SetConfig( runConfig ); const KeyValue roomId = runConfig.GetKeyValue( RunSchema::roomIdKey ); const WbConfig roomConfig = m_rooms.ElementById( roomId.ToKeyId() ); const WbConfig roomLayoutConfig( roomConfig.GetSubConfig( RoomLayoutSchema::schemaName ) ); const QString floorPlanName( roomLayoutConfig.GetAbsoluteFileNameFor( "floor_plan.png" ) ); m_baseImg = cvLoadImage(floorPlanName.toAscii().data(), CV_LOAD_IMAGE_GRAYSCALE); return m_baseImg; }
void LookupService::query(string id, const void *key, size_t keyLen, void **val, size_t *valLen) { KeyValueMap &kvmap = _maps[id]; KeyValue k(key, keyLen); if (kvmap.find(k) == kvmap.end()) { JTRACE("Lookup Failed, Key not found."); *val = NULL; *valLen = 0; return; } KeyValue *v = kvmap[k]; *valLen = v->len(); *val = new char[v->len()]; memcpy(*val, v->data(), *valLen); }
KeyValue *KeyValueParser::parse() { KeyValueParser::Token t = getNextToken( dat, &offset, max ); unsigned int i = 0; if (t.type == KeyValueParser::INTEGER) { return new KeyValue( KeyValue::INTEGER, t.value ); } else if (t.type == KeyValueParser::FLOAT) { return new KeyValue( KeyValue::FLOAT, t.value ); } else if (t.type == KeyValueParser::STRING) { return new KeyValue( KeyValue::STRING, t.value ); } else if (t.type == KeyValueParser::OBJSTART) { KeyValue *map = new KeyValue( KeyValue::MAP ); while (true) { KeyValueParser::Token t_expect = getNextTokenProtected( dat, &offset, max ); if (t_expect.type == KeyValueParser::VARIABLE) { KeyValueParser::Token variable = getNextToken( dat, &offset, max ); KeyValueParser::Token eq = getNextToken( dat, &offset, max ); if (eq.type != KeyValueParser::SETOP) { printf("Error?"); exit(1); } map->insert(variable.value, parse()); } else { char *key = new char[50]; sprintf(key, "%u", i); map->insert(std::string(key), parse()); delete key; i++; } KeyValueParser::Token end = getNextToken( dat, &offset, max ); if (end.type == KeyValueParser::COMMA) { continue; } else if (end.type == KeyValueParser::OBJEND) { break; } printf("Error?"); throw(1); } return map; } printf("Error?"); throw(1); }
bool PathTemplate::evaluate(const Path& otherPath, KeyValue& parameters) const { parameters.clear(); if (path.size() != otherPath.size()) { return false; } for (size_t i = 0; i < path.size(); ++i) { if (isPathSegmentVariable[i]) { parameters.insert(std::make_pair(path[i], otherPath[i])); } else { if (path[i] != otherPath[i]) { parameters.clear(); return false; } } } return true; }
KeyValue *KeyboardControl::GetKeyValue(const char *name) { for (int o = 0; o < numObjects; o++) { KeyboardObject *obj = keyObjects[o]; if (obj) { int numVars = obj->GetNumValues(); for (int n = 0; n < numVars; n++) { KeyValue *key = obj->GetKeyValue(n); if (0 == strcmpi(key->GetName(),name)) { return key; } } } } return NULL; }
// MAPPED // void Section::setValue(const char *name, const char *value, const char *comment) { if(name) { std::string myname=name; KeyValue *mydata = d_kv_map[myname]; if(mydata) { mydata->setValue(value); mydata->setComment(comment); mydata->isDeleted(false); } else { KeyValue *newdata = new KeyValue(name, value, comment); d_allDataVector.push_back(newdata); d_kv_vector.push_back(newdata); d_kv_map[myname] = newdata; } } }
shared_ptr<KeyValue> WordFrequencyFeeder::next() { KeyValueField key; KeyValueField value; try{ const TWReader::T_PageRecord* record = m_reader->nextRecord(); if(record){ key.appendStr(record->url); value.appendStr(record->body); KeyValue* nextKeyValue = new KeyValue(1); nextKeyValue->setKey(key); nextKeyValue->setValue(0,value); shared_ptr<KeyValue> pNextKeyValue(nextKeyValue); return pNextKeyValue; } }catch (TWReaderException &E) { cout << E.what() << endl; } catch (exception &E) { cout << E.what() << endl; } //return a nul object, it sucks. // key.appendStr(""); // value.appendStr(""); // KeyValue* nextKeyValue = new KeyValue(1); // nextKeyValue->setKey(key); // nextKeyValue->setValue(0,value); // shared_ptr<KeyValue> pNextKeyValue(nextKeyValue); KeyValue* nextKeyValue = NULL; shared_ptr<KeyValue> pNextKeyValue(nextKeyValue); return pNextKeyValue; }
bool TrackView::loadMetrics( const WbConfig& runConfig ) { WbConfig trackConfig = runConfig.GetSubConfig( TrackRobotSchema::schemaName ); Collection m_rooms = RoomsCollection(); m_rooms.SetConfig( runConfig ); const KeyValue roomId = runConfig.GetKeyValue( RunSchema::roomIdKey ); const WbConfig roomConfig = m_rooms.ElementById( roomId.ToKeyId() ); std::vector<WbConfig> camPosConfigs = GetCameraPositionsConfigs(roomConfig); const WbConfig firstCamPosConfigForThisRun(camPosConfigs.at(0)); WbConfig firstCamPosCalibrationCfg; firstCamPosCalibrationCfg = firstCamPosConfigForThisRun.GetSubConfig( ExtrinsicCalibrationSchema::schemaName ); const KeyValue squareSizeCmKey = firstCamPosCalibrationCfg.GetKeyValue( ExtrinsicCalibrationSchema::gridSquareSizeInCmKey ); const KeyValue squareSizePxKey = firstCamPosCalibrationCfg.GetKeyValue( ExtrinsicCalibrationSchema::gridSquareSizeInPxKey ); const KeyValue resolutionKey = trackConfig.GetKeyValue( TrackRobotSchema::GlobalTrackingParams::resolution ); m_metricsScaleFactor = 1.0; return true; }
bool JetpackActorCommon::jsval_to_CompVariant(JSContext* cx, JSType type, jsval from, CompVariant* to, OpaqueSeenType* seen) { if (type != JSTYPE_OBJECT) return false; js::LazilyConstructed<OpaqueSeenType> lost; if (!seen) { lost.construct(); seen = lost.addr(); if (!seen->ok()) return false; } OpaqueSeenType::KeyType obj = JSVAL_TO_OBJECT(from); OpaqueSeenType::IdType id; if (!seen->add(obj, &id)) { if (OpaqueSeenType::kInvalidId == id) return false; *to = CompVariant(id); return true; } if (JS_IsArrayObject(cx, obj)) { nsTArray<Variant> elems; jsuint len; if (!JS_GetArrayLength(cx, obj, &len) || !elems.SetCapacity(len)) return false; for (jsuint i = 0; i < len; ++i) { jsval val; Variant* vp = elems.AppendElement(); if (!JS_GetElement(cx, obj, i, &val) || !jsval_to_Variant(cx, val, vp, seen)) *vp = void_t(); } *to = elems; return true; } js::AutoIdArray ida(cx, JS_Enumerate(cx, obj)); if (!ida) return false; nsTArray<KeyValue> kvs; for (size_t i = 0; i < ida.length(); ++i) { jsval val; // reused for both key and value if (!JS_IdToValue(cx, ida[i], &val)) return false; JSString* idStr = JS_ValueToString(cx, val); if (!idStr) return false; if (!JS_GetPropertyById(cx, obj, ida[i], &val)) return false; KeyValue kv; // Silently drop properties that can't be converted. if (jsval_to_Variant(cx, val, &kv.value(), seen)) { kv.key() = nsDependentString((PRUnichar*)JS_GetStringChars(idStr), JS_GetStringLength(idStr)); // If AppendElement fails, we lose this property, no big deal. kvs.AppendElement(kv); } } *to = kvs; return true; }
void run () { const std::string path = argument[0]; Tractography::Properties properties; Tractography::Reader<float> reader (path, properties); size_t init_count = 0; if (properties.find ("count") == properties.end()) { INFO ("\"count\" field not set in file " + path); } else { init_count = to<size_t>(properties["count"]); INFO ("Value of \"count\" in file " + path + " is " + str(init_count)); } // Read the actual number of streamlines in the file Tractography::Streamline<float> tck; size_t count = 0; { ProgressBar progress ("evaluating actual streamline data count..."); while (reader (tck)) { ++count; ++progress; } } reader.close(); INFO ("Actual number of streamlines read is " + str(count)); // Find the appropriate file offset in the header KeyValue kv (argument[0], "mrtrix tracks"); std::string data_file; int64_t count_offset = 0; int64_t current_offset = 0; while (kv.next()) { std::string key = lowercase (kv.key()); if (key == "count") count_offset = current_offset; current_offset = kv.tellg(); } kv.close(); if (!count_offset) throw Exception ("could not find location of \"count\" field in file \"" + path + "\""); DEBUG ("File offset for \"count\" field is " + str(count_offset)); // Overwrite this data // Used C-style file access here as ofstream would either wipe the file contents, or // append the data instead of inserting it FILE* fp; fp = fopen (path.c_str(), "r+"); if (!fp) throw Exception ("could not open tracks file \"" + path + "\" for repair"); if (fseek (fp, count_offset, SEEK_SET)) { fclose (fp); throw Exception ("unable to seek to the appropriate position in the file"); } const std::string string = "count: " + str(count) + "\ntotal_count: " + str(count) + "\nEND\n"; const int rvalue = fputs (string.c_str(), fp); fclose (fp); if (rvalue == EOF) { WARN ("\"count\" field may not have been properly updated"); } else { INFO ("\"count\" field updated successfully"); } }
void CGraphicsModule::initDriver( short width, short height ) { offsetX = 0; offsetY = 0; this->width = width; this->height = height; if (!glfwInit()) { printf("Failed to start GLFW."); exit(1); } #ifdef USE_OPENGL_3 glfwOpenWindowHint( GLFW_OPENGL_VERSION_MAJOR, 3 ); glfwOpenWindowHint( GLFW_OPENGL_VERSION_MINOR, 2 ); glfwOpenWindowHint( GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE ); #endif glfwOpenWindowHint( GLFW_WINDOW_NO_RESIZE, GL_TRUE ); glfwOpenWindow( width, height, 0, 0, 0, 0, 8, 0, GLFW_WINDOW ); glfwSetWindowTitle( "Spine" ); const GLubyte* version = glGetString(GL_VERSION); const GLubyte* renderer = glGetString(GL_RENDERER); const GLubyte* vendor = glGetString(GL_VENDOR); const GLubyte* glslvers = glGetString(GL_SHADING_LANGUAGE_VERSION); printf("Version: %s\nRenderer: %s\nVendor: %s\nGLSLVersion: %s\n", version, renderer, vendor, glslvers); glewExperimental = GL_TRUE; if (glewInit() != GLEW_OK) { printf( "Error loading glew!" ); exit(1); } else { printf( "Using GLEW: %s %d\n", glewGetString(GLEW_VERSION), glewIsSupported("GL_ARB_fragment_program") ); } // Compile all the shaders. DirectoryList list = filesystem->getDirectoryList("./shaders/"); for (DirectoryList::iterator i = list.begin(); i != list.end(); ++i) { char name[50]; char exten[10]; util->getFileName(name, (*i).c_str()); util->getFileExtension(exten, (*i).c_str()); Buffer buffer; File *file = filesystem->open((*i).c_str()); file->readBuffer(&buffer); if (strcmp(exten, ".fsh") == 0) { const char *c_str = buffer.data; GLuint fragmentShader = glCreateShader( GL_FRAGMENT_SHADER ); glShaderSource( fragmentShader, 1, &c_str, NULL ); glCompileShader( fragmentShader ); shaders[name] = fragmentShader; GLint status; glGetShaderiv( fragmentShader, GL_COMPILE_STATUS, &status ); if (status == GL_TRUE) { printf("Loaded fragment shader: %s (%d)\n", name, fragmentShader); } else { char buffer[512]; glGetShaderInfoLog( fragmentShader, 512, NULL, buffer ); printf("Error loading fragment shader: %s (%d)\n", name, fragmentShader); printf("%s\n", buffer); } } else if (strcmp(exten, ".vsh") == 0) { const char *c_str = buffer.data; GLuint vertexShader = glCreateShader( GL_VERTEX_SHADER ); glShaderSource( vertexShader, 1, &c_str, NULL ); glCompileShader( vertexShader ); shaders[name] = vertexShader; GLint status; glGetShaderiv( vertexShader, GL_COMPILE_STATUS, &status ); if (status == GL_TRUE) { printf("Loaded vertex shader: %s (%d)\n", name, vertexShader); } else { char buffer[512]; glGetShaderInfoLog( vertexShader, 512, NULL, buffer ); printf("Error loading vertex shader: %s (%d)\n", name, vertexShader); printf("%s\n", buffer); } } delete file; } // Compile all the programs. for (DirectoryList::iterator i = list.begin(); i != list.end(); ++i) { char exten[10]; util->getFileExtension(exten, (*i).c_str()); if (strcmp(exten, ".kv") == 0) { char name[50]; util->getFileName(name, (*i).c_str()); util->getFileNameNoExtension(name, name); Buffer buffer; File *file = filesystem->open((*i).c_str()); file->readBuffer(&buffer); KeyValue *kv = util->parseKeyValue(&buffer); GLuint shaderProgram = glCreateProgram(); KeyValue *shadermembers = kv->getMember("shaders"); if (shadermembers != NULL) { unsigned int b = 0; KeyValue *member = shadermembers->getMember(b); while ((member = shadermembers->getMember(b)) != NULL) { glAttachShader( shaderProgram, shaders[member->getString()] ); b++; } } KeyValue *fragdatamembers = kv->getMember("fragdata"); if (fragdatamembers != NULL) { unsigned int b = 0; KeyValue *member = fragdatamembers->getMember(b); while ((member = fragdatamembers->getMember(b)) != NULL) { glBindFragDataLocation( shaderProgram, b, member->getString().c_str()); b++; } } glLinkProgram( shaderProgram ); glUseProgram( shaderProgram ); GLint posAttrib = glGetAttribLocation( shaderProgram, "position" ); glEnableVertexAttribArray( posAttrib ); glVertexAttribPointer( posAttrib, 2, GL_FLOAT, GL_FALSE, 0, 0 ); programs[name] = shaderProgram; printf("Loaded program: %s (%d)\n", name, shaderProgram); kv->release(); file->release(); } } glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); glBlendEquation( GL_FUNC_ADD ); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); loadMaterial("disttex.tga"); loadMaterial("8.tga"); // load default textures ImageData white(1, 1); white.setPixel(0, 0, Color(255, 255, 255)); loadMaterial("white", &white); ImageData black(1, 1); black.setPixel(0, 0, Color(0, 0, 0)); loadMaterial("black", &black); glfwSetMouseButtonCallback(&MousePressedCallback); }
void populateServiceSpecificProtobufStatsList(serviceInstanceApi * servApi, KeyValueList * list) { (servApi->serviceSpecStatsMutex).lock(); list->set_category("Service_Specific_Stats"); for(int i = BASE_INDX_STR_DATA_ARCHIVER_RABBITMQ_STATS; i < BASE_INDX_STR_DATA_ARCHIVER_RABBITMQ_STATS + NUM_INDX_STR_DATA_ARCHIVER_RABBITMQ_STATS; i++) { KeyValue * pair = list->add_element(); pair->set_key((*(servApi->serviceSpecStatsLabels))[i]->c_str()); pair->set_stringval(any_cast<std::string *> ((*(servApi->serviceSpecStatsValues))[i])->c_str()); } for(int i = BASE_INDX_UINT_DATA_ARCHIVER_RABBITMQ_STATS; i < BASE_INDX_UINT_DATA_ARCHIVER_RABBITMQ_STATS + NUM_INDX_UINT_DATA_ARCHIVER_RABBITMQ_STATS; i++) { KeyValue * pair = list->add_element(); pair->set_key((*(servApi->serviceSpecStatsLabels))[i]->c_str()); pair->set_uintegerval(*(any_cast<uint32_t *> ((*(servApi->serviceSpecStatsValues))[i]))); } for(int i = BASE_INDX_INT_DATA_ARCHIVER_RABBITMQ_STATS; i < BASE_INDX_INT_DATA_ARCHIVER_RABBITMQ_STATS + NUM_INDX_INT_DATA_ARCHIVER_RABBITMQ_STATS; i++) { KeyValue * pair = list->add_element(); pair->set_key((*(servApi->serviceSpecStatsLabels))[i]->c_str()); pair->set_integerval(*(any_cast<int32_t *> ((*(servApi->serviceSpecStatsValues))[i]))); } for(int i = BASE_INDX_FLT_DATA_ARCHIVER_RABBITMQ_STATS; i < BASE_INDX_FLT_DATA_ARCHIVER_RABBITMQ_STATS + NUM_INDX_FLT_DATA_ARCHIVER_RABBITMQ_STATS; i++) { KeyValue * pair = list->add_element(); pair->set_key((*(servApi->serviceSpecStatsLabels))[i]->c_str()); pair->set_floatval(*(any_cast<float *> ((*(servApi->serviceSpecStatsValues))[i]))); } (servApi->serviceSpecStatsMutex).unlock(); }