00001 #include "IONameIS.h"
00002 #include "../SctNames.h"
00003
00004 namespace Sct {
00005 namespace IS {
00006
00007 string IONameIS::defaultServer = SctNames::getEventDataName();
00008
00009 IONameIS::IONameIS(const string& nameIO) throw(InvalidArgument) : IOName(nameIO) {
00010 IONameIS::parse();
00011 }
00012
00013 IONameIS::IONameIS(const string& uniqueID, const string& className) throw() : IOName(uniqueID, className), server(defaultServer) {
00014 IONameIS::construct();
00015 }
00016
00017 IONameIS::IONameIS(const string& uniqueID, const string& className, const string& server) throw() : IOName(uniqueID, className), server(server) {
00018 IONameIS::construct();
00019 }
00020
00021 IONameIS::~IONameIS() throw() {
00022 }
00023
00024
00025 string IONameIS::getRegExp(const string& className) throw() {
00026 string regExp = ".*";
00027 regExp += className;
00028 regExp += ".*";
00029 return regExp;
00030 }
00031
00032 string IONameIS::getClassName() const throw() {
00033 return className;
00034 }
00035
00036 void IONameIS::parse() throw(InvalidArgument) {
00037 int dot = nameIO.find('.');
00038 server = nameIO.substr(0, dot);
00039 int dot2 = nameIO.find('.', ++dot);
00040 className = nameIO.substr(dot, dot2-dot);
00041 uniqueID = nameIO.substr(++dot2);
00042 }
00043
00044 void IONameIS::construct() throw() {
00045 nameIO = server;
00046 nameIO += ".";
00047 nameIO += className;
00048 nameIO += ".";
00049 nameIO += uniqueID;
00050 }
00051
00052 void IONameIS::setServer(const string& server) throw() {
00053 this->server = server;
00054 construct();
00055 }
00056
00057 string IONameIS::getServer() const throw() {
00058 return server;
00059 }
00060
00061 string IONameIS::getDefaultServer() throw() {
00062 return defaultServer;
00063 }
00064
00065 void IONameIS::setDefaultServer(const string& server) throw() {
00066 defaultServer = server;
00067 }
00068
00069
00070 unsigned long IONameIS::getRunNumber() const{
00071 int dot = getUniqueID().find('.');
00072 std::string run = getUniqueID().substr(0, dot);
00073 std::istringstream iss(run);
00074 unsigned long run_number;
00075 iss >> run_number;
00076 return run_number;
00077 }
00078
00079 unsigned long IONameIS::getScanNumber() const{
00080 int dot = getUniqueID().find('.');
00081 int dot2 = getUniqueID().find('.', ++dot);
00082 std::string scan = getUniqueID().substr(dot, dot2-dot);
00083 std::istringstream iss(scan);
00084 unsigned long scan_number;
00085 iss >> scan_number;
00086 return scan_number;
00087 }
00088
00089 std::string IONameIS::getModuleName() const{
00090 int dot = getUniqueID().find('.');
00091 int dot2 = getUniqueID().find('.', ++dot);
00092 return getUniqueID().substr(++dot2);
00093 }
00094
00095 }
00096 }