CYCLUS
blob.h
Go to the documentation of this file.
1 #ifndef CYCLUS_SRC_BLOB_H_
2 #define CYCLUS_SRC_BLOB_H_
3 
4 #include <string>
5 
6 namespace cyclus {
7 /// A type to represent variable-length array of bytes for dumping to a cyclus
8 /// output database.
9 class Blob {
10  public:
11  Blob() : str_("") {}
12 
13  explicit Blob(std::string s) : str_(s) {}
14 
15  const std::string& str() const {
16  return str_;
17  }
18 
19  inline std::ostream& operator<<(std::ostream& out) const {
20  return out << str();
21  }
22 
23  inline bool operator< (const cyclus::Blob& rhs) const {
24  return str() < rhs.str();
25  }
26 
27  inline bool operator> (const cyclus::Blob& rhs) const {
28  return !operator<(rhs) && !operator==(rhs);
29  }
30 
31  inline bool operator<=(const cyclus::Blob& rhs) const {
32  return !operator>(rhs);
33  }
34 
35  inline bool operator>=(const cyclus::Blob& rhs) const {
36  return !operator<(rhs);
37  }
38 
39  inline bool operator==(const cyclus::Blob& rhs) const {
40  return str() == rhs.str();
41  }
42 
43  inline bool operator!=(const cyclus::Blob& rhs) const {
44  return !operator==(rhs);
45  }
46 
47  private:
48  std::string str_;
49 };
50 
51 } // namespace cyclus
52 
53 #endif // CYCLUS_SRC_BLOB_H_
std::ostream & operator<<(std::ostream &out) const
Definition: blob.h:19
Blob()
Definition: blob.h:11
const std::string & str() const
Definition: blob.h:15
bool operator<(const cyclus::Blob &rhs) const
Definition: blob.h:23
Blob(std::string s)
Definition: blob.h:13
bool operator!=(const cyclus::Blob &rhs) const
Definition: blob.h:43
bool operator>(const cyclus::Blob &rhs) const
Definition: blob.h:27
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.
Definition: agent.cc:14
A type to represent variable-length array of bytes for dumping to a cyclus output database...
Definition: blob.h:9
bool operator==(const cyclus::Blob &rhs) const
Definition: blob.h:39
bool operator<=(const cyclus::Blob &rhs) const
Definition: blob.h:31
bool operator>=(const cyclus::Blob &rhs) const
Definition: blob.h:35