SctNames.cpp

00001 #include "SctNames.h"
00002 
00003 #include <mrs/message.h>
00004 #include <cstdlib>
00005 #include <is/info.h>
00006 #include <is/infodictionary.h>
00007 #include <is/infoiterator.h>
00008 #include <is/inforeceiver.h>
00009 
00010 using namespace std;
00011 
00012 namespace Sct {
00013 
00014 string SctNames::getPartitionName() throw() {
00015      static const std::string partitionName = getenv("TDAQ_PARTITION") ? getenv ("TDAQ_PARTITION") : "SCT";
00016      return partitionName;
00017 }
00018 
00019 string SctNames::getEventDataName() throw() {
00020     return "EventData";
00021 }
00022 
00023 string SctNames::getFittedDataName() throw() {
00024     return "FittedData";
00025 }
00026 
00027 string SctNames::getDcsServerName() throw() {
00028     return "SCTDCS_Data";
00029 }
00030 
00031 string SctNames::getTestDataName() throw() {
00032     return "TestData";
00033 }
00034 
00035 string SctNames::getControlDataName() throw() {
00036     return "ControlData";
00037 }
00038 
00039 string SctNames::getRetrievedDataName() throw() {
00040         return "RetrievedData";
00041 }
00042 
00043 string SctNames::getTempDir() throw() {
00044     static std::string dir = getenv("SCT_SCRATCH_DIR") ? getenv("SCT_SCRATCH_DIR") : "/tmp";
00045     return dir;
00046 }
00047 
00048 std::string SctNames::getPersistentDir() throw(){
00049      return m_persistent_dir;
00050 }
00051 
00052 void SctNames::setPersistentDir(const char* newDirectory) throw(){
00053   m_persistent_dir = newDirectory;
00054  }
00055 
00056 string SctNames::m_persistent_dir = getenv("SCT_PERSISTENT_DIR") ? getenv ("SCT_PERSISTENT_DIR") : "/tmp";
00057 
00058 
00059 std::string SctNames::getLogDir() throw(){
00060      static std::string dir = getenv("TDAQ_LOGS_PATH") ? getenv ("TDAQ_LOGS_PATH") : "/tmp";
00061      return dir;
00062 }
00063 
00064 string SctNames::getLocation() throw() {
00065     return "Oxford";
00066 }
00067 
00068 string SctNames::getUser() throw() {
00069     return "daquser";
00070 }
00071 
00072 IPCPartition& SctNames::getPartition() throw() {
00073     static IPCPartition partition (getPartitionName());
00074     return partition;
00075 }
00076 
00077 ISInfoDictionary& SctNames::getISDictionary() throw() {
00078     static ISInfoDictionary dictionary(getPartition());
00079     return dictionary;
00080 }
00081 
00082 MRSStream& SctNames::Mrs() {
00083     static MRSStream mrs(getPartition());
00084     return mrs;
00085 }
00086 
00087 static void dummyMRSCallBack(MRSCallbackMsg *mc) {
00088   std::cout << "Ignore this: Got message while testing MRS availability\n";
00089 }
00090 
00091 bool SctNames::isMrsValid() {
00092   // An alternative...
00093 //   list<IPCPartition> l;
00094 //   IPCPartition::getPartitions(l);
00095 //   return l.size() > 0;
00096 
00097   IPCPartition p("SCT");
00098   return p.isValid();
00099 }
00100 
00101 }

Generated on Mon Feb 6 14:01:29 2006 for SCT DAQ/DCS Software - C++ by  doxygen 1.4.6