Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

davis maker script #66

Merged
merged 4 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions array_core/array_core.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#ifndef ARRAY_CORE_ARRAY_CORE_H_
#define ARRAY_CORE_ARRAY_CORE_H_

//#START_GRAB_TO_INCLUDES_LIST
#include <iostream>
#include <vector>
//#STOP_GRAB_TO_INCLUDES_LIST
#include "plotly_maker/plotly_maker.h"
#include "common_utils/common_utils.h"
#include "common_utils/common_constants.h"

namespace davis {
//#START_GRAB_TO_DAVIS_NAMESPACE

using std::vector;
using std::string;
Expand Down Expand Up @@ -137,7 +139,7 @@ bool show(const T* data, uint64_t count, const string& title,
res = davis::showLineChartInBrowser(dblRow, title, static_cast<const ShowSettingsChart*>(settings));
return res;
}

} // namespace davis
//#STOP_GRAB_TO_DAVIS_NAMESPACE
} // end namespace davis

#endif //ARRAY_CORE_ARRAY_CORE_H_
2 changes: 2 additions & 0 deletions common_utils/common_constants.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include "common_constants.h"

namespace davis {
//#START_GRAB_TO_DAVIS_NAMESPACE
const char kAppName[] = "davis";
const char kOutFolderName[] = "davis_htmls/";
const char kPlotlyJsWorkPath[] = "./davis_htmls/plotly-2.27.0.min.js";
const char kPlotlyJsName[] = "plotly-2.27.0.min.js";
const char kPlotlyJsResourcePath[] = "plotly_maker/plotly-2.27.0.min.js";
//#STOP_GRAB_TO_DAVIS_NAMESPACE
}
2 changes: 2 additions & 0 deletions common_utils/common_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
#define COMMON_UTILS_COMMON_CONSTANTS_H

namespace davis {
//#START_GRAB_TO_DAVIS_NAMESPACE
extern const char kAppName[];
extern const char kOutFolderName[];
extern const char kPlotlyJsName[];
extern const char kPlotlyJsResourcePath[];
extern const char kPlotlyJsWorkPath[];
//#STOP_GRAB_TO_DAVIS_NAMESPACE
}

#endif // COMMON_UTILS_COMMON_CONSTANTS_H
17 changes: 10 additions & 7 deletions common_utils/common_utils.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#include "common_utils.h"
#include "fstream"
#include "common_constants.h"

//#START_GRAB_TO_INCLUDES_LIST
#include <fstream>
#include <iostream>
#include <sstream>
#include "common_constants.h"
#include <sys/stat.h>
//#STOP_GRAB_TO_INCLUDES_LIST

namespace {

//#START_GRAB_TO_NAMESPACE
using std::string;

#ifdef _WIN32
Expand Down Expand Up @@ -39,11 +42,11 @@ void openFileBySystem(const string& file_name) {
command.append(file_name);
system(command.c_str());
}

//#STOP_GRAB_TO_NAMESPACE
} // namespace

namespace davis {

//#START_GRAB_TO_DAVIS_NAMESPACE
string getCurrentPath() {
#if defined (_WIN32) || (__linux__)
char buffer[1024];
Expand Down Expand Up @@ -157,7 +160,7 @@ bool readMatrix(vector<vector<double>>& outMatrix, const std::string& path, char
}
}

std::vector<std::string> split(const std::string& target, char c) {
vector<string> split(const string& target, char c) {
std::string temp;
std::stringstream stringstream { target };
std::vector<std::string> result;
Expand All @@ -167,5 +170,5 @@ std::vector<std::string> split(const std::string& target, char c) {

return result;
}

//#STOP_GRAB_TO_DAVIS_NAMESPACE
}; // namespace davis
9 changes: 6 additions & 3 deletions common_utils/common_utils.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#ifndef COMMON_UTILS_COMMON_UTILS_H_
#define COMMON_UTILS_COMMON_UTILS_H_
//#START_GRAB_TO_INCLUDES_LIST
#include <string>
#include <vector>
//#STOP_GRAB_TO_INCLUDES_LIST

namespace davis {

//#START_GRAB_TO_DAVIS_NAMESPACE
using std::string;
using std::vector;

std::string getCurrentPath();
string getCurrentPath();

bool isPlotlyScriptExists();

Expand All @@ -23,14 +25,15 @@ void openPlotlyHtml(const string& file_name);

bool getDataFromFile(const string& path, string& result);

std::vector<std::string> split(const std::string& target, char c);
vector<string> split(const string& target, char c);

bool readMatrix(vector<vector<double>>& outMatrix, const string& path, char dlmtr);


// Now it doesn't work.
bool deleteFolder(const char* fname);

//#STOP_GRAB_TO_DAVIS_NAMESPACE
}; // namespace davis

#endif // COMMON_UTILS_COMMON_UTILS_H_
9 changes: 9 additions & 0 deletions davis_files.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
common_utils/common_constants.cpp
common_utils/common_constants.h
plotly_maker/html_parts.h
plotly_maker/html_parts.cpp
common_utils/common_utils.cpp
common_utils/common_utils.h
plotly_maker/plotly_maker.h
plotly_maker/plotly_maker.cpp
array_core/array_core.h
Loading
Loading