chrono;
79 size_t Key()
const{
returnm_Key; }
81 virtualostream&
Output(ostream&)
const= 0;
84 template<ETerm term, EComparison comparison,
typenameTValue>
96 template<ETerm term, EComparison comparison,
typenameTValue>
105ostream& Output(ostream& os)
const override;
115 case eKey:
return "key";
116 case eSubkey:
return "subkey";
117 case eCreated:
return "fcr_epoch";
119 case eExpires:
return "fexp_epoch";
123 case eSize:
return "fsize";
124 default:
return nullptr;
130 switch(comparison) {
134 default:
return nullptr;
138 template<
typenameTValue>
141 returnto_string(
value);
150 template<ETerm term, EComparison comparison,
typenameTValue>
156 template<ETerm term, EComparison comparison,
typenameTValue>
159 template<ETerm term,
typenameTValue>
162 SMerge(TValue& left,
constTValue& right)
164 if(left > right) left = right;
168 template<ETerm term,
typenameTValue>
171 SMerge(TValue& left,
constTValue& right)
173 if(left < right) left = right;
183 "Field '"<<
s_Term(
eKey) <<
"' cannot be specified more than once");
187 template<ETerm term, EComparison comparison,
typenameTValue>
190 autoother =
dynamic_cast<decltype(this)
>(o);
196 template<ETerm term, EComparison comparison,
typenameTValue>
211 template<ETerm term, EComparison comparison,
typenameTValue>
214 autocondition = SCondition::Create<term, comparison>(
value);
218 result.impl->conditions.emplace_back(condition);
222 template<ETerm term, EComparison comparison,
typenameTValue>
226 result.base = s_CreateBase<term, comparison>(
value);
232 returnduration_cast<chrono::seconds>(d).count();
242 returns_Create<eKey, eEqual>(v);
247 returns_Create<eCreated, eGreaterOrEqual>(
s_GetSeconds(v));
252 returns_Create<eCreated, eLessThan>(
s_GetSeconds(v));
257 returns_Create<eCreatedAgo, eGreaterOrEqual>(
s_GetSeconds(v));
262 returns_Create<eCreatedAgo, eLessThan>(
s_GetSeconds(v));
267 returns_Create<eExpires, eGreaterOrEqual>(
s_GetSeconds(v));
272 returns_Create<eExpires, eLessThan>(
s_GetSeconds(v));
277 returns_Create<eExpiresIn, eGreaterOrEqual>(
s_GetSeconds(v));
282 returns_Create<eExpiresIn, eLessThan>(
s_GetSeconds(v));
287 returns_Create<eVersionExpires, eGreaterOrEqual>(
s_GetSeconds(v));
292 returns_Create<eVersionExpires, eLessThan>(
s_GetSeconds(v));
297 returns_Create<eVersionExpiresIn, eGreaterOrEqual>(
s_GetSeconds(v));
302 returns_Create<eVersionExpiresIn, eLessThan>(
s_GetSeconds(v));
307 returns_Create<eSize, eGreaterOrEqual>(v);
312 returns_Create<eSize, eLessThan>(v);
317 if(!
l.impl) {
l=
r;
return; }
318 if(!
r.impl)
return;
320 auto&
lc=
l.impl->conditions;
321 auto& rc =
r.impl->conditions;
322 autoli =
lc.begin();
323 autori = rc.begin();
325 while(li !=
lc.end() && ri != rc.end()) {
329 if(lp->Key() < rp->Key()) {
331}
else if(lp->Key() > rp->Key()) {
333 lc.splice(li, rc, old_ri, ++ri);
341 if(ri != rc.end()) {
342 lc.splice(
lc.end(), rc, ri, rc.end());
360 if(!expression.
base.
impl)
returnos;
362 for(
auto& condition : expression.
base.
impl->conditions) {
363os <<
" "<< *condition;
480 size_t eq=
data.find(
"=", pos);
482 if(
eq== string::npos) {
490 if(pos == string::npos) pos =
data.size();
494 returnmake_pair(name,
value);
499 for(
size_tpos = 0; pos <
m_Data.size(); ) {
501 const auto& name = field.first;
502 const auto&
value= field.second;
504 if(name ==
"cr_time") {
506}
else if(name ==
"exp") {
508}
else if(name ==
"ver_dead") {
510}
else if(name ==
"size") {
514 "Unknown field '"<< name <<
"' in response '"<<
m_Data<<
"'");
566 if(!
base.
impl)
returnsize_t();
NetCache internal exception.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
The NCBI C++ standard methods for dealing with std::string.
const TValue & GetValue(void) const
Get a const reference to the current value.
#define NCBI_THROW_FMT(exception_class, err_code, message)
The same as NCBI_THROW but with message processed as output to ostream.
CFields operator|(CFields, CFields)
CExpression operator<(CREATED, time_point)
CExpression operator>=(CREATED, time_point)
CExpression operator&&(CExpression, CExpression)
CExpression operator==(KEY, string)
CExpression operator>(time_point, CREATED)
CExpression operator<=(time_point, CREATED)
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
const struct ncbi::grid::netcache::search::fields::SIZE size
const struct ncbi::grid::netcache::search::fields::EXPIRES expires
const struct ncbi::grid::netcache::search::fields::CREATED created
const struct ncbi::grid::netcache::search::fields::KEY key
const struct ncbi::grid::netcache::search::fields::SUBKEY subkey
const struct ncbi::grid::netcache::search::fields::VERSION_EXPIRES version_expires
const size_t kLargestSize
CExpression s_Create(TValue value)
const char * s_Term(ETerm term)
string s_Value(TValue value)
chrono::system_clock::time_point time_point
void s_Merge(SExpression &l, SExpression &r)
pair< CTempString, CTempString > s_GetField(const string &data, size_t &pos)
chrono::system_clock::duration duration
CExpression operator+(CExpression l, CFields r)
SExpression s_CreateBase(TValue value)
chrono::seconds::rep s_GetSeconds(duration d)
const char * s_Comparison(EComparison comparison)
const chrono::seconds::rep kSmallestTimePoint
ostream & operator<<(ostream &os, const SCondition &c)
Magic spell ;-) needed for some weird compilers... very empiric.
const GenericPointer< typename T::ValueType > T2 value
NCBI C++ auxiliary debug macros.
bool eq(T x_, T y_, T round_)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
string operator[](KEY) const
Output fields specification.
time_point operator[](CREATED)
static SBlobInfoImpl * Create(string data)
CNullable< time_point > m_Expires
CNullable< size_t > m_Size
CNullable< time_point > m_VersionExpires
SBlobInfoImpl(string key, string subkey, string data)
CNullable< time_point > m_Created
shared_ptr< SBlobInfoImpl > impl
ostream & Output(ostream &os) const override
void Merge(SCondition *) override
SConditionImpl(TValue value)
static SCondition * Create(TValue)
virtual void Merge(SCondition *)=0
virtual ostream & Output(ostream &) const =0
list< shared_ptr< SCondition > > conditions
shared_ptr< SExpressionImpl > impl
SMerge(string &, const string &)
SMerge(TValue &left, const TValue &right)
SMerge(TValue &left, const TValue &right)
void Merge(wxMenu &menu_1, const wxMenu &menu_2)
merges all items form menu_2 into menu_1, preserving the structure if possible
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4