Kinetic C/C++ Client
 All Classes Functions Variables Pages
kinetic_record.h
1 /*
2  * kinetic-cpp-client
3  * Copyright (C) 2014 Seagate Technology.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  *
19  */
20 
21 #ifndef KINETIC_CPP_CLIENT_KINETIC_RECORD_H_
22 #define KINETIC_CPP_CLIENT_KINETIC_RECORD_H_
23 
24 #include <memory>
25 #include "kinetic/common.h"
26 #include "kinetic_client.pb.h"
27 
28 namespace kinetic {
29 
30 using com::seagate::kinetic::client::proto::Command_Algorithm;
31 using std::shared_ptr;
32 using std::string;
33 using std::make_shared;
34 
35 
39  public:
40  KineticRecord(const shared_ptr<const string> value, const shared_ptr<const string> version,
41  const shared_ptr<const string> tag, Command_Algorithm algorithm) :
42  value_(value), version_(version), tag_(tag), algorithm_(
43  algorithm) {
44  }
45  KineticRecord(const string value, const string version, const string tag,
46  Command_Algorithm algorithm) :
47  value_(make_shared<string>(value)), version_(make_shared<string>(version)),
48  tag_(make_shared<string>(tag)), algorithm_(algorithm) {
49  }
50  explicit KineticRecord(const KineticRecord& other) : value_(other.value_),
51  version_(other.version_), tag_(other.tag_), algorithm_(other.algorithm_) {
52  }
53 
55  const shared_ptr<const string> value() const {
56  return value_;
57  }
58 
60  const shared_ptr<const string> version() const {
61  return version_;
62  }
63 
66  const shared_ptr<const string> tag() const {
67  return tag_;
68  }
69 
71  Command_Algorithm algorithm() const {
72  return algorithm_;
73  }
74 
75  private:
76  const shared_ptr<const string> value_;
77  const shared_ptr<const string> version_;
78  const shared_ptr<const string> tag_;
79  const Command_Algorithm algorithm_;
80  // disallow operator=
81  void operator=(const KineticRecord&);
82 };
83 
84 } // namespace kinetic
85 
86 #endif // KINETIC_CPP_CLIENT_KINETIC_RECORD_H_
const shared_ptr< const string > value() const
The value itself.
const shared_ptr< const string > tag() const
An arbitrary tag, usually a hash or checksum of the value.
const shared_ptr< const string > version() const
The value's version.
Command_Algorithm algorithm() const
The algorithm used to generate the tag.
Encapsulates a single value stored in a Kinetic drive and the associated metadata.