CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends

evf::ServiceWebRegistry Class Reference

#include <ServiceWebRegistry.h>

List of all members.

Public Member Functions

std::vector< ServiceWeb * > getWebs ()
void invoke (xgi::Input *, xgi::Output *, const std::string &)
void publish (xdata::InfoSpace *)
void registerWeb (std::string &name, ServiceWeb *cl)
 ServiceWebRegistry (const edm::ParameterSet &)

Private Types

typedef std::map< std::string,
ServiceWeb * > 
dct
typedef dct::iterator idct

Private Member Functions

void clear ()

Private Attributes

dct clm_

Friends

class FWEPWrapper

Detailed Description

Definition at line 27 of file ServiceWebRegistry.h.


Member Typedef Documentation

typedef std::map<std::string, ServiceWeb*> evf::ServiceWebRegistry::dct [private]

Definition at line 46 of file ServiceWebRegistry.h.

typedef dct::iterator evf::ServiceWebRegistry::idct [private]

Definition at line 47 of file ServiceWebRegistry.h.


Constructor & Destructor Documentation

evf::ServiceWebRegistry::ServiceWebRegistry ( const edm::ParameterSet ps)

Definition at line 7 of file ServiceWebRegistry.cc.

References gather_cfg::cout.

                                                               {
  std::cout << "Service registry constructor at " << std::hex << (unsigned long) this << std::dec << std::endl;
}

Member Function Documentation

void evf::ServiceWebRegistry::clear ( void  ) [private]

Definition at line 54 of file ServiceWebRegistry.cc.

References clm_, and gather_cfg::cout.

Referenced by evf::FWEPWrapper::stopAndHalt().

{
  std::cout << "Service registry clear for " << std::hex << (unsigned long) this << std::dec << std::endl; 
  clm_.clear();
}
std::vector< ServiceWeb * > evf::ServiceWebRegistry::getWebs ( )

Definition at line 13 of file ServiceWebRegistry.cc.

References clm_, gather_cfg::cout, and i.

{
  std::cout << " service web registry " << std::hex << (unsigned long) this << std::dec 
            << " has " << clm_.size() << " services registered " << std::endl;
  std::vector<ServiceWeb*> retval;
  for(idct i = clm_.begin(); i != clm_.end(); i++)
    {
      std::cout << "service " << (*i).first << " has web " << std::endl;
      retval.push_back((*i).second);
    }
  return retval;
}
void evf::ServiceWebRegistry::invoke ( xgi::Input *  in,
xgi::Output *  out,
const std::string &  name 
)

Definition at line 44 of file MethodInvoker.cc.

References reco::parser::MethodInvoker::args_, edm::errors::Configuration, Exception, edm::errors::InvalidReference, reco::parser::MethodInvoker::isFunction_, reco::parser::MethodInvoker::method_, and run_regression::ret.

                                                                    {
  Reflex::Object ret = retstore;
  /*std::cout << "Invoking " << method_.Name() 
            << " from " << method_.DeclaringType().Name(QUALIFIED) 
            << " on an instance of " << o.DynamicType().Name(QUALIFIED) 
            << " at " << o.Address()
            << " with " << args_.size() << " arguments"
            << std::endl; */
  Type retType;
  if(isFunction_) {
     method_.Invoke(o, &ret, args_);
     retType = method_.TypeOf().ReturnType(); // this is correct, it takes pointers and refs into account
  } else {
     ret = method_.Get(o);
     retType = method_.TypeOf();
  }
  void * addr = ret.Address(); 
  //std::cout << "Stored result of " <<  method_.Name() << " (type " << method_.TypeOf().ReturnType().Name(QUALIFIED) << ") at " << addr << std::endl;
  if(addr==0)
    throw edm::Exception(edm::errors::InvalidReference)
      << "method \"" << method_.Name() << "\" called with " << args_.size() 
      << " arguments returned a null pointer ";   
  //std::cout << "Return type is " << retType.Name(QUALIFIED) << std::endl;
   
  if(retType.IsPointer() || retType.IsReference()) { // both need (void **)->(void *) conversion
      if (retType.IsPointer()) {
        retType = retType.ToType(); // for Pointers, I get the real type this way
      } else {
        retType = Type(retType, 0); // strip cv & ref flags
      }
      while (retType.IsTypedef()) retType = retType.ToType();
      ret = Object(retType, *static_cast<void **>(addr));
      //std::cout << "Now type is " << retType.Name(QUALIFIED) << std::endl;
  }
  if(!ret) 
     throw edm::Exception(edm::errors::Configuration)
      << "method \"" << method_.Name() 
      << "\" returned void invoked on object of type \"" 
      << o.TypeOf().Name(QUALIFIED) << "\"\n";
  return ret;
}
void evf::ServiceWebRegistry::publish ( xdata::InfoSpace *  is)

Definition at line 43 of file ServiceWebRegistry.cc.

References clm_.

Referenced by evf::FWEPWrapper::init().

{
    idct i = clm_.begin();
    while (i != clm_.end())
      {
        (*i).second->publish(is);
        i++;
      }

}
void evf::ServiceWebRegistry::registerWeb ( std::string &  name,
ServiceWeb cl 
) [inline]

Definition at line 32 of file ServiceWebRegistry.h.

References clm_, and gather_cfg::cout.

        {
          std::cout << "**********registering " << name << " to service web registry " 
                    << std::hex << (unsigned long) this << std::dec << std::endl;
          clm_.insert(std::pair<std::string, ServiceWeb*>(name,cl));
          std::cout << "**********registry size now " << clm_.size() << std::endl;
          // CAN ONLY BIND TO xdaq::Application methods...
          //      xgi::bind(cl, func, name);  
        } 

Friends And Related Function Documentation

friend class FWEPWrapper [friend]

Definition at line 50 of file ServiceWebRegistry.h.


Member Data Documentation

Definition at line 49 of file ServiceWebRegistry.h.

Referenced by clear(), getWebs(), publish(), and registerWeb().