ONE - On-device Neural Engine
Loading...
Searching...
No Matches
fme_detect Namespace Reference

Data Structures

struct  EqualizePattern
 
class  EqualizePatternFinder
 

Functions

void write (const std::vector< EqualizePattern > &patterns, const std::string &filename)
 

Function Documentation

◆ write()

void fme_detect::write ( const std::vector< EqualizePattern > &  patterns,
const std::string &  filename 
)

Definition at line 59 of file EqualizePatternWrite.cpp.

60{
61 Json::Value root(Json::arrayValue);
62
63 for (auto &pattern : patterns)
64 {
65 Json::Value p;
66 p["front"] = pattern.front;
67 p["back"] = pattern.back;
68 p["type"] = to_string(pattern.type);
69 root.append(p);
70 }
71
72 Json::StreamWriterBuilder builder;
73 builder["commentStyle"] = "None";
74 builder["indentation"] = " ";
75
76 std::unique_ptr<Json::StreamWriter> writer(builder.newStreamWriter());
77 std::ofstream out(filename);
78 if (out.fail())
79 throw std::runtime_error("Cannot open file \"" + filename + "\".\n");
80
81 writer->write(root, &out);
82}

Referenced by entry().