[Smtk-developers] Crazy idea for representing View information

David Thompson david.thompson at kitware.com
Sat Sep 16 16:29:56 EDT 2017


> Since we had the discussion about which JSON library we should be using I've been wondering if instead of the current View Data structure in Common, maybe we should just use a JSON data structure instead?  Any comments?

Besides the view data structure, there may be other classes that would benefit from becoming JSON data. At least smtk::io::Logger comes to mind. If you are worried about logs accumulating records that do not adhere to a convention, we could

class Logger : public json
{
public:
  void addRecord(
    Severity s,
    const json& message,
    const std::string& file,
    unsigned int line)
  {
    this->push_back(
      { "severity": s },
      { "message", message },
      { "file", file },
      { "line", line }
    );
  }

  json record(int recNum) { return (*this)[recNum]; }
}

The same kind of thing could be done for views if need be.

	David


More information about the Smtk-developers mailing list