• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

abbplugin/src/AbbContext.cxx (r4864/r2882)

Go to the documentation of this file.
00001 #include "roc/AbbContext.h"
00002 
00003 #include "ABBdaemon.h"
00004 
00005 #include "dabc/logging.h"
00006 
00007 roc::AbbContext::AbbContext() :
00008    dabc::Object(0,"ABB"),
00009    fDaemon(0)
00010 {
00011 }
00012 
00013 roc::AbbContext::~AbbContext()
00014 {
00015    if (fDaemon!=0) {
00016 //      DOUT0(("Delete daemon"));
00017       delete fDaemon;
00018       fDaemon = 0;
00019    }
00020 }
00021 
00022 
00023 bool roc::AbbContextRef::CreateDaemon()
00024 {
00025    if (daemon()!=0) return true;
00026    if (GetObject()!=0) {
00027       EOUT(("Context without daemon"));
00028       return false;
00029    }
00030 
00031    abbdaemon::ABBdaemonClient* ddd = 0;
00032 
00033    try {
00034      const char* daemonname = "mprace-0";
00035 
00036      ddd = new abbdaemon::ABBdaemonClient(daemonname, 0);
00037 
00038      ddd->submitReset();
00039 
00040    } catch (abbdaemon::ABBexception e) {
00041      ddd = 0;
00042      EOUT(("Problem to connect to ABB daemon: %s", e.what()));
00043      return false;
00044    }
00045 
00046    AbbContext* ctx = new AbbContext;
00047    ctx->fDaemon = ddd;
00048 
00049    SetObject(ctx, true);
00050    SetTransient(false);
00051    return true;
00052 }

Generated on Tue Dec 10 2013 04:52:16 for ROCsoft by  doxygen 1.7.1