/[PAMELA software]/yodaUtility/YFile.cpp
ViewVC logotype

Contents of /yodaUtility/YFile.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Sun Apr 30 11:08:14 2006 UTC (18 years, 7 months ago) by kusanagi
Branch: MAIN
CVS Tags: yodaUtility2_0/00, yodaUtility1_0/00, yodaUtility2_2/00, yodaUtility2_1/00, HEAD
Changes since 1.1: +0 -0 lines
Error occurred while calculating annotation data.
Various utilities for the yoda environment and its related softwares.
YFile 	   	- Inheriths from TFile     - Add custom features to a TFile object.
YException 	- Inheriths from exception - YODA specific Exceptions.
YMcmd	   	- Decoder for the Mcmd packets.
YSQLConnection 	- Singletn class for DB connections.
yodaUtility     - Various functions.
sgp4		- C++ NORAD SGP4/SDP4 Implementation - Developed by Michael F. Henry.

1 #include <log4cxx/logger.h>
2 #include <YFile.h>
3
4 using namespace log4cxx;
5 using namespace yngn;
6 using namespace yngn::util;
7 using namespace yngn::YException;
8
9 TFile *YFile::yfile = 0;
10 static LoggerPtr logger = Logger::getLogger(_T("yngn.util.YFile"));
11
12 /**
13 * Open/copy a file from remote (rfio) or local path.
14 * This solution have been implemented mainly because the CASTOR system could have performance problem in
15 * case of interactive file opening: the use of the "copy" flag, allow the minimum change for the existing
16 * softwares.
17 * @param url Path to the database to be used.
18 * @param options Path to the database to be used.
19 * @param copy Flag to define if the file have to be copied on a specified path or not. Default si false.
20 * @param path Where to copy the file. Default is local.
21 */
22 TFile* YFile::Open(const char *url, const char* options, bool copy, const char *path) throw (YNotExistingFileException, YSystemCommandException) {
23 const char *name;
24 if ((copy) && (strlen(strstr(url, "rfio:/")) > 0)){
25 char cmd[999];
26 //Here do the copy of the remote file
27 if (copy){
28 strcpy (cmd,"rfcp ");
29 strcat (cmd,url+5);
30 strcat (cmd," ");
31 strcat (cmd, path);
32 if (system(cmd) == 0) throw YSystemCommandException(cmd);
33 name = strrchr(url,'/');
34 }
35 } else {
36 name = url;
37 }
38 yfile = TFile::Open(name, options);
39 if (yfile == 0) throw YNotExistingFileException(url);
40 return yfile;
41 }

  ViewVC Help
Powered by ViewVC 1.1.23