Ensure that segments with reused metadata are listed in root descriptor.
[cumulus.git] / ref.h
diff --git a/ref.h b/ref.h
index cc21a5a..e499e6e 100644 (file)
--- a/ref.h
+++ b/ref.h
@@ -64,12 +64,17 @@ std::string generate_uuid();
  * and converted to and from the text representation. */
 class ObjectReference {
 public:
+    enum RefType { REF_NULL, REF_ZERO, REF_NORMAL };
+
     ObjectReference();
+    ObjectReference(RefType t);
     ObjectReference(const std::string& segment, int sequence);
     ObjectReference(const std::string& segment, const std::string& sequence);
 
+    bool is_null() const { return type == REF_NULL; }
+    bool is_normal() const { return type == REF_NORMAL; }
     std::string to_string() const;
-    static ObjectReference *parse(const std::string& s);
+    static ObjectReference parse(const std::string& s);
 
     std::string get_segment() const { return segment; }
     std::string get_sequence() const { return object; }
@@ -88,7 +93,10 @@ public:
     void set_range(size_t start, size_t length)
         { range_start = start; range_length = length; range_valid = true; }
 
+    bool merge(ObjectReference ref);
+
 private:
+    RefType type;
     std::string segment, object, checksum;
     size_t range_start, range_length;
     bool checksum_valid, range_valid;