Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
nodegraphhandler.h
Go to the documentation of this file.
1 
18 #ifndef ION_REMOTE_NODEGRAPHHANDLER_H_
19 #define ION_REMOTE_NODEGRAPHHANDLER_H_
20 
21 #include <string>
22 #include <vector>
23 
24 #include "ion/gfx/node.h"
25 #include "ion/gfxutils/frame.h"
26 #include "ion/gfxutils/printer.h"
27 #include "ion/remote/httpserver.h"
28 
29 namespace ion {
30 namespace remote {
31 
38  public:
40  ~NodeGraphHandler() override;
41 
45  void SetFrame(const gfxutils::FramePtr& frame) { frame_ = frame; }
46  const gfxutils::FramePtr& GetFrame() const { return frame_; }
47 
49  void AddNode(const gfx::NodePtr& node);
50 
53  bool RemoveNode(const gfx::NodePtr& node);
54 
56  bool IsNodeTracked(const gfx::NodePtr& node) const;
57 
59  size_t GetTrackedNodeCount() const { return nodes_.size(); }
60 
61  const std::string HandleRequest(const std::string& path,
62  const HttpServer::QueryMap& args,
63  std::string* content_type) override;
64 
65  private:
67  void SetUpPrinter(const HttpServer::QueryMap& args,
68  gfxutils::Printer* printer);
69 
71  const std::string GetPrintString(gfxutils::Printer* printer);
72 
74  std::vector<gfx::NodePtr> nodes_;
76  gfxutils::FramePtr frame_;
77 };
79 
80 } // namespace remote
81 } // namespace ion
82 
83 #endif // ION_REMOTE_NODEGRAPHHANDLER_H_
const gfxutils::FramePtr & GetFrame() const
size_t GetTrackedNodeCount() const
Returns the number of nodes being tracked. (Useful for testing.)
void SetFrame(const gfxutils::FramePtr &frame)
Sets/returns the Frame object used to access the current frame.
NodeGraphHandler serves files to display Ion node graphs as text or HTML using the gfxutils::Printer ...
std::map< std::string, std::string > QueryMap
Definition: httpserver.h:35
RequestHandlers handle requests for a file or path.
Definition: httpserver.h:68
A SharedPtr is a smart shared pointer to an instance of some class that implements reference counting...
Definition: sharedptr.h:60
base::ReferentPtr< NodeGraphHandler >::Type NodeGraphHandlerPtr
The Printer class can be used for debugging.
Definition: printer.h:31