Kinetic C/C++ Client
 All Classes Functions Variables Pages
outgoing_value.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_OUTGOING_VALUE_H_
22 #define KINETIC_CPP_CLIENT_OUTGOING_VALUE_H_
23 
24 #include <string>
25 
26 #include "common.h"
27 
28 namespace kinetic {
29 
31  public:
32  virtual ~OutgoingValueInterface() {}
33  virtual size_t size() const = 0;
34  virtual bool TransferToSocket(int fd, int* err) const = 0;
35  virtual bool ToString(std::string *result, int* err) const = 0;
36 };
37 
39  public:
40  explicit OutgoingStringValue(const std::string &s);
41  size_t size() const;
42  bool TransferToSocket(int fd, int* err) const;
43  bool ToString(std::string *result, int* err) const;
44 
45  private:
46  const std::string s_;
47  DISALLOW_COPY_AND_ASSIGN(OutgoingStringValue);
48 };
49 
50 } // namespace kinetic
51 
52 #endif // KINETIC_CPP_CLIENT_OUTGOING_VALUE_H_