-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Client side unary communication performance improvements (#335)
- Loading branch information
1 parent
bd323d9
commit 0020685
Showing
18 changed files
with
925 additions
and
624 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-284 Bytes
(99%)
labview source/gRPC lv Support/Client API/Client Unary Call.vim
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,52 @@ | ||
#include "feature_toggles.h" | ||
#include <feature_toggles.h> | ||
#include <iostream> | ||
#include <fstream> | ||
#include <sstream> | ||
#include <map> | ||
|
||
// Function to read feature configurations from an INI file | ||
void FeatureConfig::readConfigFromFile(const std::string& filePath) { | ||
std::ifstream configFile(filePath); | ||
if (!configFile.is_open()) { | ||
return; | ||
} | ||
namespace grpc_labview { | ||
// Function to read feature configurations from an INI file | ||
void FeatureConfig::readConfigFromFile(const std::string& filePath) { | ||
std::ifstream configFile(filePath); | ||
if (!configFile.is_open()) { | ||
return; | ||
} | ||
|
||
std::string line; | ||
std::string currentSection; // For handling INI sections | ||
std::string line; | ||
std::string currentSection; // For handling INI sections | ||
|
||
while (std::getline(configFile, line)) { | ||
// Trim leading and trailing whitespaces | ||
line.erase(line.find_last_not_of(" \t") + 1); | ||
line.erase(0, line.find_first_not_of(" \t")); | ||
while (std::getline(configFile, line)) { | ||
// Trim leading and trailing whitespaces | ||
line.erase(line.find_last_not_of(" \t") + 1); | ||
line.erase(0, line.find_first_not_of(" \t")); | ||
|
||
// Skip comments and empty lines | ||
if (line.empty() || line[0] == ';') { | ||
continue; | ||
} | ||
// Skip comments and empty lines | ||
if (line.empty() || line[0] == ';') { | ||
continue; | ||
} | ||
|
||
// Check for section header | ||
if (line[0] == '[' && line[line.length() - 1] == ']') { | ||
currentSection = line.substr(1, line.length() - 2); | ||
} else { | ||
// Parse key-value pairs | ||
std::istringstream iss(line); | ||
std::string key, value; | ||
if (std::getline(iss, key, '=') && std::getline(iss, value)) { | ||
// Append section name to key for uniqueness | ||
std::string fullKey = currentSection.empty() ? key : currentSection + "_" + key; | ||
featureFlags[fullKey] = (value == "true"); | ||
// Check for section header | ||
if (line[0] == '[' && line[line.length() - 1] == ']') { | ||
currentSection = line.substr(1, line.length() - 2); | ||
} | ||
else { | ||
// Parse key-value pairs | ||
std::istringstream iss(line); | ||
std::string key, value; | ||
if (std::getline(iss, key, '=') && std::getline(iss, value)) { | ||
// Append section name to key for uniqueness | ||
std::string fullKey = currentSection.empty() ? key : currentSection + "_" + key; | ||
featureFlags[fullKey] = (value == "true"); | ||
} | ||
} | ||
} | ||
} | ||
|
||
configFile.close(); | ||
} | ||
configFile.close(); | ||
} | ||
|
||
// Function to check if a feature is enabled | ||
bool FeatureConfig::isFeatureEnabled(const std::string& featureName) const { | ||
auto it = featureFlags.find(featureName); | ||
return (it != featureFlags.end()) ? it->second : false; | ||
// Function to check if a feature is enabled | ||
bool FeatureConfig::isFeatureEnabled(const std::string& featureName) const { | ||
auto it = featureFlags.find(featureName); | ||
return (it != featureFlags.end()) ? it->second : false; | ||
} | ||
} |
Oops, something went wrong.