git.stg.codes
/
stg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ticket. Get() function added.
[stg.git]
/
include
/
stg
/
tariff.h
diff --git
a/include/stg/tariff.h
b/include/stg/tariff.h
index 1b6413b302f3c56417d32683d530850dcc6eb5f9..5d01cba08886be4087aced98c1305b072e16ef05 100644
(file)
--- a/
include/stg/tariff.h
+++ b/
include/stg/tariff.h
@@
-41,6
+41,7
@@
public:
static std::string TraffTypeToString(TRAFF_TYPE type);
static TRAFF_TYPE StringToTraffType(const std::string& value);
static std::string TraffTypeToString(TRAFF_TYPE type);
static TRAFF_TYPE StringToTraffType(const std::string& value);
+ static TRAFF_TYPE IntToTraffType(int value);
virtual ~TARIFF() {}
virtual double GetPriceWithTraffType(uint64_t up,
virtual ~TARIFF() {}
virtual double GetPriceWithTraffType(uint64_t up,
@@
-117,4
+118,12
@@
std::istream & operator>>(std::istream & stream, TARIFF::TRAFF_TYPE & traffType)
return stream;
}
return stream;
}
+inline
+TARIFF::TRAFF_TYPE TARIFF::IntToTraffType(int value)
+{
+ if (value < 0 || value > TRAFF_MAX)
+ return TRAFF_UP_DOWN;
+ return static_cast<TRAFF_TYPE>(value);
+}
+
#endif
#endif