Merge.
[libdcp.git] / src / asset.h
index fb701570dcf3a9081f3b253b3d0359e44fc51ede..cc6fbcb7c374f7ec06ed98afd004fc2b3e875d1b 100644 (file)
 
 */
 
+/** @file  src/asset.h
+ *  @brief Parent class for assets of DCPs.
+ */
+
 #ifndef LIBDCP_ASSET_H
 #define LIBDCP_ASSET_H
 
 #include <string>
-#include <sigc++/sigc++.h>
+#include <list>
+#include <boost/filesystem.hpp>
+#include "types.h"
 
 namespace ASDCP {
        class WriterInfo;
@@ -30,34 +36,59 @@ namespace ASDCP {
 namespace libdcp
 {
 
-/** Parent class for assets (picture / sound collections) */   
+/** @brief Parent class for assets of DCPs
+ *
+ *  These are collections of pictures or sound.
+ */
 class Asset
 {
 public:
-       Asset (std::string, int, int);
+       /** Construct an Asset.
+        *  @param directory Directory where our XML or MXF file is.
+        *  @param file_name Name of our file within directory, or empty to make one up based on UUID.
+        */
+       Asset (std::string directory, std::string file_name = "");
+
+       virtual ~Asset() {}
+
+       /** Write details of the asset to a CPL stream.
+        *  @param s Stream.
+        */
+       virtual void write_to_cpl (std::ostream& s) const = 0;
 
-       virtual void write_to_cpl (std::ostream &) const = 0;
-       void write_to_pkl (std::ostream &) const;
-       void write_to_assetmap (std::ostream &) const;
+       /** Write details of the asset to a PKL stream.
+        *  @param s Stream.
+        */
+       void write_to_pkl (std::ostream& s) const;
 
-       /** Emitted with a parameter between 0 and 1 to indicate progress in constructing
-        *  this asset.
+       /** Write details of the asset to a ASSETMAP stream.
+        *  @param s Stream.
         */
-       sigc::signal1<void, float> Progress;
+       void write_to_assetmap (std::ostream& s) const;
+
+       std::string uuid () const {
+               return _uuid;
+       }
+
+       virtual bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, std::list<std::string>& notes) const = 0;
 
 protected:
-       void fill_writer_info (ASDCP::WriterInfo *) const;
-
-       /** Path to our MXF file */
-       std::string _mxf_path;
-       /** Frames per second */
-       int _fps;
-       /** Length in frames */
-       int _length;
+       friend class PictureAsset;
+       friend class SoundAsset;
+       
+       std::string digest () const;
+       boost::filesystem::path path () const;
+
+       /** Directory that our MXF or XML file is in */
+       std::string _directory;
+       /** Name of our MXF or XML file */
+       std::string _file_name;
        /** Our UUID */
        std::string _uuid;
-       /** Digest of our MXF */
-       std::string _digest;
+
+private:       
+       /** Digest of our MXF or XML file */
+       mutable std::string _digest;
 };
 
 }