Move range.h to persistent-data
This commit is contained in:
		@@ -21,10 +21,9 @@
 | 
			
		||||
 | 
			
		||||
#include "persistent-data/block.h"
 | 
			
		||||
#include "persistent-data/error_set.h"
 | 
			
		||||
#include "persistent-data/range.h"
 | 
			
		||||
#include "persistent-data/space_map.h"
 | 
			
		||||
 | 
			
		||||
#include "thin-provisioning/range.h"
 | 
			
		||||
 | 
			
		||||
#include <deque>
 | 
			
		||||
 | 
			
		||||
//----------------------------------------------------------------
 | 
			
		||||
@@ -56,7 +55,7 @@ namespace thin_provisioning {
 | 
			
		||||
		bool operator ==(super_block_corruption const &rhs) const;
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	typedef range<uint64_t> range64;
 | 
			
		||||
	typedef base::range<uint64_t> range64;
 | 
			
		||||
 | 
			
		||||
	struct missing_device_details : public metadata_damage {
 | 
			
		||||
		missing_device_details(range64 missing);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,49 +0,0 @@
 | 
			
		||||
#ifndef THIN_RANGE_H
 | 
			
		||||
#define THIN_RANGE_H
 | 
			
		||||
 | 
			
		||||
#include <boost/optional.hpp>
 | 
			
		||||
#include <ostream>
 | 
			
		||||
 | 
			
		||||
//----------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
namespace thin_provisioning {
 | 
			
		||||
	template <typename T>
 | 
			
		||||
	class range {
 | 
			
		||||
	public:
 | 
			
		||||
		typedef boost::optional<T> maybe;
 | 
			
		||||
 | 
			
		||||
		range(maybe begin = maybe(), maybe end = maybe())
 | 
			
		||||
			: begin_(begin),
 | 
			
		||||
			  end_(end) {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		bool operator ==(range<T> const &r) const {
 | 
			
		||||
			return (begin_ == r.begin_ && end_ == r.end_);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		maybe begin_;
 | 
			
		||||
		maybe end_;
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	template <typename T>
 | 
			
		||||
	std::ostream &
 | 
			
		||||
	operator <<(std::ostream &out, range<T> const &r) {
 | 
			
		||||
		if (r.begin_)
 | 
			
		||||
			out << "[" << *r.begin_;
 | 
			
		||||
		else
 | 
			
		||||
			out << "[-";
 | 
			
		||||
 | 
			
		||||
		out << ", ";
 | 
			
		||||
 | 
			
		||||
		if (r.end_)
 | 
			
		||||
			out << *r.end_ << "]";
 | 
			
		||||
		else
 | 
			
		||||
			out << "-]";
 | 
			
		||||
 | 
			
		||||
		return out;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//----------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
		Reference in New Issue
	
	Block a user