remove g++ or c++11 requirement

^#$*&#$ MSVC
This commit is contained in:
Michael Davidsaver
2017-11-01 10:04:36 -05:00
parent b30948249a
commit 943247f0f0
10 changed files with 48 additions and 53 deletions

View File

@ -94,9 +94,9 @@ ChannelCacheEntry::CRequester::channelStateChange(pva::Channel::shared_pointer c
}
// fanout notification
AUTO_VAL(interested, chan->interested.lock_vector()); // Copy
ChannelCacheEntry::interested_t::vector_type interested(chan->interested.lock_vector()); // Copy
FOREACH(it, end, interested)
FOREACH(ChannelCacheEntry::interested_t::vector_type::const_iterator, it, end, interested)
{
GWChannel *chan = it->get();
pva::ChannelRequester::shared_pointer req(chan->requester.lock());
@ -167,7 +167,7 @@ ChannelCache::~ChannelCache()
entries_t E;
E.swap(entries);
FOREACH(it, end, E)
FOREACH(entries_t::iterator, it, end, E)
{
ChannelCacheEntry *ent = it->second.get();

View File

@ -3,15 +3,7 @@
#include <memory>
#if __cplusplus>=201103L
# define AUTO_VAL(NAME,VAL) auto NAME = VAL
# define AUTO_REF(NAME,VAL) auto& NAME = VAL
# define FOREACH(IT,END,C) for(auto IT=(C).begin(), END=(C).end(); IT!=END; ++IT)
#elif defined(__GNUC__)
# define AUTO_VAL(NAME,VAL) __typeof__(VAL) NAME(VAL)
# define AUTO_REF(NAME,VAL) __typeof__(VAL)& NAME(VAL)
# define FOREACH(IT,END,C) for(__typeof__((C).begin()) IT=(C).begin(), END=(C).end(); IT!=END; ++IT)
#endif
#define FOREACH(ITERTYPE, IT,END,C) for(ITERTYPE IT=(C).begin(), END=(C).end(); IT!=END; ++IT)
namespace p2p {
#if __cplusplus>=201103L

View File

@ -177,7 +177,7 @@ MonitorCacheEntry::monitorEvent(pvd::MonitorPtr const & monitor)
if(usr->filled.empty())
dsnotify.push_back(pusr);
AUTO_VAL(elem, usr->empty.front());
pvd::MonitorElementPtr elem(usr->empty.front());
*elem->overrunBitSet = *lastelem->overrunBitSet;
*elem->changedBitSet = *lastelem->changedBitSet;
@ -197,7 +197,7 @@ MonitorCacheEntry::monitorEvent(pvd::MonitorPtr const & monitor)
// unlock here, race w/ stop(), unlisten()?
//TODO: notify from worker thread
FOREACH(it,end,dsnotify) {
FOREACH(dsnotify_t::iterator, it,end,dsnotify) {
MonitorUser *usr = (*it).get();
pvd::MonitorRequester::shared_pointer req(usr->req);
epicsAtomicIncrSizeT(&usr->nwakeups);
@ -224,7 +224,7 @@ MonitorCacheEntry::unlisten(pvd::MonitorPtr const & monitor)
M->destroy();
std::cout<<__PRETTY_FUNCTION__<<" destroy client monitor\n";
}
FOREACH(it, end, tonotify) {
FOREACH(interested_t::vector_type::iterator, it, end, tonotify) {
MonitorUser *usr = it->get();
pvd::MonitorRequester::shared_pointer req(usr->req);
if(usr->inuse.empty()) // TODO: what about stopped?

View File

@ -220,7 +220,7 @@ void statusServer(int lvl, const char *chanexpr)
if(!chanexpr || iswild) { // no string or some glob pattern
entries = scp->cache.entries; // copy of std::map
} else if(chanexpr) { // just one channel
AUTO_VAL(it, scp->cache.entries.find(chanexpr));
ChannelCache::entries_t::iterator it(scp->cache.entries.find(chanexpr));
if(it!=scp->cache.entries.end())
entries[it->first] = it->second;
}
@ -233,7 +233,7 @@ void statusServer(int lvl, const char *chanexpr)
if(lvl<=0)
continue;
FOREACH(it, end, entries) {
FOREACH(ChannelCache::entries_t::const_iterator, it, end, entries) {
const std::string& channame = it->first;
if(iswild && !epicsStrGlobMatch(channame.c_str(), chanexpr))
continue;
@ -263,7 +263,7 @@ void statusServer(int lvl, const char *chanexpr)
if(lvl<=1)
continue;
FOREACH(it2, end2, mons) {
FOREACH(ChannelCacheEntry::mon_entries_t::lock_vector_type::const_iterator, it2, end2, mons) {
MonitorCacheEntry& ME = *it2->second;
MonitorCacheEntry::interested_t::vector_type usrs;
@ -305,7 +305,7 @@ void statusServer(int lvl, const char *chanexpr)
if(lvl<=2)
continue;
FOREACH(it3, end3, usrs) {
FOREACH(MonitorCacheEntry::interested_t::vector_type::const_iterator, it3, end3, usrs) {
MonitorUser& MU = **it3;
size_t nempty, nfilled, nused, total;
@ -412,7 +412,7 @@ void refCheck(int lvl)
return;
}
if(ctx) {
const AUTO_REF(prov, ctx->getChannelProviders());
const std::vector<pva::ChannelProvider::shared_pointer>& prov(ctx->getChannelProviders());
if(lvl>0) std::cout<<"Server has "<<prov.size()<<" providers\n";
@ -433,17 +433,17 @@ void refCheck(int lvl)
chan_count += entries.size();
FOREACH(it, end, entries)
FOREACH(ChannelCache::entries_t::const_iterator, it, end, entries)
{
AUTO_VAL(M, it->second->mon_entries.lock_vector());
ChannelCacheEntry::mon_entries_t::lock_vector_type M(it->second->mon_entries.lock_vector());
if(lvl>0) std::cout<<" Channel "<<it->second->channelName
<<" has "<<M.size()<<" Client Monitors\n";
mon_count += M.size();
FOREACH(it2, end2, M)
FOREACH(ChannelCacheEntry::mon_entries_t::lock_vector_type::const_iterator, it2, end2, M)
{
AUTO_REF(W, it2->second->interested);
const MonitorCacheEntry::interested_t& W(it2->second->interested);
if(lvl>0) std::cout<<" Used by "<<W.size()<<" Client Monitors\n";
mon_user_count += W.size();
}