// VisStream.h #ifndef VisStream_H #define VisStream_H // Base class for visualization. // // All visualization streams should inherit from this base. // We expect two kinds of subclasses: // 1. concrete implementing the methods here for a particular // visualization system // 2. abstract adding methods for streaming objects associated // with a specific package or system // // The stream follows the open inventor/VRML hierarchial scene // model. The method add_child may be used to generate a new // separator (equals new stream) at the current point in the // stream. // // VisColor objects may be streamed to define the default color // for objects streamed later. // #include class VisColor; class VisStream { public: // Destructor. virtual ~VisStream(); // Add a substream and return a reference to it. virtual VisStream& add_child() =0; // Set the default color. // RGB model is assumed. virtual void set_color(const VisColor& col) =0; // Write contents to a file. // This file can be processed by an open inventor viewer. virtual void write(std::string filename) =0; }; inline VisStream& operator<<(VisStream& stream, const VisColor& col) { stream.set_color(col); return stream; } #endif