00001 #include "HTL/H_Locator.h"
00002 #include "HepODBMS/naming/HepNamingTree.h"
00003
00004 int H_Locator::checkCurrentNode () {
00005 HepAnyRef cNode;
00006 dbApp->naming().getCurrentNode(cNode);
00007 if (cNode != 0)
00008 return 1;
00009 else
00010 return 0;
00011 }
00012
00013 int H_Locator::changeDir ( char *path ) {
00014 int retval = 0;
00015 if (checkCurrentNode()) {
00016 if (path != 0)
00017 dbApp->naming().changeDirectory(path);
00018 retval = 1;
00019 } else
00020 HTL_ERR("Naming service not available, action ignored" )
00021 return retval;
00022 }
00023
00024 int H_Locator::init (HepDbApplication *app, char *path) {
00025 dbApp = app;
00026 return changeDir(path);
00027 }
00028
00029 H_P_REF(P_Histo1D) H_Locator::Histo1D (char *id) {
00030 H_P_REF(P_Histo1D) hhh = 0;
00031 if (checkCurrentNode()) {
00032 if (dbApp->naming().findObject(id,hhh)) {
00033 if (strcmp(hhh->ooGetTypeName(),"P_Histo1D")) {
00034 hhh = 0;
00035 HTL_ERR("Object is not a P_Histo1D" )
00036 }
00037 } else
00038 HTL_ERR("Naming service not available, action ignored" )
00039 }
00040 return hhh;
00041 }
00042
00043 H_P_REF(P_Histo1D) H_Locator::Histo1D (int id) {
00044 char idc[128];
00045 sprintf (idc,"%d",id);
00046 return Histo1D (idc);
00047 }
00048
00049 H_P_REF(P_Histo1DVar) H_Locator::Histo1DVar (char *id) {
00050 H_P_REF(P_Histo1DVar) hhh = 0;
00051 if (checkCurrentNode()) {
00052 if (dbApp->naming().findObject(id,hhh)) {
00053 if (strcmp(hhh->ooGetTypeName(),"P_Histo1DVar")) {
00054 hhh = 0;
00055 HTL_ERR("Object is not a P_Histo1DVar" )
00056 }
00057 } else
00058 HTL_ERR("Naming service not available, action ignored" )
00059 }
00060 return hhh;
00061 }
00062
00063 H_P_REF(P_Histo1DVar) H_Locator::Histo1DVar (int id) {
00064 char idc[128];
00065 sprintf (idc,"%d",id);
00066 return Histo1DVar (idc);
00067 }
00068
00069 H_P_REF(P_ProfileHisto1D) H_Locator::ProfileHisto1D (char *id) {
00070 H_P_REF(P_ProfileHisto1D) hhh = 0;
00071 if (checkCurrentNode()) {
00072 if (dbApp->naming().findObject(id,hhh)) {
00073 if (strcmp(hhh->ooGetTypeName(),"P_ProfileHisto1D")) {
00074 hhh = 0;
00075 HTL_ERR("Object is not a P_ProfileHisto1D" )
00076 }
00077 } else
00078 HTL_ERR("Naming service not available, action ignored" )
00079 }
00080 return hhh;
00081 }
00082
00083 H_P_REF(P_ProfileHisto1D) H_Locator::ProfileHisto1D (int id) {
00084 char idc[128];
00085 sprintf (idc,"%d",id);
00086 return ProfileHisto1D(idc);
00087 }
00088
00089 H_P_REF(P_ProfileHisto1DVar) H_Locator::ProfileHisto1DVar (char *id) {
00090 H_P_REF(P_ProfileHisto1DVar) hhh = 0;
00091 if (checkCurrentNode()) {
00092 if (dbApp->naming().findObject(id,hhh)) {
00093 if (strcmp(hhh->ooGetTypeName(),"P_ProfileHisto1DVar")) {
00094 hhh = 0;
00095 HTL_ERR("Object is not a P_ProfileHisto1DVar" )
00096 }
00097 } else
00098 HTL_ERR("Naming service not available, action ignored" )
00099 }
00100 return hhh;
00101 }
00102
00103 H_P_REF(P_ProfileHisto1DVar) H_Locator::ProfileHisto1DVar (int id) {
00104 char idc[128];
00105 sprintf (idc,"%d",id);
00106 return ProfileHisto1DVar(idc);
00107 }
00108
00109
00110 H_P_REF(P_Histo2D) H_Locator::Histo2D (char *id) {
00111 H_P_REF(P_Histo2D) hhh = 0;
00112 if (checkCurrentNode()) {
00113 if (dbApp->naming().findObject(id,hhh)) {
00114 if (strcmp(hhh->ooGetTypeName(),"P_Histo2D")) {
00115 hhh = 0;
00116 HTL_ERR("Object is not a P_Histo2D" )
00117 }
00118 } else
00119 HTL_ERR("Naming service not available, action ignored" )
00120 }
00121 return hhh;
00122 }
00123
00124 H_P_REF(P_Histo2D) H_Locator::Histo2D (int id) {
00125 char idc[128];
00126 sprintf (idc,"%d",id);
00127 return Histo2D(idc);
00128 }
00129
00130 H_P_REF(P_Histo2DVar) H_Locator::Histo2DVar (char *id) {
00131 H_P_REF(P_Histo2DVar) hhh = 0;
00132 if (checkCurrentNode()) {
00133 if (dbApp->naming().findObject(id,hhh)) {
00134 if (strcmp(hhh->ooGetTypeName(),"P_Histo2DVar")) {
00135 hhh = 0;
00136 HTL_ERR("Object is not a P_Histo2DVar" )
00137 }
00138 } else
00139 HTL_ERR("Naming service not available, action ignored" )
00140 }
00141 return hhh;
00142 }
00143
00144 H_P_REF(P_Histo2DVar) H_Locator::Histo2DVar (int id) {
00145 char idc[128];
00146 sprintf (idc,"%d",id);
00147 return Histo2DVar(idc);
00148 }
00149