]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/DataObject.h
Moved to version 1.0
[cpPlugins.git] / lib / cpPlugins / DataObject.h
diff --git a/lib/cpPlugins/DataObject.h b/lib/cpPlugins/DataObject.h
new file mode 100644 (file)
index 0000000..935274b
--- /dev/null
@@ -0,0 +1,58 @@
+// =========================================================================
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// =========================================================================
+#ifndef __cpPlugins__DataObject__h__
+#define __cpPlugins__DataObject__h__
+
+#include <cpPlugins/Object.h>
+
+namespace cpPlugins
+{
+  class ProcessObject;
+
+  /*! \brief Base class for all data objects.
+   *
+   * This class is intended to be the base for all data objects. It
+   * inherits from cpPlugins::Object and it serves as inputs or
+   * outputs in cpPlugins::ProcessObject objects. Think of it as edges
+   * in a graph.
+   */
+  class CPPLUGINS_EXPORT DataObject
+    : public Object
+  {
+    cpPluginsTypeMacro( DataObject, Object );
+    cpPluginsNewMacro( );
+
+  public:
+    virtual bool IsUpdated(
+      const TTimeStamp& d = TTimeRep::now( )
+      ) const override;
+
+    /*! @defgroup m_Source
+     * This object's source. This soft association (i.e. it could be
+     * NULL) allows navigation over pipeline's (graph) edges.
+     * @{
+     */
+    void DisconnectPipeline( );
+    void SetSource( ProcessObject* source );
+    void Update( );
+    //! @}
+
+  protected:
+    /*! In order to correctly handle memory with std::shared_pointer<>,
+     *  constructors and destructor should be "invisible" to the user.
+     * @{
+     */
+    DataObject( );
+    virtual ~DataObject( );
+    //! @}
+
+  protected:
+    //! @ingroup m_Source
+    std::weak_ptr< ProcessObject > m_Source;
+  }; // end class
+} // end namespace
+
+#endif // __cpPlugins__DataObject__h__
+
+// eof - $RCSfile$