#ifndef GRAPH_H #define GRAPH_H /* Represents a graph of rotor nodes and includes methods to manipulate nodes TJR Jan 2014 */ #include "rotor.h" #include "factory.h" #include "Poco/File.h" #include "Poco/FileStream.h" #include "Poco/CountingStream.h" #include "Poco/StreamCopier.h" namespace Rotor { class Graph{ public: Graph(){init();}; Graph(const std::string& _id){ init(_id); }; void init(const std::string& _id=""){ id=_id; loaded=false; audio_loaded=false; cancelled=false; //audio_thumb=new Audio_thumbnailer(); //Log_name=""; }; ~Graph(){ clear(); //delete audio_thumb; }; void clear(){ for (auto n: nodes) { delete n.second; } nodes.clear(); loaded=false; } //how to do output? //think video_render should be part of render context //graph should just encapsulate the manipulation of the graph //specific nodes can be created as output targets std::vector find_nodes(const std::string &type); Node* find_node(const std::string &type); Node* get_node(const std::string &id); //--context// Json::Value signal_render(const std::string &node,const double framerate); //--context// bool video_render(const std::string &output_filename,const double framerate,int start, int end); bool load_file(std::string filename,std::string media_path); bool parse_json(std::string &data,std::string &media_path); //--context// Json::Value preview(std::string &node ,std::string &format,int frame,int w,int h); bool check_audio (std::string audio ,std::string path); //--context// Json::Value print_features (std::string &node); //bool load_audio(const std::string &filename, std::vector processors); //bool load_video(const std::string &node_id,const std::string &filename); //load audio and video should be methods of the nodes themselves? bool loaded; bool audio_loaded; std::string audio_filename; bool cancelled; double progress; //void set_log_name (std::string _Log_name){ //log name should be the same as the graph uid //Log_name=_Log_name; //} //Audio_thumbnailer *audio_thumb; private: std::string id; std::unordered_map nodes; }; } #endif //GRAPH_H