CMS 3D CMS Logo

Public Member Functions | Private Attributes

DQMBasicNet Class Reference

#include <DQMNet.h>

Inheritance diagram for DQMBasicNet:
DQMImplNet< DQMNet::Object > DQMNet

List of all members.

Public Member Functions

 DQMBasicNet (const std::string &appname="")
bool removeLocalExcept (const std::set< std::string > &known)
void reserveLocalSpace (uint32_t size)
 Give a hint of how much capacity to allocate for local objects.
void updateLocalObject (Object &o)

Private Attributes

ImplPeer * local_

Detailed Description

Definition at line 593 of file DQMNet.h.


Constructor & Destructor Documentation

DQMBasicNet::DQMBasicNet ( const std::string &  appname = "")

Definition at line 1439 of file DQMNet.cc.

References DQMImplNet< DQMNet::Object >::createPeer(), and local_.

  : DQMImplNet<DQMNet::Object>(appname)
{
  local_ = static_cast<ImplPeer *>(createPeer((Socket *) -1));
}

Member Function Documentation

bool DQMBasicNet::removeLocalExcept ( const std::set< std::string > &  known)

Delete all local objects not in known. Returns true if something was removed. The caller must call sendLocalChanges() later to push out the changes.

Definition at line 1479 of file DQMNet.cc.

References alignCSCRings::e, i, local_, getHLTPrescaleColumns::path, and AlCaHLTBitMon_QueryRunRegistry::string.

{
  size_t removed = 0;
  std::string path;
  ObjectMap::iterator i, e;
  for (i = local_->objs.begin(), e = local_->objs.end(); i != e; )
  {
    path.clear();
    path.reserve(i->dirname->size() + i->objname.size() + 2);
    path += *i->dirname;
    if (! path.empty())
      path += '/';
    path += i->objname;

    if (! known.count(path))
      ++removed, local_->objs.erase(i++);
    else
      ++i;
  }

  return removed > 0;
}
void DQMBasicNet::reserveLocalSpace ( uint32_t  size)

Give a hint of how much capacity to allocate for local objects.

Definition at line 1447 of file DQMNet.cc.

References local_.

{
  local_->objs.resize(size);
}
void DQMBasicNet::updateLocalObject ( Object o)

Update the network cache for an object. The caller must call sendLocalChanges() later to push out the changes.

Definition at line 1455 of file DQMNet.cc.

References DQMNet::CoreObject::dirname, DQMNet::CoreObject::flags, info, local_, DQMNet::Object::qdata, DQMNet::CoreObject::qreports, DQMNet::Object::rawdata, DQMNet::Object::scalar, swap(), DQMNet::CoreObject::tag, and DQMNet::CoreObject::version.

{
  o.dirname = &*local_->dirs.insert(*o.dirname).first;
  std::pair<ObjectMap::iterator, bool> info(local_->objs.insert(o));
  if (! info.second)
  {
    // Somewhat hackish. Sets are supposedly immutable, but we
    // need to change the non-key parts of the object. Erasing
    // and re-inserting would produce too much memory churn.
    Object &old = const_cast<Object &>(*info.first);
    std::swap(old.flags,     o.flags);
    std::swap(old.tag,       o.tag);
    std::swap(old.version,   o.version);
    std::swap(old.qreports,  o.qreports);
    std::swap(old.rawdata,   o.rawdata);
    std::swap(old.scalar,    o.scalar);
    std::swap(old.qdata,     o.qdata);
  }
}

Member Data Documentation

ImplPeer* DQMBasicNet::local_ [private]

Definition at line 603 of file DQMNet.h.

Referenced by DQMBasicNet(), removeLocalExcept(), reserveLocalSpace(), and updateLocalObject().