PSS/E Raw data format parser implementation.
More...
#include <algorithm>
#include <cmath>
#include <fstream>
#include <map>
#include <sstream>
#include "Logger.H"
#include "PSSE.H"
#include "Utils.H"
Go to the source code of this file.
|
| static std::vector< std::string > | splitFields (const std::string &line) |
| |
| static bool | isSectionEnd (const std::string &line) |
| |
PSS/E Raw data format parser implementation.
Definition in file PSSE.C.
◆ isSectionEnd()
| static bool isSectionEnd |
( |
const std::string & |
line | ) |
|
|
static |
Definition at line 53 of file PSSE.C.
53 {
54 std::string s =
strip(line);
55 if (s.empty()) return false;
56 return s == "0" || s == "Q"
57 || (s.size() >= 2 && s[0] == '0' && (s[1] == ' ' || s[1] == '/' || s[1] == ','));
58}
std::string strip(const std::string &s)
Strip leading and trailing whitespace from a string.
◆ splitFields()
| static std::vector< std::string > splitFields |
( |
const std::string & |
line | ) |
|
|
static |
Definition at line 39 of file PSSE.C.
39 {
40 std::vector<std::string> fields;
41 std::string data = line;
42 auto slashPos = data.find('/');
43 if (slashPos != std::string::npos)
44 data = data.substr(0, slashPos);
45 std::stringstream ss(data);
46 std::string field;
47 while (std::getline(ss, field, ',')) {
48 fields.push_back(
strip(field));
49 }
50 return fields;
51}