Use a typedef for a note-taking functor.
authorCarl Hetherington <cth@carlh.net>
Wed, 7 Jan 2015 10:23:39 +0000 (10:23 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 7 Jan 2015 10:23:39 +0000 (10:23 +0000)
27 files changed:
src/asset.cc
src/asset.h
src/cpl.cc
src/cpl.h
src/dcp.cc
src/dcp.h
src/interop_subtitle_content.cc
src/interop_subtitle_content.h
src/mono_picture_mxf.cc
src/mono_picture_mxf.h
src/mxf.cc
src/mxf.h
src/picture_mxf.cc
src/picture_mxf.h
src/reel.cc
src/reel.h
src/reel_asset.cc
src/reel_asset.h
src/reel_picture_asset.cc
src/reel_picture_asset.h
src/sound_mxf.cc
src/sound_mxf.h
src/stereo_picture_mxf.cc
src/stereo_picture_mxf.h
src/subtitle_content.cc
src/subtitle_content.h
src/types.h

index e2dcc0f60eea51259a17fdc61970d8350ddca3db..7e60ecc5300dfc80af79c8a524c5193a887b650e 100644 (file)
@@ -94,7 +94,7 @@ Asset::hash (function<void (float)> progress) const
 }
 
 bool
-Asset::equals (boost::shared_ptr<const Asset> other, EqualityOptions, function<void (NoteType, string)> note) const
+Asset::equals (boost::shared_ptr<const Asset> other, EqualityOptions, NoteHandler note) const
 {
        if (_hash != other->_hash) {
                note (DCP_ERROR, "Asset: hashes differ");
index ea0efe49589dc91b9c9b253426603bf36599763f..2712dcb889d08538b7b1cfbff9c910961a8c38aa 100644 (file)
@@ -51,7 +51,7 @@ public:
        virtual bool equals (
                boost::shared_ptr<const Asset> other,
                EqualityOptions opt,
-               boost::function<void (NoteType, std::string)> note
+               NoteHandler note
                ) const;
 
        /** Write details of the asset to a ASSETMAP.
index b5b4d7152601de2ed84591507abfdc81e4323903..b0fc8d77bd8ef3a7f0bebf8a7221caf14928b55b 100644 (file)
@@ -171,7 +171,7 @@ CPL::reel_assets () const
 }
        
 bool
-CPL::equals (shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
+CPL::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler note) const
 {
        shared_ptr<const CPL> other_cpl = dynamic_pointer_cast<const CPL> (other);
        if (!other_cpl) {
index b85b0395aa047c43acd10300a21c26716005f5e2..4993bcd5a6a5e5bc7cd2685f40071f17fb314224 100644 (file)
--- a/src/cpl.h
+++ b/src/cpl.h
@@ -57,7 +57,7 @@ public:
        bool equals (
                boost::shared_ptr<const Asset> other,
                EqualityOptions options,
-               boost::function<void (NoteType, std::string)> note
+               NoteHandler note
                ) const;
 
        void add (boost::shared_ptr<Reel> reel);
index 589e3b3be70d54d3042b48f2cbd93e9e5427ea5d..dd360edd5f22f21d5095fa3cf30b88cea753368f 100644 (file)
@@ -173,7 +173,7 @@ DCP::read (bool keep_going, ReadErrors* errors)
 }
 
 bool
-DCP::equals (DCP const & other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
+DCP::equals (DCP const & other, EqualityOptions opt, NoteHandler note) const
 {
        list<shared_ptr<CPL> > a = cpls ();
        list<shared_ptr<CPL> > b = other.cpls ();
index a7dbf5ebf9cb0dc1dc18b18610ff9987cc87438d..effadfa3ebeb2b8f3538122359028b5415d572dc 100644 (file)
--- a/src/dcp.h
+++ b/src/dcp.h
@@ -84,7 +84,7 @@ public:
         *  @param note Functor to handle notes made by the equality operation.
         *  @return true if the DCPs are equal according to EqualityOptions, otherwise false.
         */
-       bool equals (DCP const & other, EqualityOptions options, boost::function<void (NoteType, std::string)> note) const;
+       bool equals (DCP const & other, EqualityOptions options, NoteHandler note) const;
 
        void add (boost::shared_ptr<Asset> asset);
 
index 45977d67da96677250dca452c7d9ec126e16cdd9..218dbaea26887a3e44129c99341f73b749a42d33 100644 (file)
@@ -26,7 +26,6 @@
 using std::list;
 using std::string;
 using boost::shared_ptr;
-using boost::function;
 using boost::optional;
 using boost::dynamic_pointer_cast;
 using namespace dcp;
@@ -174,7 +173,7 @@ InteropSubtitleContent::add_font (string id, string uri)
 }
 
 bool
-InteropSubtitleContent::equals (shared_ptr<const Asset> other_asset, EqualityOptions options, function<void (NoteType, std::string)> note) const
+InteropSubtitleContent::equals (shared_ptr<const Asset> other_asset, EqualityOptions options, NoteHandler note) const
 {
        if (!SubtitleContent::equals (other_asset, options, note)) {
                return false;
index adb45c6b72d63287adbd62c9d6e60b29d223ddac..98a4b599327bb144dcc6d4ada4e923edb657f2b4 100644 (file)
@@ -33,7 +33,7 @@ public:
        bool equals (
                boost::shared_ptr<const Asset>,
                EqualityOptions,
-               boost::function<void (NoteType, std::string)> note
+               NoteHandler note
                ) const;
 
        std::list<boost::shared_ptr<LoadFont> > load_font_nodes () const;
index 57a0d0a93cf2210b88cf1f3a91b8bde249f149b2..4114f5ade6f146075904b0dc9ff5b96b29e359a8 100644 (file)
@@ -70,7 +70,7 @@ MonoPictureMXF::get_frame (int n) const
 }
 
 bool
-MonoPictureMXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
+MonoPictureMXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler note) const
 {
        if (!dynamic_pointer_cast<const MonoPictureMXF> (other)) {
                return false;
index 01a6de3fab9156a9cacccf6d47b3ef16eb79ef94..4e5211ca4c6a4f4ca2c574c25057620e4100901b 100644 (file)
@@ -48,7 +48,7 @@ public:
        bool equals (
                boost::shared_ptr<const Asset> other,
                EqualityOptions opt,
-               boost::function<void (NoteType, std::string)> note
+               NoteHandler note
                ) const;
        
        boost::shared_ptr<const MonoPictureFrame> get_frame (int n) const;
index 6707b63843f68695883ae04d47069bbc1681a4d3..442eb696b62cc347d86031dde771e0822dc7955a 100644 (file)
@@ -93,7 +93,7 @@ MXF::fill_writer_info (ASDCP::WriterInfo* writer_info, Standard standard)
 }
 
 bool
-MXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
+MXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler note) const
 {
        if (!Content::equals (other, opt, note)) {
                return false;
index f7b94bd2555cdb8faee3081a41de8c25b5fa43b8..f0ad4bd837cf2671312a6194a9467f195ae271b7 100644 (file)
--- a/src/mxf.h
+++ b/src/mxf.h
@@ -52,7 +52,7 @@ public:
        bool equals (
                boost::shared_ptr<const Asset> other,
                EqualityOptions opt,
-               boost::function<void (NoteType, std::string)> note
+               NoteHandler note
                ) const;
 
        /** Fill in a ADSCP::WriteInfo struct.
index 1f863eb1272030cfdfaecf7b9e4df09690742437..0991cd50e52d749e6afb4514ab2bc66c16fdee8a 100644 (file)
@@ -71,7 +71,7 @@ PictureMXF::read_picture_descriptor (ASDCP::JP2K::PictureDescriptor const & desc
 
 bool
 PictureMXF::descriptor_equals (
-       ASDCP::JP2K::PictureDescriptor const & a, ASDCP::JP2K::PictureDescriptor const & b, boost::function<void (NoteType, string)> note
+       ASDCP::JP2K::PictureDescriptor const & a, ASDCP::JP2K::PictureDescriptor const & b, NoteHandler note
        ) const
 {
        if (
@@ -113,7 +113,7 @@ PictureMXF::descriptor_equals (
 
 bool
 PictureMXF::frame_buffer_equals (
-       int frame, EqualityOptions opt, boost::function<void (NoteType, string)> note,
+       int frame, EqualityOptions opt, NoteHandler note,
        uint8_t const * data_A, unsigned int size_A, uint8_t const * data_B, unsigned int size_B
        ) const
 {
index bf8fcf763f5a0824055e2ff32d89a7c3a16bd203..75119367986cab8dc8edd05e4e3b280c79fb2f3b 100644 (file)
@@ -84,14 +84,14 @@ public:
 protected:
 
        bool frame_buffer_equals (
-               int frame, EqualityOptions opt, boost::function<void (NoteType, std::string)> note,
+               int frame, EqualityOptions opt, NoteHandler note,
                uint8_t const * data_A, unsigned int size_A, uint8_t const * data_B, unsigned int size_B
                ) const;
 
        bool descriptor_equals (
                ASDCP::JP2K::PictureDescriptor const & a,
                ASDCP::JP2K::PictureDescriptor const & b,
-               boost::function<void (NoteType, std::string)>
+               NoteHandler note
                ) const;
 
        void read_picture_descriptor (ASDCP::JP2K::PictureDescriptor const &);
index 0071de868497a121aa79361d3a5c210dd7101e79..9e6e0ca73a20320615808dd649be059148f17763 100644 (file)
@@ -95,7 +95,7 @@ Reel::write_to_cpl (xmlpp::Element* node, Standard standard) const
 }
        
 bool
-Reel::equals (boost::shared_ptr<const Reel> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
+Reel::equals (boost::shared_ptr<const Reel> other, EqualityOptions opt, NoteHandler note) const
 {
        if ((_main_picture && !other->_main_picture) || (!_main_picture && other->_main_picture)) {
                note (DCP_ERROR, "Reel: assets differ");
index 584ba5978c11046fc5f4c9d9211d90da6cfa2976..278a0f916a23000c78e423c6a5a13b9909148af4 100644 (file)
@@ -77,7 +77,7 @@ public:
 
        bool encrypted () const;
 
-       bool equals (boost::shared_ptr<const Reel> other, EqualityOptions opt, boost::function<void (NoteType, std::string)> notes) const;
+       bool equals (boost::shared_ptr<const Reel> other, EqualityOptions opt, NoteHandler notes) const;
 
        void add (DecryptedKDM const &);
 
index 314221734c9b3b6ecd76dbd9e719a6776ea218d1..037a39780e55a4a5f43eee630da1955ce77611a6 100644 (file)
@@ -100,7 +100,7 @@ ReelAsset::cpl_node_attribute (Standard) const
 }
 
 bool
-ReelAsset::equals (shared_ptr<const ReelAsset> other, EqualityOptions opt, boost::function<void (NoteType, std::string)> note) const
+ReelAsset::equals (shared_ptr<const ReelAsset> other, EqualityOptions opt, NoteHandler note) const
 {
        if (_annotation_text != other->_annotation_text) {
                stringstream s;
index 61d2b48f0c5c4ec0e397eaac3e0bd16dc80cee3a..6db621ccf0b90c073dbfb6a6423eae2f49dfec2d 100644 (file)
@@ -52,7 +52,7 @@ public:
        ReelAsset (boost::shared_ptr<const cxml::Node>);
 
        virtual void write_to_cpl (xmlpp::Node* node, Standard standard) const;
-       virtual bool equals (boost::shared_ptr<const ReelAsset>, EqualityOptions, boost::function<void (NoteType, std::string)>) const;
+       virtual bool equals (boost::shared_ptr<const ReelAsset>, EqualityOptions, NoteHandler) const;
 
        /** @return a Ref to our actual content */
        Ref<Content>& content () {
index 5cf2b858716a928129a248d2833899bb05235966..6bac3bce5f47d21fe3563f8cd72a2d460f28a608 100644 (file)
@@ -100,7 +100,7 @@ ReelPictureAsset::key_type () const
 }
 
 bool
-ReelPictureAsset::equals (shared_ptr<const ReelAsset> other, EqualityOptions opt, boost::function<void (NoteType, std::string)> note) const
+ReelPictureAsset::equals (shared_ptr<const ReelAsset> other, EqualityOptions opt, NoteHandler note) const
 {
        if (!ReelAsset::equals (other, opt, note)) {
                return false;
index 76ba22c9e458fbfad9c2361d673908251cf2a36e..96c4b63b0f9ceacac8da033857016535cc51ad22 100644 (file)
@@ -40,7 +40,7 @@ public:
        ReelPictureAsset (boost::shared_ptr<const cxml::Node>);
 
        virtual void write_to_cpl (xmlpp::Node* node, Standard standard) const;
-       virtual bool equals (boost::shared_ptr<const ReelAsset>, EqualityOptions, boost::function<void (NoteType, std::string)>) const;
+       virtual bool equals (boost::shared_ptr<const ReelAsset>, EqualityOptions, NoteHandler) const;
 
        boost::shared_ptr<PictureMXF> mxf () {
                return boost::dynamic_pointer_cast<PictureMXF> (_content.object ());
index 05dac418e752613d80e01452c16823330fea62da..e338c16165abb2db3b28e519d3edd2f7270d88b9 100644 (file)
@@ -82,7 +82,7 @@ SoundMXF::SoundMXF (Fraction edit_rate, int sampling_rate, int channels)
 }
 
 bool
-SoundMXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
+SoundMXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler note) const
 {
        if (!MXF::equals (other, opt, note)) {
                return false;
index d6978953f6ffaeb18e6fc6eea3ce39137498fe9f..80585055ae13b798fe84e6f160ce58e09326020f 100644 (file)
@@ -48,7 +48,7 @@ public:
        bool equals (
                boost::shared_ptr<const Asset> other,
                EqualityOptions opt,
-               boost::function<void (NoteType, std::string)> note
+               NoteHandler note
                ) const;
 
        boost::shared_ptr<const SoundFrame> get_frame (int n) const;
index 1c8fa6180949696e0553bf827511879d10a84fd4..e68921e3f9e9a605b80011deab3104fd5b9b610a 100644 (file)
@@ -75,7 +75,7 @@ StereoPictureMXF::start_write (boost::filesystem::path file, Standard standard,
 }
 
 bool
-StereoPictureMXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
+StereoPictureMXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler note) const
 {
        if (!MXF::equals (other, opt, note)) {
                return false;
index 9592653eb845ffc018193f5d402877e4a08cee98..9a094d19b52d29699910edaf59985705242f56ef 100644 (file)
@@ -37,7 +37,7 @@ public:
        bool equals (
                boost::shared_ptr<const Asset> other,
                EqualityOptions opt,
-               boost::function<void (NoteType, std::string)> note
+               NoteHandler note
                ) const;
        
        boost::shared_ptr<const StereoPictureFrame> get_frame (int n) const;
index 5e7c5b257001b666e5c415596df9f32a744a66bd..07fd90f01ebb0357a37cb9f12cda40c472b9d07a 100644 (file)
@@ -39,7 +39,6 @@ using std::stringstream;
 using std::cout;
 using boost::shared_ptr;
 using boost::optional;
-using boost::function;
 using boost::dynamic_pointer_cast;
 using namespace dcp;
 
@@ -196,7 +195,7 @@ SubtitleContent::latest_subtitle_out () const
 }
 
 bool
-SubtitleContent::equals (shared_ptr<const Asset> other_asset, EqualityOptions options, function<void (NoteType, std::string)> note) const
+SubtitleContent::equals (shared_ptr<const Asset> other_asset, EqualityOptions options, NoteHandler note) const
 {
        if (!Asset::equals (other_asset, options, note)) {
                return false;
index 7121387ace45eb9ae6a21750789844d3c2d3f627..0ef7b19d478a3e3438cadcf997c2160fae7c953e 100644 (file)
@@ -46,7 +46,7 @@ public:
        bool equals (
                boost::shared_ptr<const Asset>,
                EqualityOptions,
-               boost::function<void (NoteType, std::string)> note
+               NoteHandler note
                ) const;
 
        std::string language () const {
index f685806ffc77252507252c48b2c76501c671af59..08613c79774fb8a01980c0ef74e390958b5aff0c 100644 (file)
@@ -25,6 +25,7 @@
 #define LIBDCP_TYPES_H
 
 #include <boost/shared_ptr.hpp>
+#include <boost/function.hpp>
 #include <string>
 
 namespace dcp
@@ -187,6 +188,9 @@ extern std::ostream & operator<< (std::ostream & s, Colour const & c);
 
 typedef std::pair<std::string, boost::shared_ptr<const parse::AssetMap> > PathAssetMap;
 
+typedef boost::function<void (NoteType, std::string)> NoteHandler;
+
+
 }
 
 #endif