CYCLUS
Loading...
Searching...
No Matches
commodity.h
Go to the documentation of this file.
1#ifndef CYCLUS_SRC_TOOLKIT_COMMODITY_H_
2#define CYCLUS_SRC_TOOLKIT_COMMODITY_H_
3
4#include <string>
5
6namespace cyclus {
7namespace toolkit {
8/// A simple class defining a commodity; it is currently super simple.
9/// The reason this class exists is so that code may be cleaner and more straightforward
10/// while one could have chosen to typedef a string, there may be some reason to extend
11/// the class in the future.
12class Commodity {
13 public:
14 /// Default constructor
15 Commodity();
16
17 /// Constructor
18 /// @param name the name of the commodity
19 Commodity(std::string name);
20
21 /// The commodity's name
22 std::string name() const;
23
24 /// Equality operator
25 bool operator==(const Commodity& other) const;
26
27 /// Inequality operator
28 bool operator!=(const Commodity& other) const;
29
30 private:
31 /// The name of the commodity
32 std::string name_;
33};
34
35/// A comparator so that commodities may be used in maps
36/// we do not care how they are compared, only that they can be
38 inline bool operator()(const Commodity& lhs, const Commodity& rhs) const {
39 return lhs.name() < rhs.name();
40 }
41};
42
43} // namespace toolkit
44} // namespace cyclus
45
46#endif // CYCLUS_SRC_TOOLKIT_COMMODITY_H_
A simple class defining a commodity; it is currently super simple.
Definition commodity.h:12
Commodity()
Default constructor.
Definition commodity.cc:7
bool operator!=(const Commodity &other) const
Inequality operator.
Definition commodity.cc:23
bool operator==(const Commodity &other) const
Equality operator.
Definition commodity.cc:18
std::string name() const
The commodity's name.
Definition commodity.cc:13
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
Definition agent.cc:14
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters
A comparator so that commodities may be used in maps we do not care how they are compared,...
Definition commodity.h:37
bool operator()(const Commodity &lhs, const Commodity &rhs) const
Definition commodity.h:38